Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
declare const stringify: typeof JSON.stringify;
declare const parse: typeof JSON.parse;

declare function JSONBig(options?: Options): { parse: typeof parse; stringify: typeof stringify };

interface Options {
/**
* @default false
*/
strict?: boolean | undefined;
/**
* @default false
*/
storeAsString?: boolean | undefined;
/**
* @default false
*/
alwaysParseAsBig?: boolean | undefined;
/**
* @default false
*/
useNativeBigInt?: boolean | undefined;
/**
* @default 'error'
*/
protoAction?: "error" | "ignore" | "preserve" | undefined;
/**
* @default 'error'
*/
constructorAction?: "error" | "ignore" | "preserve" | undefined;
}

type JSONBigExport = typeof JSONBig & { parse: typeof parse; stringify: typeof stringify };

declare const _: JSONBigExport;
export = _;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.2",
"description": "JSON.parse with bigint support and correct handling of scientific notation",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.js",
"lib/parse.js",
Expand Down