fast-equals 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.beta.json +13 -0
- package/.release-it.json +9 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/6982fa2ac1e62f4aebb1debc73977393caa0d5a4 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/BUILD.md +37 -0
- package/CHANGELOG.md +39 -0
- package/README.md +69 -88
- package/dist/fast-equals.cjs.js +427 -0
- package/dist/fast-equals.cjs.js.map +1 -0
- package/dist/fast-equals.esm.js +418 -0
- package/dist/fast-equals.esm.js.map +1 -0
- package/dist/fast-equals.js +418 -11
- package/dist/fast-equals.js.map +1 -1
- package/dist/fast-equals.min.js +1 -1
- package/dist/fast-equals.mjs +418 -0
- package/dist/fast-equals.mjs.map +1 -0
- package/index.d.ts +15 -14
- package/package.json +52 -65
- package/es/comparator.js +0 -91
- package/es/constants.js +0 -14
- package/es/index.js +0 -23
- package/es/utils.js +0 -295
- package/es-to-mjs.js +0 -14
- package/lib/comparator.js +0 -97
- package/lib/constants.js +0 -17
- package/lib/index.js +0 -34
- package/lib/utils.js +0 -300
- package/mjs/comparator.mjs +0 -91
- package/mjs/constants.mjs +0 -14
- package/mjs/index.mjs +0 -23
- package/mjs/utils.mjs +0 -295
- package/rollup.config.js +0 -44
- package/yarn-error.log +0 -8175
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Starting with version `1.5.0`, circular objects are supported for both deep and
|
|
|
20
20
|
## Table of contents
|
|
21
21
|
|
|
22
22
|
- [Usage](#usage)
|
|
23
|
-
- [
|
|
23
|
+
- [Specific builds](#specific-builds)
|
|
24
24
|
- [Available methods](#available-methods)
|
|
25
25
|
- [deepEqual](#deepequal)
|
|
26
26
|
- [shallowEqual](#shallowequal)
|
|
@@ -33,55 +33,46 @@ Starting with version `1.5.0`, circular objects are supported for both deep and
|
|
|
33
33
|
|
|
34
34
|
## Usage
|
|
35
35
|
|
|
36
|
-
You can either import the
|
|
36
|
+
You can either import the individual functions desired:
|
|
37
37
|
|
|
38
38
|
```javascript
|
|
39
|
-
import
|
|
39
|
+
import { deepEqual } from 'fast-equals';
|
|
40
40
|
|
|
41
|
-
console.log(
|
|
41
|
+
console.log(deepEqual({ foo: 'bar' }, { foo: 'bar' })); // true
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Or
|
|
44
|
+
Or if you want to import all functions under a namespace:
|
|
45
45
|
|
|
46
46
|
```javascript
|
|
47
|
-
import
|
|
47
|
+
import * as fe from 'fast-equals';
|
|
48
48
|
|
|
49
|
-
console.log(
|
|
49
|
+
console.log(fe.deep({ foo: 'bar' }, { foo: 'bar' })); // true
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
#### Specific builds
|
|
53
53
|
|
|
54
|
-
ESM
|
|
54
|
+
There are three builds, an ESM build for modern build systems / runtimes, a CommonJS build for traditional NodeJS environments, and a UMD build for legacy implementations. The ideal one will likely be chosen for you automatically, however if you want to use a specific build you can always import it directly:
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
- ESM => `fast-equals/dist/fast-equals.esm.js`
|
|
57
|
+
- For older `nodejs` versions that do not allow ESM with file extensions other than `.mjs` => `fast-equals/dist/fast-equals.mjs`
|
|
58
|
+
- CommonJS => `fast-equals/dist/fast-equals.cjs.js`
|
|
59
|
+
- UMD => `fast-equals/dist/fast-equals.js`
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
There is also a pre-minified version of the UMD build available:
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
import fe from "fast-equals/mjs";
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
CommonJS:
|
|
67
|
-
|
|
68
|
-
```javascript
|
|
69
|
-
const fe = require("fast-equals").default;
|
|
70
|
-
```
|
|
63
|
+
- Minified UMD => `fast-equals/dist/fast-equals.min.js`
|
|
71
64
|
|
|
72
65
|
## Available methods
|
|
73
66
|
|
|
74
67
|
#### deepEqual
|
|
75
68
|
|
|
76
|
-
_Aliased on the default export as `fe.deep`_
|
|
77
|
-
|
|
78
69
|
Performs a deep equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
|
|
79
70
|
|
|
80
71
|
```javascript
|
|
81
|
-
import { deepEqual } from
|
|
72
|
+
import { deepEqual } from 'fast-equals';
|
|
82
73
|
|
|
83
|
-
const objectA = { foo: { bar:
|
|
84
|
-
const objectB = { foo: { bar:
|
|
74
|
+
const objectA = { foo: { bar: 'baz' } };
|
|
75
|
+
const objectB = { foo: { bar: 'baz' } };
|
|
85
76
|
|
|
86
77
|
console.log(objectA === objectB); // false
|
|
87
78
|
console.log(deepEqual(objectA, objectB)); // true
|
|
@@ -89,18 +80,16 @@ console.log(deepEqual(objectA, objectB)); // true
|
|
|
89
80
|
|
|
90
81
|
#### shallowEqual
|
|
91
82
|
|
|
92
|
-
_Aliased on the default export as `fe.shallow`_
|
|
93
|
-
|
|
94
83
|
Performs a shallow equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
|
|
95
84
|
|
|
96
85
|
```javascript
|
|
97
|
-
import { shallowEqual } from
|
|
86
|
+
import { shallowEqual } from 'fast-equals';
|
|
98
87
|
|
|
99
|
-
const nestedObject = { bar:
|
|
88
|
+
const nestedObject = { bar: 'baz' };
|
|
100
89
|
|
|
101
90
|
const objectA = { foo: nestedObject };
|
|
102
91
|
const objectB = { foo: nestedObject };
|
|
103
|
-
const objectC = { foo: { bar:
|
|
92
|
+
const objectC = { foo: { bar: 'baz' } };
|
|
104
93
|
|
|
105
94
|
console.log(objectA === objectB); // false
|
|
106
95
|
console.log(shallowEqual(objectA, objectB)); // true
|
|
@@ -109,18 +98,16 @@ console.log(shallowEqual(objectA, objectC)); // false
|
|
|
109
98
|
|
|
110
99
|
#### sameValueZeroEqual
|
|
111
100
|
|
|
112
|
-
_Aliased on the default export as `fe.sameValueZero`_
|
|
113
|
-
|
|
114
101
|
Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) comparison on the two objects passed and returns a boolean representing the value equivalency of the objects. In simple terms, this means either strictly equal or both `NaN`.
|
|
115
102
|
|
|
116
103
|
```javascript
|
|
117
|
-
import { sameValueZeroEqual } from
|
|
104
|
+
import { sameValueZeroEqual } from 'fast-equals';
|
|
118
105
|
|
|
119
|
-
const mainObject = { foo: NaN, bar:
|
|
106
|
+
const mainObject = { foo: NaN, bar: 'baz' };
|
|
120
107
|
|
|
121
|
-
const objectA =
|
|
108
|
+
const objectA = 'baz';
|
|
122
109
|
const objectB = NaN;
|
|
123
|
-
const objectC = { foo: NaN, bar:
|
|
110
|
+
const objectC = { foo: NaN, bar: 'baz' };
|
|
124
111
|
|
|
125
112
|
console.log(sameValueZeroEqual(mainObject.bar, objectA)); // true
|
|
126
113
|
console.log(sameValueZeroEqual(mainObject.foo, objectB)); // true
|
|
@@ -129,8 +116,6 @@ console.log(sameValueZeroEqual(mainObject, objectC)); // false
|
|
|
129
116
|
|
|
130
117
|
#### circularDeepEqual
|
|
131
118
|
|
|
132
|
-
_Aliased on the default export as `fe.circularDeep`_
|
|
133
|
-
|
|
134
119
|
Performs the same comparison as `deepEqual` but supports circular objects. It is slower than `deepEqual`, so only use if you know circular objects are present.
|
|
135
120
|
|
|
136
121
|
```javascript
|
|
@@ -138,50 +123,53 @@ function Circular(value) {
|
|
|
138
123
|
this.me = {
|
|
139
124
|
deeply: {
|
|
140
125
|
nested: {
|
|
141
|
-
reference: this
|
|
142
|
-
}
|
|
126
|
+
reference: this,
|
|
127
|
+
},
|
|
143
128
|
},
|
|
144
|
-
value
|
|
129
|
+
value,
|
|
145
130
|
};
|
|
146
131
|
}
|
|
147
132
|
|
|
148
|
-
console.log(circularDeepEqual(new Circular(
|
|
149
|
-
console.log(circularDeepEqual(new Circular(
|
|
133
|
+
console.log(circularDeepEqual(new Circular('foo'), new Circular('foo'))); // true
|
|
134
|
+
console.log(circularDeepEqual(new Circular('foo'), new Circular('bar'))); // false
|
|
150
135
|
```
|
|
151
136
|
|
|
152
137
|
#### circularShallowEqual
|
|
153
138
|
|
|
154
|
-
_Aliased on the default export as `fe.circularShallow`_
|
|
155
|
-
|
|
156
139
|
Performs the same comparison as `shallowequal` but supports circular objects. It is slower than `shallowEqual`, so only use if you know circular objects are present.
|
|
157
140
|
|
|
158
141
|
```javascript
|
|
159
|
-
const array = [
|
|
142
|
+
const array = ['foo'];
|
|
160
143
|
|
|
161
144
|
array.push(array);
|
|
162
145
|
|
|
163
|
-
console.log(circularShallowEqual(array, [
|
|
146
|
+
console.log(circularShallowEqual(array, ['foo', array])); // true
|
|
164
147
|
console.log(circularShallowEqual(array, [array])); // false
|
|
165
148
|
```
|
|
166
149
|
|
|
167
150
|
#### createCustomEqual
|
|
168
151
|
|
|
169
|
-
_Aliased on the default export as `fe.createCustom`_
|
|
170
|
-
|
|
171
152
|
Creates a custom equality comparator that will be used on nested values in the object. Unlike `deepEqual` and `shallowEqual`, this is a partial-application function that will receive the internal comparator and should return a function that compares two objects.
|
|
172
153
|
|
|
173
154
|
The signature is as follows:
|
|
174
155
|
|
|
175
|
-
```
|
|
176
|
-
|
|
156
|
+
```typescript
|
|
157
|
+
type EqualityComparator = (a: any, b: any, meta?: any) => boolean;
|
|
158
|
+
type EqualityComparatorCreator = (
|
|
159
|
+
deepEqual: EqualityComparator,
|
|
160
|
+
) => EqualityComparator;
|
|
161
|
+
|
|
162
|
+
function createCustomEqual(
|
|
163
|
+
createIsEqual?: EqualityComparatorCreator,
|
|
164
|
+
): EqualityComparator;
|
|
177
165
|
```
|
|
178
166
|
|
|
179
|
-
The `meta` parameter is whatever you want it to be. It will be passed through to all equality checks, and is meant specifically for use with custom equality methods. For example, with the `circularDeepEqual` and `circularShallowEqual` methods, it is used to pass through a cache of processed objects.
|
|
167
|
+
The `meta` parameter in `EqualityComparator` is whatever you want it to be. It will be passed through to all equality checks, and is meant specifically for use with custom equality methods. For example, with the `circularDeepEqual` and `circularShallowEqual` methods, it is used to pass through a cache of processed objects.
|
|
180
168
|
|
|
181
169
|
An example for a custom equality comparison that also checks against values in the meta object:
|
|
182
170
|
|
|
183
171
|
```javascript
|
|
184
|
-
import { createCustomEqual } from
|
|
172
|
+
import { createCustomEqual } from 'fast-equals';
|
|
185
173
|
|
|
186
174
|
const isDeepEqualOrFooMatchesMeta = createCustomEqual(deepEqual => {
|
|
187
175
|
return (objectA, objectB, meta) => {
|
|
@@ -193,16 +181,16 @@ const isDeepEqualOrFooMatchesMeta = createCustomEqual(deepEqual => {
|
|
|
193
181
|
};
|
|
194
182
|
});
|
|
195
183
|
|
|
196
|
-
const objectA = { foo:
|
|
197
|
-
const objectB = { foo:
|
|
198
|
-
const meta =
|
|
184
|
+
const objectA = { foo: 'bar' };
|
|
185
|
+
const objectB = { foo: 'baz' };
|
|
186
|
+
const meta = 'bar';
|
|
199
187
|
|
|
200
188
|
console.log(isDeepEqualOrFooMatchesMeta(objectA, objectB)); // true
|
|
201
189
|
```
|
|
202
190
|
|
|
203
191
|
## Benchmarks
|
|
204
192
|
|
|
205
|
-
All benchmarks were performed on an i7 8-core Arch Linux laptop with 16GB of memory using NodeJS version `
|
|
193
|
+
All benchmarks were performed on an i7 8-core Arch Linux laptop with 16GB of memory using NodeJS version `10.15.3`, and are based on averages of running comparisons based deep equality on the following object types:
|
|
206
194
|
|
|
207
195
|
- Primitives (`String`, `Number`, `null`, `undefined`)
|
|
208
196
|
- `Function`
|
|
@@ -213,53 +201,46 @@ All benchmarks were performed on an i7 8-core Arch Linux laptop with 16GB of mem
|
|
|
213
201
|
- `react` elements
|
|
214
202
|
- A mixed object with a combination of all the above types
|
|
215
203
|
|
|
216
|
-
| | Operations / second |
|
|
217
|
-
| -------------------------- | ------------------- |
|
|
218
|
-
| **fast-equals** | **
|
|
219
|
-
| nano-equal |
|
|
220
|
-
| shallow-equal-fuzzy |
|
|
221
|
-
|
|
|
222
|
-
| fast-
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
| deep-equal |
|
|
226
|
-
| lodash.isEqual |
|
|
227
|
-
| deep-eql |
|
|
228
|
-
| assert.deepStrictEqual | 1,
|
|
204
|
+
| | Operations / second |
|
|
205
|
+
| -------------------------- | ------------------- |
|
|
206
|
+
| **fast-equals** | **142,730** |
|
|
207
|
+
| nano-equal | 115,530 |
|
|
208
|
+
| shallow-equal-fuzzy | 102,633 |
|
|
209
|
+
| fast-deep-equal | 102,335 |
|
|
210
|
+
| react-fast-compare | 100,036 |
|
|
211
|
+
| **fast-equals (circular)** | **79,589** |
|
|
212
|
+
| underscore.isEqual | 63,390 |
|
|
213
|
+
| deep-equal | 48,783 |
|
|
214
|
+
| lodash.isEqual | 24,456 |
|
|
215
|
+
| deep-eql | 24,196 |
|
|
216
|
+
| assert.deepStrictEqual | 1,382 |
|
|
229
217
|
|
|
230
218
|
Caveats that impact the benchmark (and accuracy of comparison):
|
|
231
219
|
|
|
232
|
-
- `
|
|
233
|
-
- `
|
|
220
|
+
- `assert.deepStrictEqual` does not support `NaN` or `SameValueZero` equality for dates
|
|
221
|
+
- `deep-eql` does not support `SameValueZero` equality for zero equality (positive and negative zero are not equal)
|
|
222
|
+
- `deep-equal` does not support `NaN` and does not strictly compare object type, or date / regexp values, nor uses `SameValueZero` equality for dates
|
|
234
223
|
- `fast-deep-equal` does not support `NaN` or `SameValueZero` equality for dates
|
|
224
|
+
- `nano-equal` does not strictly compare object property structure, array length, or object type, nor `SameValueZero` equality for dates
|
|
235
225
|
- `react-fast-compare` does not support `NaN` or `SameValueZero` equality for dates, and does not compare `function` equality
|
|
226
|
+
- `shallow-equal-fuzzy` does not strictly compare object type or regexp values, nor `SameValueZero` equality for dates
|
|
236
227
|
- `underscore.isEqual` does not support `SameValueZero` equality for primitives or dates
|
|
237
|
-
- `deep-equal` does not support `NaN` and does not strictly compare object type, or date / regexp values, nor uses `SameValueZero` equality for dates
|
|
238
|
-
- `deep-eql` does not support `SameValueZero` equality for zero equality (positive and negative zero are not equal)
|
|
239
|
-
- `assert.deepStrictEqual` does not support `NaN` or `SameValueZero` equality for dates
|
|
240
228
|
|
|
241
|
-
All of these have the potential of inflating the respective library's numbers in comparison to `fast-equals`, but it was the closest apples-to-apples comparison I could create of a reasonable sample size. `Map`s, `Promise`s, and `Set`s were excluded from the benchmark entirely because no library other than `
|
|
229
|
+
All of these have the potential of inflating the respective library's numbers in comparison to `fast-equals`, but it was the closest apples-to-apples comparison I could create of a reasonable sample size. `Map`s, `Promise`s, and `Set`s were excluded from the benchmark entirely because no library other than `deep-eql` fully supported their comparison. The same logic applies to `react` elements (which can be circular objects), but simple elements are non-circular objects so I kept the `react` comparison very basic to allow it to be included.
|
|
242
230
|
|
|
243
231
|
## Development
|
|
244
232
|
|
|
245
233
|
Standard practice, clone the repo and `npm i` to get the dependencies. The following npm scripts are available:
|
|
246
234
|
|
|
247
235
|
- benchmark => run benchmark tests against other equality libraries
|
|
248
|
-
- build => build
|
|
249
|
-
-
|
|
250
|
-
- clean => run `clean:dist`, `clean:es`, and `clean:lib` scripts
|
|
251
|
-
- clean:dist => run `rimraf` on the `dist` folder
|
|
252
|
-
- clean:es => run `rimraf` on the `es` folder
|
|
253
|
-
- clean:lib => run `rimraf` on the `lib` folder
|
|
236
|
+
- build => build `main`, `module`, and `browser` distributables with `rollup`
|
|
237
|
+
- clean => run `rimraf` on the `dist` folder
|
|
254
238
|
- dev => start webpack playground App
|
|
255
|
-
- dist => run `build`
|
|
239
|
+
- dist => run `build`
|
|
256
240
|
- lint => run ESLint on all files in `src` folder (also runs on `dev` script)
|
|
257
241
|
- lint:fix => run `lint` script, but with auto-fixer
|
|
258
|
-
- prepublish =>
|
|
259
242
|
- prepublish:compile => run `lint`, `test:coverage`, `transpile:lib`, `transpile:es`, and `dist` scripts
|
|
260
243
|
- start => run `dev`
|
|
261
244
|
- test => run AVA with NODE_ENV=test on all files in `test` folder
|
|
262
245
|
- test:coverage => run same script as `test` with code coverage calculation via `nyc`
|
|
263
246
|
- test:watch => run same script as `test` but keep persistent watcher
|
|
264
|
-
- transpile:es => run Babel on all files, in `src` folder (transpiled to `es` folder without transpilation of ES2015 export syntax)
|
|
265
|
-
- transpile:lib => run Babel on all files in `src` folder (transpiled to `lib` folder)
|