Skip to content

Commit 691d15b

Browse files
committed
fix null values for JSBI
1 parent 0927eb9 commit 691d15b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

support/polyfills/JSBI.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const JSBI = Sk.global.JSBI = Sk.global.BigInt !== undefined ? {} : __JSBI;
1515

1616
if (Sk.global.BigInt === undefined) {
1717
// __isBigInt is not part of the public api so include it if this is ever removed
18-
JSBI.__isBigInt = JSBI.__isBigInt || ((x) => x instanceof JSBI);
18+
const __isBigInt = JSBI.__isBigInt; // fixes a bug with null values passed to __isBigInt
19+
JSBI.__isBigInt = __isBigInt ? (x) => x !== null && __isBigInt(x) : (x) => x instanceof JSBI;
1920
JSBI.powermod = (x, y, z) => {
2021
const One = JSBI.BigInt(1);
2122
let number = One;

0 commit comments

Comments
 (0)