Node.js-specific "deep equality" / structural equality tester.
values. It supports recursive / cyclical data structures, is written to avoid
try / catch / throw (for speed), and uses
buffertools when it can to
speed up Buffer comparison.
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's likely to be the fastest general-purpose deep-comparison tool available). Note that some of these optimization choices (i.e. buffertools) make this module unsuitable for use in the browser, even using tools like Browserify. Use substack's deep-equal if Browserify compatibility is important to you.
deeper also comes with shims for use with my three favorite assertion libraries:
See the usage instructions for details on how to enable the shims.
I like to think the documentation is pretty OK.
npm install deeper
// vanillavar deepEqual = require'deeper'if !deepEqualobj1 obj2 console.log"yay! diversity!";// to install the shim against require('assert').deepEqualrequire'deeper'patchAssert;// to patch Chai's eql / deep.equal / et alrequire'deeper'patchChai;// to patch node-tap's ridiculous array of synonyms for deepEqualrequire'deeper'patchTap;
Right now, a lot of the tests rely upon Node bug #4523 not being fixed. When / if somebody (possibly me) gets around to fixing it and the fix propagates out to substack's deep-equal and the copypasta of it in Chai, I'll have to come up with some new tests to verify that the shims still work. There are worse problems to have.
BSD. Go nuts.