fast-equals 6.4.0 → 6.4.1
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 +32 -32
- package/dist/cjs/index.cjs +65 -46
- package/dist/es/index.mjs +65 -46
- package/package.json +18 -17
package/README.md
CHANGED
|
@@ -460,74 +460,74 @@ Testing mixed objects equal...
|
|
|
460
460
|
┌────────────────────────────────────────┬────────────────┐
|
|
461
461
|
│ Name │ Ops / sec │
|
|
462
462
|
├────────────────────────────────────────┼────────────────┤
|
|
463
|
-
│ fast-equals (passed) │
|
|
463
|
+
│ fast-equals (passed) │ 1782450.451369 │
|
|
464
464
|
├────────────────────────────────────────┼────────────────┤
|
|
465
|
-
│ fast-deep-equal (passed) │
|
|
465
|
+
│ fast-deep-equal (passed) │ 1318966.05525 │
|
|
466
466
|
├────────────────────────────────────────┼────────────────┤
|
|
467
|
-
│ react-fast-compare (passed) │
|
|
467
|
+
│ react-fast-compare (passed) │ 1312506.681929 │
|
|
468
468
|
├────────────────────────────────────────┼────────────────┤
|
|
469
|
-
│ shallow-equal-fuzzy (passed) │
|
|
469
|
+
│ shallow-equal-fuzzy (passed) │ 1278565.812104 │
|
|
470
470
|
├────────────────────────────────────────┼────────────────┤
|
|
471
|
-
│ nano-equal (failed) │
|
|
471
|
+
│ nano-equal (failed) │ 983769.888387 │
|
|
472
472
|
├────────────────────────────────────────┼────────────────┤
|
|
473
|
-
│ fast-equals (circular) (passed) │
|
|
473
|
+
│ fast-equals (circular) (passed) │ 907118.190745 │
|
|
474
474
|
├────────────────────────────────────────┼────────────────┤
|
|
475
|
-
│ dequal/lite (passed) │
|
|
475
|
+
│ dequal/lite (passed) │ 783946.658853 │
|
|
476
476
|
├────────────────────────────────────────┼────────────────┤
|
|
477
|
-
│ dequal (passed) │
|
|
477
|
+
│ dequal (passed) │ 765217.048928 │
|
|
478
478
|
├────────────────────────────────────────┼────────────────┤
|
|
479
|
-
│ underscore.isEqual (passed) │
|
|
479
|
+
│ underscore.isEqual (passed) │ 461845.668653 │
|
|
480
480
|
├────────────────────────────────────────┼────────────────┤
|
|
481
|
-
│ assert.deepStrictEqual (passed) │
|
|
481
|
+
│ assert.deepStrictEqual (passed) │ 440373.095029 │
|
|
482
482
|
├────────────────────────────────────────┼────────────────┤
|
|
483
|
-
│ es-toolkit (passed) │
|
|
483
|
+
│ es-toolkit (passed) │ 391305.456936 │
|
|
484
484
|
├────────────────────────────────────────┼────────────────┤
|
|
485
|
-
│ lodash.isEqual (passed) │
|
|
485
|
+
│ lodash.isEqual (passed) │ 290278.80479 │
|
|
486
486
|
├────────────────────────────────────────┼────────────────┤
|
|
487
|
-
│ fast-equals (strict) (passed) │
|
|
487
|
+
│ fast-equals (strict) (passed) │ 290096.328199 │
|
|
488
488
|
├────────────────────────────────────────┼────────────────┤
|
|
489
|
-
│ fast-equals (strict circular) (passed) │
|
|
489
|
+
│ fast-equals (strict circular) (passed) │ 246541.923525 │
|
|
490
490
|
├────────────────────────────────────────┼────────────────┤
|
|
491
|
-
│ deep-eql (passed) │
|
|
491
|
+
│ deep-eql (passed) │ 173208.792462 │
|
|
492
492
|
├────────────────────────────────────────┼────────────────┤
|
|
493
|
-
│ deep-equal (passed) │
|
|
493
|
+
│ deep-equal (passed) │ 1412.586981 │
|
|
494
494
|
└────────────────────────────────────────┴────────────────┘
|
|
495
495
|
|
|
496
496
|
Testing mixed objects not equal...
|
|
497
497
|
┌────────────────────────────────────────┬────────────────┐
|
|
498
498
|
│ Name │ Ops / sec │
|
|
499
499
|
├────────────────────────────────────────┼────────────────┤
|
|
500
|
-
│ fast-equals (passed) │
|
|
500
|
+
│ fast-equals (passed) │ 5488976.412437 │
|
|
501
501
|
├────────────────────────────────────────┼────────────────┤
|
|
502
|
-
│ fast-equals (circular) (passed) │
|
|
502
|
+
│ fast-equals (circular) (passed) │ 3668925.717479 │
|
|
503
503
|
├────────────────────────────────────────┼────────────────┤
|
|
504
|
-
│ fast-deep-equal (passed) │
|
|
504
|
+
│ fast-deep-equal (passed) │ 3552737.084766 │
|
|
505
505
|
├────────────────────────────────────────┼────────────────┤
|
|
506
|
-
│ react-fast-compare (passed) │
|
|
506
|
+
│ react-fast-compare (passed) │ 3441428.035043 │
|
|
507
507
|
├────────────────────────────────────────┼────────────────┤
|
|
508
|
-
│ fast-equals (strict) (passed) │
|
|
508
|
+
│ fast-equals (strict) (passed) │ 1668916.622434 │
|
|
509
509
|
├────────────────────────────────────────┼────────────────┤
|
|
510
|
-
│ dequal/lite (passed) │
|
|
510
|
+
│ dequal/lite (passed) │ 1446091.459485 │
|
|
511
511
|
├────────────────────────────────────────┼────────────────┤
|
|
512
|
-
│
|
|
512
|
+
│ fast-equals (strict circular) (passed) │ 1410439.853116 │
|
|
513
513
|
├────────────────────────────────────────┼────────────────┤
|
|
514
|
-
│
|
|
514
|
+
│ dequal (passed) │ 1395740.020934 │
|
|
515
515
|
├────────────────────────────────────────┼────────────────┤
|
|
516
|
-
│ shallow-equal-fuzzy (failed) │
|
|
516
|
+
│ shallow-equal-fuzzy (failed) │ 1285610.296881 │
|
|
517
517
|
├────────────────────────────────────────┼────────────────┤
|
|
518
|
-
│ nano-equal (passed) │
|
|
518
|
+
│ nano-equal (passed) │ 1130229.996399 │
|
|
519
519
|
├────────────────────────────────────────┼────────────────┤
|
|
520
|
-
│ underscore.isEqual (passed) │
|
|
520
|
+
│ underscore.isEqual (passed) │ 682455.329594 │
|
|
521
521
|
├────────────────────────────────────────┼────────────────┤
|
|
522
|
-
│ es-toolkit (passed) │
|
|
522
|
+
│ es-toolkit (passed) │ 417584.470986 │
|
|
523
523
|
├────────────────────────────────────────┼────────────────┤
|
|
524
|
-
│ lodash.isEqual (passed) │
|
|
524
|
+
│ lodash.isEqual (passed) │ 385904.998549 │
|
|
525
525
|
├────────────────────────────────────────┼────────────────┤
|
|
526
|
-
│ deep-eql (passed) │
|
|
526
|
+
│ deep-eql (passed) │ 202212.291682 │
|
|
527
527
|
├────────────────────────────────────────┼────────────────┤
|
|
528
|
-
│ assert.deepStrictEqual (passed) │
|
|
528
|
+
│ assert.deepStrictEqual (passed) │ 25540.74079 │
|
|
529
529
|
├────────────────────────────────────────┼────────────────┤
|
|
530
|
-
│ deep-equal (passed) │
|
|
530
|
+
│ deep-equal (passed) │ 5867.29696 │
|
|
531
531
|
└────────────────────────────────────────┴────────────────┘
|
|
532
532
|
```
|
|
533
533
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const { getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
4
4
|
const { hasOwnProperty, toString: toString$1 } = Object.prototype;
|
|
5
|
-
const OBJECT_TAG = '[object Object]';
|
|
6
5
|
/**
|
|
7
6
|
* Whether the own properties from `end` onward are equal with strict property checking, where the
|
|
8
7
|
* caller has already verified that both objects have the same number of own properties.
|
|
@@ -134,10 +133,10 @@ function isNullPrototypeComparable(a, b) {
|
|
|
134
133
|
const aConstructor = a.constructor;
|
|
135
134
|
const bConstructor = b.constructor;
|
|
136
135
|
if (aConstructor == null) {
|
|
137
|
-
return bConstructor === Object || toString$1.call(b) ===
|
|
136
|
+
return bConstructor === Object || toString$1.call(b) === '[object Object]';
|
|
138
137
|
}
|
|
139
138
|
if (bConstructor == null) {
|
|
140
|
-
return aConstructor === Object || toString$1.call(a) ===
|
|
139
|
+
return aConstructor === Object || toString$1.call(a) === '[object Object]';
|
|
141
140
|
}
|
|
142
141
|
return false;
|
|
143
142
|
}
|
|
@@ -625,6 +624,7 @@ function areUrlsEqualStrict(a, b, state) {
|
|
|
625
624
|
}
|
|
626
625
|
|
|
627
626
|
const { toString } = Object.prototype;
|
|
627
|
+
const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag;
|
|
628
628
|
/**
|
|
629
629
|
* Create a comparator method based on the type-specific equality comparators passed.
|
|
630
630
|
*/
|
|
@@ -642,22 +642,30 @@ function createEqualityComparator(config) {
|
|
|
642
642
|
* In all cases, these decisions should be reevaluated based on changes to the language and
|
|
643
643
|
* common development practices.
|
|
644
644
|
*
|
|
645
|
+
* When `Symbol.toStringTag` is a non-empty string (TypedArrays, `ArrayBuffer`, `DataView`, `Map`, `URL`,
|
|
646
|
+
* etc.), `toString()` returns `[object ${stringTag}]` regardless of the object's type, so the comparator
|
|
647
|
+
* is looked up by the `Symbol.toStringTag` value directly. This avoids building (and then hashing) the
|
|
648
|
+
* full tag string for every comparison. Otherwise the tag depends on the built-in type, and is captured
|
|
649
|
+
* with `toString()` as before.
|
|
650
|
+
*
|
|
645
651
|
* Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
|
|
646
652
|
* kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
|
|
647
653
|
* See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
|
|
648
654
|
*/
|
|
649
655
|
const areTaggedObjectsEqual = getUnsupportedCustomComparator
|
|
650
656
|
? function areTaggedObjectsEqual(a, b, state) {
|
|
651
|
-
const
|
|
657
|
+
const stringTag = toStringTag && a[toStringTag];
|
|
658
|
+
const tag = stringTag && typeof stringTag === 'string' ? stringTag : toString.call(a);
|
|
652
659
|
const supportedComparator = supportedComparatorMap[tag];
|
|
653
660
|
if (supportedComparator) {
|
|
654
661
|
return supportedComparator(a, b, state);
|
|
655
662
|
}
|
|
656
|
-
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
|
|
663
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag === stringTag ? toString.call(a) : tag);
|
|
657
664
|
return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
|
|
658
665
|
}
|
|
659
666
|
: function areTaggedObjectsEqual(a, b, state) {
|
|
660
|
-
const
|
|
667
|
+
const stringTag = toStringTag && a[toStringTag];
|
|
668
|
+
const supportedComparator = supportedComparatorMap[stringTag && typeof stringTag === 'string' ? stringTag : toString.call(a)];
|
|
661
669
|
return supportedComparator ? supportedComparator(a, b, state) : false;
|
|
662
670
|
};
|
|
663
671
|
/**
|
|
@@ -837,50 +845,61 @@ function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
|
837
845
|
};
|
|
838
846
|
}
|
|
839
847
|
/**
|
|
840
|
-
* Create a map of
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
'
|
|
850
|
-
'
|
|
851
|
-
'
|
|
852
|
-
'
|
|
853
|
-
'
|
|
848
|
+
* Create a map of tags to their respective handlers for `tag`-based lookups. Each handler is keyed
|
|
849
|
+
* by both its `Symbol.toStringTag` value (`Map`) and its `toString()` value (`[object Map]`).
|
|
850
|
+
*
|
|
851
|
+
* @note
|
|
852
|
+
* The map has a `null` prototype, so a `Symbol.toStringTag` like `constructor` or `toString` cannot
|
|
853
|
+
* resolve to an inherited `Object.prototype` method.
|
|
854
|
+
*/
|
|
855
|
+
function createSupportedComparatorMap(config) {
|
|
856
|
+
return [
|
|
857
|
+
['Arguments', config.areObjectsEqual],
|
|
858
|
+
['Array', config.areArraysEqual],
|
|
859
|
+
['ArrayBuffer', config.areArrayBuffersEqual],
|
|
860
|
+
['AsyncGeneratorFunction', config.areFunctionsEqual],
|
|
861
|
+
['BigInt', config.arePrimitiveWrappersEqual],
|
|
862
|
+
['BigInt64Array', config.areTypedArraysEqual],
|
|
863
|
+
['BigUint64Array', config.areTypedArraysEqual],
|
|
864
|
+
['Boolean', config.arePrimitiveWrappersEqual],
|
|
865
|
+
['DataView', config.areDataViewsEqual],
|
|
866
|
+
['Date', config.areDatesEqual],
|
|
854
867
|
// If an error tag, it should be tested explicitly. Like RegExp, the properties are not
|
|
855
868
|
// enumerable, and therefore will give false positives if tested like a standard object.
|
|
856
|
-
'
|
|
857
|
-
'
|
|
858
|
-
'
|
|
859
|
-
'
|
|
860
|
-
'
|
|
861
|
-
'
|
|
862
|
-
'
|
|
863
|
-
'
|
|
864
|
-
'
|
|
865
|
-
'
|
|
866
|
-
'
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
869
|
+
['Error', config.areErrorsEqual],
|
|
870
|
+
['Float16Array', config.areTypedArraysEqual],
|
|
871
|
+
['Float32Array', config.areTypedArraysEqual],
|
|
872
|
+
['Float64Array', config.areTypedArraysEqual],
|
|
873
|
+
['Function', config.areFunctionsEqual],
|
|
874
|
+
['GeneratorFunction', config.areFunctionsEqual],
|
|
875
|
+
['Int8Array', config.areTypedArraysEqual],
|
|
876
|
+
['Int16Array', config.areTypedArraysEqual],
|
|
877
|
+
['Int32Array', config.areTypedArraysEqual],
|
|
878
|
+
['Map', config.areMapsEqual],
|
|
879
|
+
['Number', config.arePrimitiveWrappersEqual],
|
|
880
|
+
[
|
|
881
|
+
'Object',
|
|
882
|
+
(a, b, state) =>
|
|
883
|
+
// The exception for value comparison is custom `Promise`-like class instances. These should
|
|
884
|
+
// be treated the same as standard `Promise` objects, which means strict equality, and if
|
|
885
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
886
|
+
typeof a.then !== 'function' && typeof b.then !== 'function' && config.areObjectsEqual(a, b, state),
|
|
887
|
+
],
|
|
872
888
|
// For RegExp, the properties are not enumerable, and therefore will give false positives if
|
|
873
889
|
// tested like a standard object.
|
|
874
|
-
'
|
|
875
|
-
'
|
|
876
|
-
'
|
|
877
|
-
'
|
|
878
|
-
'
|
|
879
|
-
'
|
|
880
|
-
'
|
|
881
|
-
'
|
|
882
|
-
'
|
|
883
|
-
|
|
890
|
+
['RegExp', config.areRegExpsEqual],
|
|
891
|
+
['Set', config.areSetsEqual],
|
|
892
|
+
['String', config.arePrimitiveWrappersEqual],
|
|
893
|
+
['URL', config.areUrlsEqual],
|
|
894
|
+
['URLSearchParams', config.areUrlSearchParamsEqual],
|
|
895
|
+
['Uint8Array', config.areTypedArraysEqual],
|
|
896
|
+
['Uint8ClampedArray', config.areTypedArraysEqual],
|
|
897
|
+
['Uint16Array', config.areTypedArraysEqual],
|
|
898
|
+
['Uint32Array', config.areTypedArraysEqual],
|
|
899
|
+
].reduce((comparatorMap, [tag, comparator]) => {
|
|
900
|
+
comparatorMap[tag] = comparatorMap[`[object ${tag}]`] = comparator;
|
|
901
|
+
return comparatorMap;
|
|
902
|
+
}, Object.create(null));
|
|
884
903
|
}
|
|
885
904
|
|
|
886
905
|
/**
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
2
2
|
const { hasOwnProperty, toString: toString$1 } = Object.prototype;
|
|
3
|
-
const OBJECT_TAG = '[object Object]';
|
|
4
3
|
/**
|
|
5
4
|
* Whether the own properties from `end` onward are equal with strict property checking, where the
|
|
6
5
|
* caller has already verified that both objects have the same number of own properties.
|
|
@@ -132,10 +131,10 @@ function isNullPrototypeComparable(a, b) {
|
|
|
132
131
|
const aConstructor = a.constructor;
|
|
133
132
|
const bConstructor = b.constructor;
|
|
134
133
|
if (aConstructor == null) {
|
|
135
|
-
return bConstructor === Object || toString$1.call(b) ===
|
|
134
|
+
return bConstructor === Object || toString$1.call(b) === '[object Object]';
|
|
136
135
|
}
|
|
137
136
|
if (bConstructor == null) {
|
|
138
|
-
return aConstructor === Object || toString$1.call(a) ===
|
|
137
|
+
return aConstructor === Object || toString$1.call(a) === '[object Object]';
|
|
139
138
|
}
|
|
140
139
|
return false;
|
|
141
140
|
}
|
|
@@ -623,6 +622,7 @@ function areUrlsEqualStrict(a, b, state) {
|
|
|
623
622
|
}
|
|
624
623
|
|
|
625
624
|
const { toString } = Object.prototype;
|
|
625
|
+
const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag;
|
|
626
626
|
/**
|
|
627
627
|
* Create a comparator method based on the type-specific equality comparators passed.
|
|
628
628
|
*/
|
|
@@ -640,22 +640,30 @@ function createEqualityComparator(config) {
|
|
|
640
640
|
* In all cases, these decisions should be reevaluated based on changes to the language and
|
|
641
641
|
* common development practices.
|
|
642
642
|
*
|
|
643
|
+
* When `Symbol.toStringTag` is a non-empty string (TypedArrays, `ArrayBuffer`, `DataView`, `Map`, `URL`,
|
|
644
|
+
* etc.), `toString()` returns `[object ${stringTag}]` regardless of the object's type, so the comparator
|
|
645
|
+
* is looked up by the `Symbol.toStringTag` value directly. This avoids building (and then hashing) the
|
|
646
|
+
* full tag string for every comparison. Otherwise the tag depends on the built-in type, and is captured
|
|
647
|
+
* with `toString()` as before.
|
|
648
|
+
*
|
|
643
649
|
* Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
|
|
644
650
|
* kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
|
|
645
651
|
* See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
|
|
646
652
|
*/
|
|
647
653
|
const areTaggedObjectsEqual = getUnsupportedCustomComparator
|
|
648
654
|
? function areTaggedObjectsEqual(a, b, state) {
|
|
649
|
-
const
|
|
655
|
+
const stringTag = toStringTag && a[toStringTag];
|
|
656
|
+
const tag = stringTag && typeof stringTag === 'string' ? stringTag : toString.call(a);
|
|
650
657
|
const supportedComparator = supportedComparatorMap[tag];
|
|
651
658
|
if (supportedComparator) {
|
|
652
659
|
return supportedComparator(a, b, state);
|
|
653
660
|
}
|
|
654
|
-
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
|
|
661
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag === stringTag ? toString.call(a) : tag);
|
|
655
662
|
return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
|
|
656
663
|
}
|
|
657
664
|
: function areTaggedObjectsEqual(a, b, state) {
|
|
658
|
-
const
|
|
665
|
+
const stringTag = toStringTag && a[toStringTag];
|
|
666
|
+
const supportedComparator = supportedComparatorMap[stringTag && typeof stringTag === 'string' ? stringTag : toString.call(a)];
|
|
659
667
|
return supportedComparator ? supportedComparator(a, b, state) : false;
|
|
660
668
|
};
|
|
661
669
|
/**
|
|
@@ -835,50 +843,61 @@ function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
|
835
843
|
};
|
|
836
844
|
}
|
|
837
845
|
/**
|
|
838
|
-
* Create a map of
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
'
|
|
848
|
-
'
|
|
849
|
-
'
|
|
850
|
-
'
|
|
851
|
-
'
|
|
846
|
+
* Create a map of tags to their respective handlers for `tag`-based lookups. Each handler is keyed
|
|
847
|
+
* by both its `Symbol.toStringTag` value (`Map`) and its `toString()` value (`[object Map]`).
|
|
848
|
+
*
|
|
849
|
+
* @note
|
|
850
|
+
* The map has a `null` prototype, so a `Symbol.toStringTag` like `constructor` or `toString` cannot
|
|
851
|
+
* resolve to an inherited `Object.prototype` method.
|
|
852
|
+
*/
|
|
853
|
+
function createSupportedComparatorMap(config) {
|
|
854
|
+
return [
|
|
855
|
+
['Arguments', config.areObjectsEqual],
|
|
856
|
+
['Array', config.areArraysEqual],
|
|
857
|
+
['ArrayBuffer', config.areArrayBuffersEqual],
|
|
858
|
+
['AsyncGeneratorFunction', config.areFunctionsEqual],
|
|
859
|
+
['BigInt', config.arePrimitiveWrappersEqual],
|
|
860
|
+
['BigInt64Array', config.areTypedArraysEqual],
|
|
861
|
+
['BigUint64Array', config.areTypedArraysEqual],
|
|
862
|
+
['Boolean', config.arePrimitiveWrappersEqual],
|
|
863
|
+
['DataView', config.areDataViewsEqual],
|
|
864
|
+
['Date', config.areDatesEqual],
|
|
852
865
|
// If an error tag, it should be tested explicitly. Like RegExp, the properties are not
|
|
853
866
|
// enumerable, and therefore will give false positives if tested like a standard object.
|
|
854
|
-
'
|
|
855
|
-
'
|
|
856
|
-
'
|
|
857
|
-
'
|
|
858
|
-
'
|
|
859
|
-
'
|
|
860
|
-
'
|
|
861
|
-
'
|
|
862
|
-
'
|
|
863
|
-
'
|
|
864
|
-
'
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
867
|
+
['Error', config.areErrorsEqual],
|
|
868
|
+
['Float16Array', config.areTypedArraysEqual],
|
|
869
|
+
['Float32Array', config.areTypedArraysEqual],
|
|
870
|
+
['Float64Array', config.areTypedArraysEqual],
|
|
871
|
+
['Function', config.areFunctionsEqual],
|
|
872
|
+
['GeneratorFunction', config.areFunctionsEqual],
|
|
873
|
+
['Int8Array', config.areTypedArraysEqual],
|
|
874
|
+
['Int16Array', config.areTypedArraysEqual],
|
|
875
|
+
['Int32Array', config.areTypedArraysEqual],
|
|
876
|
+
['Map', config.areMapsEqual],
|
|
877
|
+
['Number', config.arePrimitiveWrappersEqual],
|
|
878
|
+
[
|
|
879
|
+
'Object',
|
|
880
|
+
(a, b, state) =>
|
|
881
|
+
// The exception for value comparison is custom `Promise`-like class instances. These should
|
|
882
|
+
// be treated the same as standard `Promise` objects, which means strict equality, and if
|
|
883
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
884
|
+
typeof a.then !== 'function' && typeof b.then !== 'function' && config.areObjectsEqual(a, b, state),
|
|
885
|
+
],
|
|
870
886
|
// For RegExp, the properties are not enumerable, and therefore will give false positives if
|
|
871
887
|
// tested like a standard object.
|
|
872
|
-
'
|
|
873
|
-
'
|
|
874
|
-
'
|
|
875
|
-
'
|
|
876
|
-
'
|
|
877
|
-
'
|
|
878
|
-
'
|
|
879
|
-
'
|
|
880
|
-
'
|
|
881
|
-
|
|
888
|
+
['RegExp', config.areRegExpsEqual],
|
|
889
|
+
['Set', config.areSetsEqual],
|
|
890
|
+
['String', config.arePrimitiveWrappersEqual],
|
|
891
|
+
['URL', config.areUrlsEqual],
|
|
892
|
+
['URLSearchParams', config.areUrlSearchParamsEqual],
|
|
893
|
+
['Uint8Array', config.areTypedArraysEqual],
|
|
894
|
+
['Uint8ClampedArray', config.areTypedArraysEqual],
|
|
895
|
+
['Uint16Array', config.areTypedArraysEqual],
|
|
896
|
+
['Uint32Array', config.areTypedArraysEqual],
|
|
897
|
+
].reduce((comparatorMap, [tag, comparator]) => {
|
|
898
|
+
comparatorMap[tag] = comparatorMap[`[object ${tag}]`] = comparator;
|
|
899
|
+
return comparatorMap;
|
|
900
|
+
}, Object.create(null));
|
|
882
901
|
}
|
|
883
902
|
|
|
884
903
|
/**
|
package/package.json
CHANGED
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"description": "A blazing-fast equality comparison utility for a variety of use-cases",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@planttheidea/build-tools": "^2.0.8",
|
|
13
|
-
"@types/lodash": "^4.17.
|
|
14
|
-
"@types/node": "^24.19.
|
|
13
|
+
"@types/lodash": "^4.17.27",
|
|
14
|
+
"@types/node": "^24.19.2",
|
|
15
15
|
"@types/ramda": "^0.32.0",
|
|
16
16
|
"@types/react": "^19.3.0",
|
|
17
17
|
"@types/react-dom": "^19.3.0",
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
19
|
-
"@typescript-eslint/parser": "^8.
|
|
20
|
-
"@vitest/coverage-v8": "^
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.73.0",
|
|
20
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
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
|
-
"es-toolkit": "^1.
|
|
26
|
+
"es-toolkit": "^1.53.2",
|
|
27
27
|
"eslint": "^9.39.5",
|
|
28
28
|
"eslint-friendly-formatter": "^4.0.1",
|
|
29
29
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"fast-glob": "^3.3.3",
|
|
32
32
|
"lodash": "^4.18.1",
|
|
33
33
|
"nano-equal": "^2.0.2",
|
|
34
|
-
"prettier": "^3.
|
|
35
|
-
"react": "^19.3.
|
|
36
|
-
"react-dom": "^19.3.
|
|
37
|
-
"react-fast-compare": "^3.2.
|
|
38
|
-
"release-it": "^21.1.
|
|
39
|
-
"rollup": "^4.
|
|
34
|
+
"prettier": "^3.10.1",
|
|
35
|
+
"react": "^19.3.1",
|
|
36
|
+
"react-dom": "^19.3.1",
|
|
37
|
+
"react-fast-compare": "^3.2.4",
|
|
38
|
+
"release-it": "^21.1.3",
|
|
39
|
+
"rollup": "^4.68.8",
|
|
40
40
|
"shallow-equal-fuzzy": "^0.0.2",
|
|
41
|
-
"tinybench": "^6.2.
|
|
41
|
+
"tinybench": "^6.2.4",
|
|
42
42
|
"typescript": "^6.0.3",
|
|
43
|
-
"typescript-eslint": "^8.
|
|
43
|
+
"typescript-eslint": "^8.73.0",
|
|
44
44
|
"underscore": "^1.13.8",
|
|
45
|
-
"vite": "^8.3.
|
|
46
|
-
"vitest": "^
|
|
45
|
+
"vite": "^8.3.8",
|
|
46
|
+
"vitest": "^5.1.1"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=6.0.0"
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"main": "./dist/cjs/index.cjs",
|
|
80
80
|
"module": "./dist/es/index.mjs",
|
|
81
81
|
"name": "fast-equals",
|
|
82
|
+
"packageManager": "yarn@4.18.1",
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
|
84
85
|
},
|
|
@@ -110,5 +111,5 @@
|
|
|
110
111
|
"sideEffects": false,
|
|
111
112
|
"type": "module",
|
|
112
113
|
"types": "./index.d.ts",
|
|
113
|
-
"version": "6.4.
|
|
114
|
+
"version": "6.4.1"
|
|
114
115
|
}
|