Skip to content

Commit

Permalink
Wrong value for _.isEqual(0, new Number(Number.MIN_VALUE))
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Oct 30, 2019
1 parent 36eef3c commit 6a64ee2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/objects.js
Expand Up @@ -330,6 +330,7 @@
assert.ok(!_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
assert.ok(!_.isEqual(null, void 0), '`null` is not equal to `undefined`');
assert.ok(!_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefined`');
assert.ok(!_.isEqual(0, new Number(Number.MIN_VALUE)), '`0` is not equal to `Number.MIN_VALUE`');

// String object and primitive comparisons.
assert.ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');
Expand Down
2 changes: 1 addition & 1 deletion underscore.js
Expand Up @@ -1223,7 +1223,7 @@
// Object(NaN) is equivalent to NaN.
if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
return +a === 0 && +b === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
Expand Down

0 comments on commit 6a64ee2

Please sign in to comment.