values. It supports recursive / cyclical data structures, is written to avoid
try / catch / throw (for speed), and has no dependencies by default.
If you're running Node 0.12+ or io.js,
deeper will use the built-in
Buffer.equals(). If you're running an older version of Node and you install
buffertools into a project
deeper, it will use that to speed up comparison of Buffers. This used
to be installed as an optional dependency, but it gets in the way of
browserification and also makes using
deeper in your own projects harder, so
I changed it to just try to use it if it's there.
It has some optimizations, but stresses correctness over raw speed (unless
you're testing objects with lots of Buffers attached to them, in which case it
buffertools is likely to be the fastest general-purpose deep-comparison
I like to think the documentation is pretty OK.
npm install deeper
// vanillavar deepEqual =if ! console;
Copied from the source, here are the details of
===only tests objects and functions by reference.
nullis an object. Any pairs of identical entities failing this test are therefore objects (including
null), which need to be recursed into and compared attribute by attribute.
bis not an object, they're clearly not the same. All unfiltered
bgetting past this are objects (including
nullis an object, but
null === null.All unfiltered
.getTime()) than by lexical value.
RegExpsby their components, not the objects themselves.
callee, which you shouldn't be looking at anyway.
bare on the same constructor chain.
bhave the same number of own properties (which is what
BSD. Go nuts.