Files
Webklar/patches/json-bigint+1.0.0.patch

32 lines
1.5 KiB
Diff

diff --git a/node_modules/json-bigint/lib/parse.js b/node_modules/json-bigint/lib/parse.js
index bb4e5eb..0ea96e8 100644
--- a/node_modules/json-bigint/lib/parse.js
+++ b/node_modules/json-bigint/lib/parse.js
@@ -206,6 +206,7 @@ var json_parse = function (options) {
error('Bad number');
} else {
if (BigNumber == null) BigNumber = require('bignumber.js');
+ if (typeof BigNumber === 'object' && BigNumber && typeof BigNumber.default === 'function') BigNumber = BigNumber.default;
//if (number > 9007199254740992 || number < -9007199254740992)
// Bignumber has stricter check: everything with length > 15 digits disallowed
if (string.length > 15)
diff --git a/node_modules/json-bigint/lib/stringify.js b/node_modules/json-bigint/lib/stringify.js
index 3bd5269..ab80d3e 100644
--- a/node_modules/json-bigint/lib/stringify.js
+++ b/node_modules/json-bigint/lib/stringify.js
@@ -1,4 +1,5 @@
var BigNumber = require('bignumber.js');
+if (typeof BigNumber === 'object' && BigNumber && typeof BigNumber.default === 'function') BigNumber = BigNumber.default;
/*
json2.js
@@ -215,7 +216,7 @@ var JSON = module.exports;
mind = gap,
partial,
value = holder[key],
- isBigNumber = value != null && (value instanceof BigNumber || BigNumber.isBigNumber(value));
+ isBigNumber = value != null && (value instanceof BigNumber || (value && value._isBigNumber === true));
// If the value has a toJSON method, call it to obtain a replacement value.