deep-equal
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
array-buffer-byte-length | 1.0.1 | 5.32 kB | MIT | prod | |
call-bind | 1.0.7 | 21.6 kB | MIT | prod | |
es-get-iterator | 1.1.3 | 10.57 kB | MIT | prod | |
get-intrinsic | 1.2.4 | 12.21 kB | MIT | prod | |
is-arguments | 1.1.1 | 9.64 kB | MIT | prod | |
is-array-buffer | 3.0.4 | 6.71 kB | MIT | prod | |
is-date-object | 1.0.5 | 7.32 kB | MIT | prod | |
is-regex | 1.1.4 | 10.31 kB | MIT | prod | |
is-shared-array-buffer | 1.0.3 | 18.27 kB | MIT | prod | |
isarray | 2.0.5 | 1.82 kB | MIT | prod | |
object-is | 1.1.6 | 26.39 kB | MIT | prod | |
object-keys | 1.1.1 | 7.5 kB | MIT | prod | |
object.assign | 4.1.5 | 18.68 kB | MIT | prod | |
regexp.prototype.flags | 1.5.2 | 39.41 kB | MIT | prod | |
side-channel | 1.0.6 | 22.7 kB | MIT | prod | |
which-boxed-primitive | 1.0.2 | 5.54 kB | MIT | prod | |
which-collection | 1.0.2 | 19.59 kB | MIT | prod | |
which-typed-array | 1.1.15 | 39.75 kB | MIT | prod |
The "deep-equal" npm package acts as a standalone module for Node's assert.deepEqual()
algorithm. With the advantage of being around 46 times faster than enclosing assert.deepEqual()
in a try/catch
, this package provides an efficient method to compare objects using a recursive equality algorithm.
Deep-equal can be easily incorporated into your JavaScript projects. First, you need to install the npm package using the following command:
npm install deep-equal
Once installed, you can require it in your JavaScript file like so:
var deepEqual = require('deep-equal')
To use the function, simply pass the objects you want to compare as arguments:
var equal = require('deep-equal');
console.dir([
equal({ a : [ 2, 3 ], b : [ 4 ] }, { a : [ 2, 3 ], b : [ 4 ] }),
equal({ x : 5, y : [6] }, { x : 5, y : 6 })
]);
This will return whether the objects a
and b
are equal according to the deep equality algorithm. If opts.strict
is set to true
, the function opts for strict equality (===
) when comparing leaf nodes. By default, it uses coercive equality (==
), similar to how assert.deepEqual()
operates.
You can find the comprehensive documentation for deep-equal on its npm package page. The page provides additional details on how to install and use the package, as well as information about version updates, download statistics, and more. Deep-equal's Github repository also contains useful information and allows users to contribute to the development and improvement of the package.