Skip to content

Commit f64b8e8

Browse files
committed
Wrong value for _.isEqual(0, new Number(Number.MIN_VALUE))
1 parent 36eef3c commit f64b8e8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

test/objects.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
assert.ok(!_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
331331
assert.ok(!_.isEqual(null, void 0), '`null` is not equal to `undefined`');
332332
assert.ok(!_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefined`');
333+
assert.ok(!_.isEqual(0, new Number(Number.MIN_VALUE)), '`0` is not equal to `new Number(Number.MIN_VALUE)`');
333334

334335
// String object and primitive comparisons.
335336
assert.ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');

underscore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@
12231223
// Object(NaN) is equivalent to NaN.
12241224
if (+a !== +a) return +b !== +b;
12251225
// An `egal` comparison is performed for other numeric values.
1226-
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
1226+
return +a === 0 && +b === 0 ? 1 / +a === 1 / b : +a === +b;
12271227
case '[object Date]':
12281228
case '[object Boolean]':
12291229
// Coerce dates and booleans to numeric primitive values. Dates are compared by their

0 commit comments

Comments
 (0)