fast-equals 6.0.0 → 6.0.2
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/README.md +35 -30
- package/dist/cjs/index.cjs +12 -9
- package/dist/es/index.mjs +12 -9
- package/package.json +22 -21
package/README.md
CHANGED
|
@@ -415,73 +415,78 @@ All benchmarks were performed on an i9-11900H Ubuntu Linux 24.04 laptop with 64G
|
|
|
415
415
|
- A mixed object with a combination of all the above types
|
|
416
416
|
|
|
417
417
|
```bash
|
|
418
|
+
Testing mixed objects equal...
|
|
418
419
|
┌────────────────────────────────────────┬────────────────┐
|
|
419
420
|
│ Name │ Ops / sec │
|
|
420
421
|
├────────────────────────────────────────┼────────────────┤
|
|
421
|
-
│ fast-equals (passed) │
|
|
422
|
+
│ fast-equals (passed) │ 1478330.935014 │
|
|
422
423
|
├────────────────────────────────────────┼────────────────┤
|
|
423
|
-
│ fast-deep-equal (passed) │
|
|
424
|
+
│ fast-deep-equal (passed) │ 1246644.004889 │
|
|
424
425
|
├────────────────────────────────────────┼────────────────┤
|
|
425
|
-
│ react-fast-compare (passed) │
|
|
426
|
+
│ react-fast-compare (passed) │ 1223991.602206 │
|
|
426
427
|
├────────────────────────────────────────┼────────────────┤
|
|
427
|
-
│ shallow-equal-fuzzy (passed) │
|
|
428
|
+
│ shallow-equal-fuzzy (passed) │ 1192746.28367 │
|
|
428
429
|
├────────────────────────────────────────┼────────────────┤
|
|
429
|
-
│ nano-equal (failed) │
|
|
430
|
+
│ nano-equal (failed) │ 917825.058845 │
|
|
430
431
|
├────────────────────────────────────────┼────────────────┤
|
|
431
|
-
│ fast-equals (circular) (passed) │
|
|
432
|
+
│ fast-equals (circular) (passed) │ 734269.031473 │
|
|
432
433
|
├────────────────────────────────────────┼────────────────┤
|
|
433
|
-
│ dequal/lite (passed) │
|
|
434
|
+
│ dequal/lite (passed) │ 702632.334945 │
|
|
434
435
|
├────────────────────────────────────────┼────────────────┤
|
|
435
|
-
│ dequal (passed) │
|
|
436
|
+
│ dequal (passed) │ 676206.685725 │
|
|
436
437
|
├────────────────────────────────────────┼────────────────┤
|
|
437
|
-
│ underscore.isEqual (passed) │
|
|
438
|
+
│ underscore.isEqual (passed) │ 413859.810046 │
|
|
438
439
|
├────────────────────────────────────────┼────────────────┤
|
|
439
|
-
│ assert.deepStrictEqual (passed) │
|
|
440
|
+
│ assert.deepStrictEqual (passed) │ 384573.330742 │
|
|
440
441
|
├────────────────────────────────────────┼────────────────┤
|
|
441
|
-
│
|
|
442
|
+
│ es-toolkit (passed) │ 333634.454044 │
|
|
442
443
|
├────────────────────────────────────────┼────────────────┤
|
|
443
|
-
│ fast-equals (strict) (passed) │
|
|
444
|
+
│ fast-equals (strict) (passed) │ 285124.652706 │
|
|
444
445
|
├────────────────────────────────────────┼────────────────┤
|
|
445
|
-
│
|
|
446
|
+
│ lodash.isEqual (passed) │ 272221.340481 │
|
|
446
447
|
├────────────────────────────────────────┼────────────────┤
|
|
447
|
-
│
|
|
448
|
+
│ fast-equals (strict circular) (passed) │ 236878.960045 │
|
|
448
449
|
├────────────────────────────────────────┼────────────────┤
|
|
449
|
-
│ deep-
|
|
450
|
+
│ deep-eql (passed) │ 154390.610864 │
|
|
451
|
+
├────────────────────────────────────────┼────────────────┤
|
|
452
|
+
│ deep-equal (passed) │ 905.343563 │
|
|
450
453
|
└────────────────────────────────────────┴────────────────┘
|
|
451
454
|
|
|
452
455
|
Testing mixed objects not equal...
|
|
453
456
|
┌────────────────────────────────────────┬────────────────┐
|
|
454
457
|
│ Name │ Ops / sec │
|
|
455
458
|
├────────────────────────────────────────┼────────────────┤
|
|
456
|
-
│ fast-equals (passed) │
|
|
459
|
+
│ fast-equals (passed) │ 4962887.909706 │
|
|
460
|
+
├────────────────────────────────────────┼────────────────┤
|
|
461
|
+
│ fast-equals (circular) (passed) │ 3362453.019363 │
|
|
457
462
|
├────────────────────────────────────────┼────────────────┤
|
|
458
|
-
│ fast-
|
|
463
|
+
│ fast-deep-equal (passed) │ 3359178.728738 │
|
|
459
464
|
├────────────────────────────────────────┼────────────────┤
|
|
460
|
-
│ fast-
|
|
465
|
+
│ react-fast-compare (passed) │ 3240226.145634 │
|
|
461
466
|
├────────────────────────────────────────┼────────────────┤
|
|
462
|
-
│
|
|
467
|
+
│ fast-equals (strict) (passed) │ 2895230.420069 │
|
|
463
468
|
├────────────────────────────────────────┼────────────────┤
|
|
464
|
-
│ fast-equals (strict) (passed)
|
|
469
|
+
│ fast-equals (strict circular) (passed) │ 2178891.848559 │
|
|
465
470
|
├────────────────────────────────────────┼────────────────┤
|
|
466
|
-
│
|
|
471
|
+
│ dequal/lite (passed) │ 1271343.172786 │
|
|
467
472
|
├────────────────────────────────────────┼────────────────┤
|
|
468
|
-
│ dequal
|
|
473
|
+
│ dequal (passed) │ 1249090.305916 │
|
|
469
474
|
├────────────────────────────────────────┼────────────────┤
|
|
470
|
-
│
|
|
475
|
+
│ shallow-equal-fuzzy (failed) │ 1197792.018762 │
|
|
471
476
|
├────────────────────────────────────────┼────────────────┤
|
|
472
|
-
│
|
|
477
|
+
│ nano-equal (passed) │ 1041772.816799 │
|
|
473
478
|
├────────────────────────────────────────┼────────────────┤
|
|
474
|
-
│
|
|
479
|
+
│ underscore.isEqual (passed) │ 642874.802948 │
|
|
475
480
|
├────────────────────────────────────────┼────────────────┤
|
|
476
|
-
│
|
|
481
|
+
│ lodash.isEqual (passed) │ 360803.14264 │
|
|
477
482
|
├────────────────────────────────────────┼────────────────┤
|
|
478
|
-
│
|
|
483
|
+
│ es-toolkit (passed) │ 353678.240503 │
|
|
479
484
|
├────────────────────────────────────────┼────────────────┤
|
|
480
|
-
│ deep-eql (passed) │
|
|
485
|
+
│ deep-eql (passed) │ 177224.890296 │
|
|
481
486
|
├────────────────────────────────────────┼────────────────┤
|
|
482
|
-
│ assert.deepStrictEqual (passed) │
|
|
487
|
+
│ assert.deepStrictEqual (passed) │ 19507.749026 │
|
|
483
488
|
├────────────────────────────────────────┼────────────────┤
|
|
484
|
-
│ deep-equal (passed) │
|
|
489
|
+
│ deep-equal (passed) │ 3559.100155 │
|
|
485
490
|
└────────────────────────────────────────┴────────────────┘
|
|
486
491
|
```
|
|
487
492
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -40,7 +40,10 @@ function createIsCircular(areItemsEqual) {
|
|
|
40
40
|
* not enumerable and symbol properties.
|
|
41
41
|
*/
|
|
42
42
|
function getStrictProperties(object) {
|
|
43
|
-
|
|
43
|
+
const symbols = getOwnPropertySymbols(object);
|
|
44
|
+
return symbols.length
|
|
45
|
+
? getOwnPropertyNames(object).concat(symbols)
|
|
46
|
+
: getOwnPropertyNames(object);
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* Whether the object contains the property passed as an own property.
|
|
@@ -138,7 +141,7 @@ function areMapsEqual(a, b, state) {
|
|
|
138
141
|
if (!size) {
|
|
139
142
|
return true;
|
|
140
143
|
}
|
|
141
|
-
const matchedIndices = new
|
|
144
|
+
const matchedIndices = new Uint8Array(size);
|
|
142
145
|
const aIterable = a.entries();
|
|
143
146
|
let aResult;
|
|
144
147
|
let bResult;
|
|
@@ -149,7 +152,7 @@ function areMapsEqual(a, b, state) {
|
|
|
149
152
|
break;
|
|
150
153
|
}
|
|
151
154
|
const bIterable = b.entries();
|
|
152
|
-
let hasMatch =
|
|
155
|
+
let hasMatch = 0;
|
|
153
156
|
let matchIndex = 0;
|
|
154
157
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
155
158
|
while ((bResult = bIterable.next())) {
|
|
@@ -164,7 +167,7 @@ function areMapsEqual(a, b, state) {
|
|
|
164
167
|
const bEntry = bResult.value;
|
|
165
168
|
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
|
|
166
169
|
&& state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
167
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
170
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
168
171
|
break;
|
|
169
172
|
}
|
|
170
173
|
matchIndex++;
|
|
@@ -253,7 +256,7 @@ function areSetsEqual(a, b, state) {
|
|
|
253
256
|
if (!size) {
|
|
254
257
|
return true;
|
|
255
258
|
}
|
|
256
|
-
const matchedIndices = new
|
|
259
|
+
const matchedIndices = new Uint8Array(size);
|
|
257
260
|
const aIterable = a.values();
|
|
258
261
|
let aResult;
|
|
259
262
|
let bResult;
|
|
@@ -263,7 +266,7 @@ function areSetsEqual(a, b, state) {
|
|
|
263
266
|
break;
|
|
264
267
|
}
|
|
265
268
|
const bIterable = b.values();
|
|
266
|
-
let hasMatch =
|
|
269
|
+
let hasMatch = 0;
|
|
267
270
|
let matchIndex = 0;
|
|
268
271
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
269
272
|
while ((bResult = bIterable.next())) {
|
|
@@ -272,7 +275,7 @@ function areSetsEqual(a, b, state) {
|
|
|
272
275
|
}
|
|
273
276
|
if (!matchedIndices[matchIndex]
|
|
274
277
|
&& state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
275
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
278
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
276
279
|
break;
|
|
277
280
|
}
|
|
278
281
|
matchIndex++;
|
|
@@ -287,8 +290,8 @@ function areSetsEqual(a, b, state) {
|
|
|
287
290
|
* Whether the TypedArray instances are equal in value.
|
|
288
291
|
*/
|
|
289
292
|
function areTypedArraysEqual(a, b) {
|
|
290
|
-
let index = a.
|
|
291
|
-
if (b.
|
|
293
|
+
let index = a.length;
|
|
294
|
+
if (b.length !== index || a.byteOffset !== b.byteOffset) {
|
|
292
295
|
return false;
|
|
293
296
|
}
|
|
294
297
|
while (index-- > 0) {
|
package/dist/es/index.mjs
CHANGED
|
@@ -38,7 +38,10 @@ function createIsCircular(areItemsEqual) {
|
|
|
38
38
|
* not enumerable and symbol properties.
|
|
39
39
|
*/
|
|
40
40
|
function getStrictProperties(object) {
|
|
41
|
-
|
|
41
|
+
const symbols = getOwnPropertySymbols(object);
|
|
42
|
+
return symbols.length
|
|
43
|
+
? getOwnPropertyNames(object).concat(symbols)
|
|
44
|
+
: getOwnPropertyNames(object);
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Whether the object contains the property passed as an own property.
|
|
@@ -136,7 +139,7 @@ function areMapsEqual(a, b, state) {
|
|
|
136
139
|
if (!size) {
|
|
137
140
|
return true;
|
|
138
141
|
}
|
|
139
|
-
const matchedIndices = new
|
|
142
|
+
const matchedIndices = new Uint8Array(size);
|
|
140
143
|
const aIterable = a.entries();
|
|
141
144
|
let aResult;
|
|
142
145
|
let bResult;
|
|
@@ -147,7 +150,7 @@ function areMapsEqual(a, b, state) {
|
|
|
147
150
|
break;
|
|
148
151
|
}
|
|
149
152
|
const bIterable = b.entries();
|
|
150
|
-
let hasMatch =
|
|
153
|
+
let hasMatch = 0;
|
|
151
154
|
let matchIndex = 0;
|
|
152
155
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
153
156
|
while ((bResult = bIterable.next())) {
|
|
@@ -162,7 +165,7 @@ function areMapsEqual(a, b, state) {
|
|
|
162
165
|
const bEntry = bResult.value;
|
|
163
166
|
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
|
|
164
167
|
&& state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
165
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
168
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
166
169
|
break;
|
|
167
170
|
}
|
|
168
171
|
matchIndex++;
|
|
@@ -251,7 +254,7 @@ function areSetsEqual(a, b, state) {
|
|
|
251
254
|
if (!size) {
|
|
252
255
|
return true;
|
|
253
256
|
}
|
|
254
|
-
const matchedIndices = new
|
|
257
|
+
const matchedIndices = new Uint8Array(size);
|
|
255
258
|
const aIterable = a.values();
|
|
256
259
|
let aResult;
|
|
257
260
|
let bResult;
|
|
@@ -261,7 +264,7 @@ function areSetsEqual(a, b, state) {
|
|
|
261
264
|
break;
|
|
262
265
|
}
|
|
263
266
|
const bIterable = b.values();
|
|
264
|
-
let hasMatch =
|
|
267
|
+
let hasMatch = 0;
|
|
265
268
|
let matchIndex = 0;
|
|
266
269
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
267
270
|
while ((bResult = bIterable.next())) {
|
|
@@ -270,7 +273,7 @@ function areSetsEqual(a, b, state) {
|
|
|
270
273
|
}
|
|
271
274
|
if (!matchedIndices[matchIndex]
|
|
272
275
|
&& state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
273
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
276
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
274
277
|
break;
|
|
275
278
|
}
|
|
276
279
|
matchIndex++;
|
|
@@ -285,8 +288,8 @@ function areSetsEqual(a, b, state) {
|
|
|
285
288
|
* Whether the TypedArray instances are equal in value.
|
|
286
289
|
*/
|
|
287
290
|
function areTypedArraysEqual(a, b) {
|
|
288
|
-
let index = a.
|
|
289
|
-
if (b.
|
|
291
|
+
let index = a.length;
|
|
292
|
+
if (b.length !== index || a.byteOffset !== b.byteOffset) {
|
|
290
293
|
return false;
|
|
291
294
|
}
|
|
292
295
|
while (index-- > 0) {
|
package/package.json
CHANGED
|
@@ -9,40 +9,41 @@
|
|
|
9
9
|
},
|
|
10
10
|
"description": "A blazing-fast equality comparison utility for a variety of use-cases",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@planttheidea/build-tools": "^2.0.
|
|
13
|
-
"@types/lodash": "^4.17.
|
|
14
|
-
"@types/node": "^24.
|
|
15
|
-
"@types/ramda": "^0.
|
|
16
|
-
"@types/react": "^19.2.
|
|
12
|
+
"@planttheidea/build-tools": "^2.0.2",
|
|
13
|
+
"@types/lodash": "^4.17.24",
|
|
14
|
+
"@types/node": "^24.13.3",
|
|
15
|
+
"@types/ramda": "^0.32.0",
|
|
16
|
+
"@types/react": "^19.2.17",
|
|
17
17
|
"@types/react-dom": "^19.2.3",
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
19
|
-
"@typescript-eslint/parser": "^8.
|
|
20
|
-
"@vitest/coverage-v8": "^4.
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^8.63.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.63.0",
|
|
20
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
21
21
|
"cli-table3": "^0.6.5",
|
|
22
22
|
"decircularize": "^1.0.0",
|
|
23
23
|
"deep-eql": "^5.0.2",
|
|
24
24
|
"deep-equal": "^2.2.3",
|
|
25
25
|
"dequal": "^2.0.3",
|
|
26
|
-
"
|
|
26
|
+
"es-toolkit": "^1.49.0",
|
|
27
|
+
"eslint": "^9.39.4",
|
|
27
28
|
"eslint-friendly-formatter": "^4.0.1",
|
|
28
29
|
"eslint-plugin-import": "^2.32.0",
|
|
29
30
|
"fast-deep-equal": "^3.1.3",
|
|
30
31
|
"fast-glob": "^3.3.3",
|
|
31
|
-
"lodash": "^4.
|
|
32
|
+
"lodash": "^4.18.1",
|
|
32
33
|
"nano-equal": "^2.0.2",
|
|
33
|
-
"prettier": "^3.
|
|
34
|
-
"react": "^19.2.
|
|
35
|
-
"react-dom": "^19.2.
|
|
34
|
+
"prettier": "^3.9.4",
|
|
35
|
+
"react": "^19.2.7",
|
|
36
|
+
"react-dom": "^19.2.7",
|
|
36
37
|
"react-fast-compare": "^3.2.2",
|
|
37
|
-
"release-it": "^
|
|
38
|
-
"rollup": "^4.
|
|
38
|
+
"release-it": "^20.2.1",
|
|
39
|
+
"rollup": "^4.62.2",
|
|
39
40
|
"shallow-equal-fuzzy": "^0.0.2",
|
|
40
|
-
"tinybench": "^6.0.
|
|
41
|
+
"tinybench": "^6.0.2",
|
|
41
42
|
"typescript": "^5.9.3",
|
|
42
|
-
"typescript-eslint": "^8.
|
|
43
|
-
"underscore": "^1.13.
|
|
44
|
-
"vite": "^
|
|
45
|
-
"vitest": "^4.
|
|
43
|
+
"typescript-eslint": "^8.63.0",
|
|
44
|
+
"underscore": "^1.13.8",
|
|
45
|
+
"vite": "^8.1.3",
|
|
46
|
+
"vitest": "^4.1.10"
|
|
46
47
|
},
|
|
47
48
|
"engines": {
|
|
48
49
|
"node": ">=6.0.0"
|
|
@@ -109,5 +110,5 @@
|
|
|
109
110
|
"sideEffects": false,
|
|
110
111
|
"type": "module",
|
|
111
112
|
"types": "./index.d.ts",
|
|
112
|
-
"version": "6.0.
|
|
113
|
+
"version": "6.0.2"
|
|
113
114
|
}
|