From d2b4c4035700698afd50f2759f2f24d9c22d39d2 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 8 Feb 2019 16:54:04 +0000 Subject: [PATCH] Fixed BigNumber/XRegExp incompatibility. CLoses #481 --- package-lock.json | 31 ++++++++++++++++++----- package.json | 4 +-- src/core/Dish.mjs | 4 +-- src/core/operations/Divide.mjs | 2 +- src/core/operations/Mean.mjs | 2 +- src/core/operations/Median.mjs | 2 +- src/core/operations/Multiply.mjs | 2 +- src/core/operations/StandardDeviation.mjs | 2 +- src/core/operations/Subtract.mjs | 2 +- src/core/operations/Sum.mjs | 2 +- 10 files changed, 36 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2a17358..9cf62951 100644 --- a/package-lock.json +++ b/package-lock.json @@ -766,6 +766,22 @@ "semver": "^5.3.0" } }, + "@babel/runtime-corejs2": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.3.1.tgz", + "integrity": "sha512-YpO13776h3e6Wy8dl2J8T9Qwlvopr+b4trCEhHE+yek6yIqV8sx6g3KozdHMbXeBpjosbPi+Ii5Z7X9oXFHUKA==", + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" + } + } + }, "@babel/template": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", @@ -2087,9 +2103,9 @@ "dev": true }, "bignumber.js": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-8.0.1.tgz", - "integrity": "sha512-zAySveTJXkgLYCBi0b14xzfnOs+f3G6x36I8w2a1+PFQpWk/dp0mI0F+ZZK2bu+3ELewDcSyP+Cfq++NcHX7sg==" + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-8.0.2.tgz", + "integrity": "sha512-EiuvFrnbv0jFixEQ9f58jo7X0qI2lNGIr/MxntmVzQc5JUweDSh8y8hbTCAomFtqwUPIOWcLXP0VEOSZTG7FFw==" }, "binary-extensions": { "version": "1.12.0", @@ -13831,9 +13847,12 @@ "integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ==" }, "xregexp": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.2.0.tgz", - "integrity": "sha512-IyMa7SVe9FyT4WbQVW3b95mTLVceHhLEezQ02+QMvmIqDnKTxk0MLWIQPSW2MXAr1zQb+9yvwYhcyQULneh3wA==" + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.2.4.tgz", + "integrity": "sha512-sO0bYdYeJAJBcJA8g7MJJX7UrOZIfJPd8U2SC7B2Dd/J24U0aQNoGp33shCaBSWeb0rD5rh6VBUIXOkGal1TZA==", + "requires": { + "@babel/runtime-corejs2": "^7.2.0" + } }, "xtend": { "version": "4.0.1", diff --git a/package.json b/package.json index 2f2081b4..d09c187a 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "babel-plugin-transform-builtin-extend": "1.1.2", "babel-polyfill": "^6.26.0", "bcryptjs": "^2.4.3", - "bignumber.js": "^8.0.1", + "bignumber.js": "^8.0.2", "bootstrap-colorpicker": "^2.5.3", "bootstrap-material-design": "^4.1.1", "bson": "^4.0.1", @@ -131,7 +131,7 @@ "vkbeautify": "^0.99.3", "xmldom": "^0.1.27", "xpath": "0.0.27", - "xregexp": "^4.2.0", + "xregexp": "^4.2.4", "zlibjs": "^0.3.1" }, "scripts": { diff --git a/src/core/Dish.mjs b/src/core/Dish.mjs index 2276a36c..0635eb75 100755 --- a/src/core/Dish.mjs +++ b/src/core/Dish.mjs @@ -168,7 +168,7 @@ class Dish { this.value = Array.prototype.slice.call(new Uint8Array(this.value)); break; case Dish.BIG_NUMBER: - this.value = this.value instanceof BigNumber ? Utils.strToByteArray(this.value.toFixed()) : []; + this.value = BigNumber.isBigNumber(this.value) ? Utils.strToByteArray(this.value.toFixed()) : []; break; case Dish.JSON: this.value = this.value ? Utils.strToByteArray(JSON.stringify(this.value, null, 4)) : []; @@ -265,7 +265,7 @@ class Dish { case Dish.ARRAY_BUFFER: return this.value instanceof ArrayBuffer; case Dish.BIG_NUMBER: - return this.value instanceof BigNumber; + return BigNumber.isBigNumber(this.value); case Dish.JSON: // All values can be serialised in some manner, so we return true in all cases return true; diff --git a/src/core/operations/Divide.mjs b/src/core/operations/Divide.mjs index 76f50313..5ca88be0 100644 --- a/src/core/operations/Divide.mjs +++ b/src/core/operations/Divide.mjs @@ -43,7 +43,7 @@ class Divide extends Operation { */ run(input, args) { const val = div(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } } diff --git a/src/core/operations/Mean.mjs b/src/core/operations/Mean.mjs index a9bb8831..a7b110ce 100644 --- a/src/core/operations/Mean.mjs +++ b/src/core/operations/Mean.mjs @@ -43,7 +43,7 @@ class Mean extends Operation { */ run(input, args) { const val = mean(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } } diff --git a/src/core/operations/Median.mjs b/src/core/operations/Median.mjs index ac75d83e..7101a403 100644 --- a/src/core/operations/Median.mjs +++ b/src/core/operations/Median.mjs @@ -43,7 +43,7 @@ class Median extends Operation { */ run(input, args) { const val = median(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } } diff --git a/src/core/operations/Multiply.mjs b/src/core/operations/Multiply.mjs index f7e792e2..825078e2 100644 --- a/src/core/operations/Multiply.mjs +++ b/src/core/operations/Multiply.mjs @@ -44,7 +44,7 @@ class Multiply extends Operation { */ run(input, args) { const val = multi(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } } diff --git a/src/core/operations/StandardDeviation.mjs b/src/core/operations/StandardDeviation.mjs index 8aeecd55..d02bd93c 100644 --- a/src/core/operations/StandardDeviation.mjs +++ b/src/core/operations/StandardDeviation.mjs @@ -44,7 +44,7 @@ class StandardDeviation extends Operation { */ run(input, args) { const val = stdDev(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } diff --git a/src/core/operations/Subtract.mjs b/src/core/operations/Subtract.mjs index df8b1d03..10de142b 100644 --- a/src/core/operations/Subtract.mjs +++ b/src/core/operations/Subtract.mjs @@ -44,7 +44,7 @@ class Subtract extends Operation { */ run(input, args) { const val = sub(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } } diff --git a/src/core/operations/Sum.mjs b/src/core/operations/Sum.mjs index ac667cf9..18504106 100644 --- a/src/core/operations/Sum.mjs +++ b/src/core/operations/Sum.mjs @@ -44,7 +44,7 @@ class Sum extends Operation { */ run(input, args) { const val = sum(createNumArray(input, args[0])); - return val instanceof BigNumber ? val : new BigNumber(NaN); + return BigNumber.isBigNumber(val) ? val : new BigNumber(NaN); } }