Skip to content

Commit

Permalink
optimized _.eq function, remove redundant comparison when both null
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonn committed Nov 21, 2016
1 parent ce09af4 commit 2c2abf8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a === 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
if (a == null || b == null) return false;
// `NaN`s are equivalent, but non-reflexive.
if (a !== a) return b !== b;
// Exhaust primitive checks
Expand Down

0 comments on commit 2c2abf8

Please sign in to comment.