Skip to content

mallikcheripally/deep-equal-js

Repository files navigation

deep-equal-js

Blazing fast utility for deep equality checks.

Features

ES6 module supporting JavaScript and TypeScript.

Supports checking:

  • Objects
  • Arrays
  • Maps
  • Sets
  • TypedArray
  • RegExp
  • Date
  • Primitives and primitive wrappers (String, Number, Boolean)
  • null, undefined, and NaN.

Installation

npm install deep-equal-js

Alternatively, if you use Yarn:

yarn add deep-equal-js

Usage

import deepEqual from 'deep-equal-js';

console.log(deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 })); // true
console.log(deepEqual([1, 2], [1, 2])); // true
console.log(deepEqual(9, 9)); // true
console.log(deepEqual('test', 'test')); // true
console.log(deepEqual(NaN, NaN)) // true
console.log(deepEqual(9, '9')); // false
console.log(deepEqual(null, undefined)); // false

Contributing

We welcome contributions from the community to make this library better. If you find any issues or have suggestions for improvements, feel free to contribute or open an issue on our GitHub Repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Something Missing?

If you find any issues or have suggestions for improvements, feel free to contribute or open an issue on our GitHub Repository.