deep-is
node's assert.deepEqual algorithm except for NaN being equal to NaN
npm install deep-is
Want to see pretty graphs? Log in now!
2 873 | downloads in the last day |
22 242 | downloads in the last week |
91 343 | downloads in the last month |
Last Published By | |
---|---|
Version | 0.1.2 last updated 11 months ago |
License | MIT |
Keywords | equality, equal, compare |
Repository | http://github.com/thlorenz/deep-is.git (git) |
Dependencies | None |
Dependents (7) | datarev, difflet, is2, livedb, optionator, racer, scriptie-talkie |
deep-is
Node's assert.deepEqual() algorithm
as a standalone module. Exactly like
deep-equal except for the fact that deepEqual(NaN, NaN) === true
.
This module is around 5 times faster
than wrapping assert.deepEqual()
in a try/catch
.
example
var equal = require('deep-is');
console.dir([
equal(
{ a : [ 2, 3 ], b : [ 4 ] },
{ a : [ 2, 3 ], b : [ 4 ] }
),
equal(
{ x : 5, y : [6] },
{ x : 5, y : 6 }
)
]);
methods
var deepIs = require('deep-is')
deepIs(a, b)
Compare objects a
and b
, returning whether they are equal according to a
recursive equality algorithm.
install
With npm do:
npm install deep-is
test
With npm do:
npm test
license
MIT. Derived largely from node's assert module.