@calmdownval/slow-deep-equal
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Deep Equal

A deep-equality module with support for ES6 stuff (Map, Set & typed arrays) and circular structures. Based on fast-deep-equal module by Evgeny Poberezkin (MIT license).

Installation

npm install @calmdownval/slow-deep-equal

Usage

The module exports one function (named export) with the signature:

function equal(a: any, b: any, circularChecks: boolean = true): boolean

If you only need to check for circular structures in certain scenarios, you can disable the costly detection dynamically by passing false to the third argument and juice out some extra performance this way.

Testing & Benchmark

npm test
npm run benchmark

With disabled circular checks, benchmarks run basically equal to fast-deep-equal/es6. With the checks enabled the performance, obviously, goes down a little.

fast-deep-equal                   x 240,454 ops/sec ±0.74% (89 runs sampled)
fast-deep-equal/es6               x 194,209 ops/sec ±0.74% (86 runs sampled)
slow-deep-equal (no checks)       x 193,884 ops/sec ±0.88% (84 runs sampled)
slow-deep-equal (circular checks) x 115,863 ops/sec ±0.98% (89 runs sampled)

Package Sidebar

Install

npm i @calmdownval/slow-deep-equal

Weekly Downloads

4

Version

1.0.3

License

MIT

Unpacked Size

7.21 kB

Total Files

5

Last publish

Collaborators

  • calmdownval