deep-is
Advanced tools
Comparing version 0.1.0 to 0.1.1
13
index.js
@@ -12,4 +12,8 @@ var pSlice = Array.prototype.slice; | ||
var deepEqual = module.exports = function (actual, expected) { | ||
// enforce Object.is +0 !== -0 | ||
if (actual === 0 && expected === 0) { | ||
return areZerosEqual(actual, expected); | ||
// 7.1. All identical values are equivalent, as determined by ===. | ||
if (actual === expected) { | ||
} else if (actual === expected) { | ||
return true; | ||
@@ -37,3 +41,3 @@ | ||
} | ||
} | ||
}; | ||
@@ -53,2 +57,7 @@ function isUndefinedOrNull(value) { | ||
function areZerosEqual(zeroA, zeroB) { | ||
// (1 / +0|0) -> Infinity, but (1 / -0) -> -Infinity and (Infinity !== -Infinity) | ||
return (1 / zeroA) === (1 / zeroB); | ||
} | ||
function objEquiv(a, b) { | ||
@@ -55,0 +64,0 @@ if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) |
{ | ||
"name": "deep-is", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "node's assert.deepEqual algorithm except for NaN being equal to NaN", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6665
9
145