Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
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 | [![browser support](https://ci.testling.com/substack/node-deep-equal.png)](https://ci.testling.com/substack/node-deep-equal)
|
---|
9 |
|
---|
10 | [![build status](https://secure.travis-ci.org/substack/node-deep-equal.png)](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 | ```
|
---|
Note:
See
TracBrowser
for help on using the repository browser.