Skip to content

Commit

Permalink
Fixed BigNumber/XRegExp incompatibility. CLoses #481
Browse files Browse the repository at this point in the history
  • Loading branch information
n1474335 committed Feb 8, 2019
1 parent f48af97 commit d2b4c40
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 17 deletions.
31 changes: 25 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/core/Dish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) : [];
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Divide.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Mean.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Median.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Multiply.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/StandardDeviation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Subtract.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Sum.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down

0 comments on commit d2b4c40

Please sign in to comment.