Loosen -0 and 0 checks.

This commit is contained in:
jdalton
2015-04-30 22:10:52 -07:00
parent 0ea1fc5602
commit 566781cab2
3 changed files with 169 additions and 83 deletions

View File

@@ -2333,8 +2333,7 @@
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
// Exit early for identical values.
if (value === other) {
// Treat `+0` vs. `-0` as not equal.
return value !== 0 || (1 / value == 1 / other);
return true;
}
var valType = typeof value,
othType = typeof other;
@@ -3984,8 +3983,7 @@
// Treat `NaN` vs. `NaN` as equal.
return (object != +object)
? other != +other
// But, treat `-0` vs. `+0` as not equal.
: (object == 0 ? ((1 / object) == (1 / other)) : object == +other);
: object == +other;
case regexpTag:
case stringTag:
@@ -4410,7 +4408,7 @@
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value));
return value === value && !isObject(value);
}
/**