Skip to content

Commit

Permalink
fix: handle queries with setter that converts value to Number instance
Browse files Browse the repository at this point in the history
Fix #8150
  • Loading branch information
vkarpov15 committed Sep 15, 2019
1 parent 67f8512 commit b4a3a28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cast/number.js
Expand Up @@ -29,7 +29,7 @@ module.exports = function castNumber(val) {

assert.ok(!isNaN(val));
if (val instanceof Number) {
return val;
return val.valueOf();
}
if (typeof val === 'number') {
return val;
Expand All @@ -38,7 +38,7 @@ module.exports = function castNumber(val) {
return Number(val.valueOf());
}
if (val.toString && !Array.isArray(val) && val.toString() == Number(val)) {
return new Number(val);
return Number(val);
}

assert.ok(false);
Expand Down

0 comments on commit b4a3a28

Please sign in to comment.