fast-deep-equal

The fastest deep equal with ES6 Map, Set and Typed arrays support.

Build Status npm Coverage Status

Install

npm install fast-deep-equal

Features

  • ES5 compatible

  • works in node.js (8+) and browsers (IE9+)

  • checks equality of Date and RegExp objects by value.

ES6 equal (require('fast-deep-equal/es6')) also supports:

  • Maps

  • Sets

  • Typed arrays

Usage

var equal = require('fast-deep-equal');
console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true

To support ES6 Maps, Sets and Typed arrays equality use:

To use with React (avoiding the traversal of React elements' _owner property that contains circular references and is not needed when comparing the elements - borrowed from react-fast-compare):

Performance benchmark

Node.js v12.6.0:

To run benchmark (requires node.js 6+):

Please note: this benchmark runs against the available test cases. To choose the most performant library for your application, it is recommended to benchmark against your data and to NOT expect this benchmark to reflect the performance difference in your application.

Enterprise support

fast-deep-equal package is a part of Tidelift enterprise subscription - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers.

Security contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues.

License

MIT

Last updated

Was this helpful?