-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix reading/writing BigInts in browsers that don't support BigInt at all
- Loading branch information
1 parent
b0a54d0
commit cec4d22
Showing
3 changed files
with
23 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
|
||
export const nativeBigIntSupport = typeof BigInt === 'function'; | ||
|
||
/* | ||
Simply replacing BigInt works in the context of this library, | ||
as all the values read as BigInt can only be used as regular Numbers anyway, | ||
since both DataView and FileReader do not support BigInt offset and length parameters. | ||
*/ | ||
export default (typeof BigInt === 'function' ? BigInt : Number); | ||
export default (nativeBigIntSupport ? BigInt : Number); |
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