1
|
# deep-equal
|
2
|
|
3
|
Node's `assert.deepEqual() algorithm` as a standalone module.
|
4
|
|
5
|
This module is around [5 times faster](https://gist.github.com/2790507)
|
6
|
than wrapping `assert.deepEqual()` in a `try/catch`.
|
7
|
|
8
|
[](https://ci.testling.com/substack/node-deep-equal)
|
9
|
|
10
|
[](https://travis-ci.org/substack/node-deep-equal)
|
11
|
|
12
|
# example
|
13
|
|
14
|
``` js
|
15
|
var equal = require('deep-equal');
|
16
|
console.dir([
|
17
|
equal(
|
18
|
{ a : [ 2, 3 ], b : [ 4 ] },
|
19
|
{ a : [ 2, 3 ], b : [ 4 ] }
|
20
|
),
|
21
|
equal(
|
22
|
{ x : 5, y : [6] },
|
23
|
{ x : 5, y : 6 }
|
24
|
)
|
25
|
]);
|
26
|
```
|
27
|
|
28
|
# methods
|
29
|
|
30
|
``` js
|
31
|
var deepEqual = require('deep-equal')
|
32
|
```
|
33
|
|
34
|
## deepEqual(a, b, opts)
|
35
|
|
36
|
Compare objects `a` and `b`, returning whether they are equal according to a
|
37
|
recursive equality algorithm.
|
38
|
|
39
|
If `opts.strict` is `true`, use strict equality (`===`) to compare leaf nodes.
|
40
|
The default is to use coercive equality (`==`) because that's how
|
41
|
`assert.deepEqual()` works by default.
|
42
|
|
43
|
# install
|
44
|
|
45
|
With [npm](http://npmjs.org) do:
|
46
|
|
47
|
```
|
48
|
npm install deep-equal
|
49
|
```
|
50
|
|
51
|
# test
|
52
|
|
53
|
With [npm](http://npmjs.org) do:
|
54
|
|
55
|
```
|
56
|
npm test
|
57
|
```
|