Node.js-specific "deep equality" / structural equality tester.
Want to see pretty graphs? Log in now!
npm install deeper
|13||downloads in the last month|
|Last Published By|
|Version||1.0.2 last updated a year ago|
|License||Apache License 2.0|
|Keywords||deep, equals, structural, equality, assert, testing|
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
// vanilla var deepEqual = require('deeper') if (!deepEqual(obj1, obj2)) console.log("yay! diversity!"); // to install the shim against require('assert').deepEqual require('deeper').patchAssert(); // to patch Chai's eql / deep.equal / et al require('deeper').patchChai(); // to patch node-tap's ridiculous array of synonyms for deepEqual require('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.