JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22466
  • Score
    100M100P100Q142198F
  • License BSD-2-Clause

JavaScript "deep equality" / structural equality tester with Node.js flavor.

Package Exports

  • deeper

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deeper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

deeper

deeper is a library for structurally comparing the equality of JavaScript values. It supports recursive / cyclical data structures, is written to avoid try / catch / throw (for speed), and has no dependencies by default.

If you install Ben Noordhuis's buffertools into a project using 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's likely to be the fastest general-purpose deep-comparison tool available).

The core algorithm is based on those used by Node's assertion library and the implementation of cycle detection in isEqual in Underscore.js.

I like to think the documentation is pretty OK.

installation

npm install deeper

usage

// vanilla
var deepEqual = require('deeper')

if (!deepEqual(obj1, obj2)) console.log("yay! diversity!");

license

BSD. Go nuts.