-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve 'constructor' keyword in json-bigint and add console.warn on…
… decode error (#1109) * WIP * Set constructorAction: 'preserve' and use JSONBigNative const to get options * Remove commented out code * Add unit test * Fix lint issue and unit test
- Loading branch information
1 parent
0e61d87
commit e2b15bd
Showing
3 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import JSONbig from 'json-bigint'; | ||
|
||
JSONbig({ | ||
const JSONBigNative = JSONbig({ | ||
useNativeBigInt: true, | ||
constructorAction: 'preserve', | ||
}); | ||
|
||
export const parseWithBigInt = (content: string) => JSONbig.parse(content); | ||
export const parseWithBigInt = (content: string) => | ||
JSONBigNative.parse(content); | ||
|
||
export const stringifyWithBigInt = <T = unknown>( | ||
value: T, | ||
replacer?: (key: string, value: T) => T, | ||
space?: string | number, | ||
) => JSONbig.stringify(value, replacer, space); | ||
) => JSONBigNative.stringify(value, replacer, space); |
e2b15bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
holocene – ./
holocene.preview.thundergun.io
holocene-git-main.preview.thundergun.io
e2b15bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./
ui-lyart.vercel.app
ui-git-main.preview.thundergun.io
ui.preview.thundergun.io