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 CHANGED
@@ -460,74 +460,74 @@ Testing mixed objects equal...
460
460
  ┌────────────────────────────────────────┬────────────────┐
461
461
  │ Name │ Ops / sec │
462
462
  ├────────────────────────────────────────┼────────────────┤
463
- │ fast-equals (passed) │ 1731598.023836 │
463
+ │ fast-equals (passed) │ 1782450.451369 │
464
464
  ├────────────────────────────────────────┼────────────────┤
465
- │ fast-deep-equal (passed) │ 1309307.899547 │
465
+ │ fast-deep-equal (passed) │ 1318966.05525 │
466
466
  ├────────────────────────────────────────┼────────────────┤
467
- │ react-fast-compare (passed) │ 1292046.683991 │
467
+ │ react-fast-compare (passed) │ 1312506.681929 │
468
468
  ├────────────────────────────────────────┼────────────────┤
469
- │ shallow-equal-fuzzy (passed) │ 1226265.458405 │
469
+ │ shallow-equal-fuzzy (passed) │ 1278565.812104 │
470
470
  ├────────────────────────────────────────┼────────────────┤
471
- │ nano-equal (failed) │ 963157.128972 │
471
+ │ nano-equal (failed) │ 983769.888387 │
472
472
  ├────────────────────────────────────────┼────────────────┤
473
- │ fast-equals (circular) (passed) │ 909479.445346 │
473
+ │ fast-equals (circular) (passed) │ 907118.190745 │
474
474
  ├────────────────────────────────────────┼────────────────┤
475
- │ dequal/lite (passed) │ 778122.31992 │
475
+ │ dequal/lite (passed) │ 783946.658853 │
476
476
  ├────────────────────────────────────────┼────────────────┤
477
- │ dequal (passed) │ 760245.363659 │
477
+ │ dequal (passed) │ 765217.048928 │
478
478
  ├────────────────────────────────────────┼────────────────┤
479
- │ underscore.isEqual (passed) │ 445304.799867 │
479
+ │ underscore.isEqual (passed) │ 461845.668653 │
480
480
  ├────────────────────────────────────────┼────────────────┤
481
- │ assert.deepStrictEqual (passed) │ 438737.156408 │
481
+ │ assert.deepStrictEqual (passed) │ 440373.095029 │
482
482
  ├────────────────────────────────────────┼────────────────┤
483
- │ es-toolkit (passed) │ 382792.590707 │
483
+ │ es-toolkit (passed) │ 391305.456936 │
484
484
  ├────────────────────────────────────────┼────────────────┤
485
- │ lodash.isEqual (passed) │ 290229.549964 │
485
+ │ lodash.isEqual (passed) │ 290278.80479 │
486
486
  ├────────────────────────────────────────┼────────────────┤
487
- │ fast-equals (strict) (passed) │ 279185.538603 │
487
+ │ fast-equals (strict) (passed) │ 290096.328199 │
488
488
  ├────────────────────────────────────────┼────────────────┤
489
- │ fast-equals (strict circular) (passed) │ 238470.634046 │
489
+ │ fast-equals (strict circular) (passed) │ 246541.923525 │
490
490
  ├────────────────────────────────────────┼────────────────┤
491
- │ deep-eql (passed) │ 172670.983717 │
491
+ │ deep-eql (passed) │ 173208.792462 │
492
492
  ├────────────────────────────────────────┼────────────────┤
493
- │ deep-equal (passed) │ 1357.008406 │
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) │ 5076106.125712 │
500
+ │ fast-equals (passed) │ 5488976.412437 │
501
501
  ├────────────────────────────────────────┼────────────────┤
502
- │ fast-equals (circular) (passed) │ 3544911.437592 │
502
+ │ fast-equals (circular) (passed) │ 3668925.717479 │
503
503
  ├────────────────────────────────────────┼────────────────┤
504
- │ fast-deep-equal (passed) │ 3433830.73191 │
504
+ │ fast-deep-equal (passed) │ 3552737.084766 │
505
505
  ├────────────────────────────────────────┼────────────────┤
506
- │ react-fast-compare (passed) │ 3246695.251508 │
506
+ │ react-fast-compare (passed) │ 3441428.035043 │
507
507
  ├────────────────────────────────────────┼────────────────┤
508
- │ fast-equals (strict) (passed) │ 1584702.069444 │
508
+ │ fast-equals (strict) (passed) │ 1668916.622434 │
509
509
  ├────────────────────────────────────────┼────────────────┤
510
- │ dequal/lite (passed) │ 1393178.232807 │
510
+ │ dequal/lite (passed) │ 1446091.459485 │
511
511
  ├────────────────────────────────────────┼────────────────┤
512
- │ dequal (passed) │ 1370661.947753 │
512
+ │ fast-equals (strict circular) (passed) │ 1410439.853116 │
513
513
  ├────────────────────────────────────────┼────────────────┤
514
- │ fast-equals (strict circular) (passed) │ 1336500.602356 │
514
+ │ dequal (passed) │ 1395740.020934 │
515
515
  ├────────────────────────────────────────┼────────────────┤
516
- │ shallow-equal-fuzzy (failed) │ 1219389.24268 │
516
+ │ shallow-equal-fuzzy (failed) │ 1285610.296881 │
517
517
  ├────────────────────────────────────────┼────────────────┤
518
- │ nano-equal (passed) │ 1088061.461684 │
518
+ │ nano-equal (passed) │ 1130229.996399 │
519
519
  ├────────────────────────────────────────┼────────────────┤
520
- │ underscore.isEqual (passed) │ 661655.436986 │
520
+ │ underscore.isEqual (passed) │ 682455.329594 │
521
521
  ├────────────────────────────────────────┼────────────────┤
522
- │ es-toolkit (passed) │ 401295.827671 │
522
+ │ es-toolkit (passed) │ 417584.470986 │
523
523
  ├────────────────────────────────────────┼────────────────┤
524
- │ lodash.isEqual (passed) │ 377347.276362 │
524
+ │ lodash.isEqual (passed) │ 385904.998549 │
525
525
  ├────────────────────────────────────────┼────────────────┤
526
- │ deep-eql (passed) │ 199704.751472 │
526
+ │ deep-eql (passed) │ 202212.291682 │
527
527
  ├────────────────────────────────────────┼────────────────┤
528
- │ assert.deepStrictEqual (passed) │ 25504.609914 │
528
+ │ assert.deepStrictEqual (passed) │ 25540.74079 │
529
529
  ├────────────────────────────────────────┼────────────────┤
530
- │ deep-equal (passed) │ 5996.790087 │
530
+ │ deep-equal (passed) │ 5867.29696 │
531
531
  └────────────────────────────────────────┴────────────────┘
532
532
  ```
533
533
 
@@ -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) === OBJECT_TAG;
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) === OBJECT_TAG;
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 tag = toString.call(a);
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 supportedComparator = supportedComparatorMap[toString.call(a)];
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 `toString()` values to their respective handlers for `tag`-based lookups.
841
- */
842
- function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlSearchParamsEqual, areUrlsEqual, }) {
843
- return {
844
- '[object Arguments]': areObjectsEqual,
845
- '[object Array]': areArraysEqual,
846
- '[object ArrayBuffer]': areArrayBuffersEqual,
847
- '[object AsyncGeneratorFunction]': areFunctionsEqual,
848
- '[object BigInt]': arePrimitiveWrappersEqual,
849
- '[object BigInt64Array]': areTypedArraysEqual,
850
- '[object BigUint64Array]': areTypedArraysEqual,
851
- '[object Boolean]': arePrimitiveWrappersEqual,
852
- '[object DataView]': areDataViewsEqual,
853
- '[object Date]': areDatesEqual,
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
- '[object Error]': areErrorsEqual,
857
- '[object Float16Array]': areTypedArraysEqual,
858
- '[object Float32Array]': areTypedArraysEqual,
859
- '[object Float64Array]': areTypedArraysEqual,
860
- '[object Function]': areFunctionsEqual,
861
- '[object GeneratorFunction]': areFunctionsEqual,
862
- '[object Int8Array]': areTypedArraysEqual,
863
- '[object Int16Array]': areTypedArraysEqual,
864
- '[object Int32Array]': areTypedArraysEqual,
865
- '[object Map]': areMapsEqual,
866
- '[object Number]': arePrimitiveWrappersEqual,
867
- '[object Object]': (a, b, state) =>
868
- // The exception for value comparison is custom `Promise`-like class instances. These should
869
- // be treated the same as standard `Promise` objects, which means strict equality, and if
870
- // it reaches this point then that strict equality comparison has already failed.
871
- typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state),
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
- '[object RegExp]': areRegExpsEqual,
875
- '[object Set]': areSetsEqual,
876
- '[object String]': arePrimitiveWrappersEqual,
877
- '[object URL]': areUrlsEqual,
878
- '[object URLSearchParams]': areUrlSearchParamsEqual,
879
- '[object Uint8Array]': areTypedArraysEqual,
880
- '[object Uint8ClampedArray]': areTypedArraysEqual,
881
- '[object Uint16Array]': areTypedArraysEqual,
882
- '[object Uint32Array]': areTypedArraysEqual,
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) === OBJECT_TAG;
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) === OBJECT_TAG;
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 tag = toString.call(a);
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 supportedComparator = supportedComparatorMap[toString.call(a)];
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 `toString()` values to their respective handlers for `tag`-based lookups.
839
- */
840
- function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlSearchParamsEqual, areUrlsEqual, }) {
841
- return {
842
- '[object Arguments]': areObjectsEqual,
843
- '[object Array]': areArraysEqual,
844
- '[object ArrayBuffer]': areArrayBuffersEqual,
845
- '[object AsyncGeneratorFunction]': areFunctionsEqual,
846
- '[object BigInt]': arePrimitiveWrappersEqual,
847
- '[object BigInt64Array]': areTypedArraysEqual,
848
- '[object BigUint64Array]': areTypedArraysEqual,
849
- '[object Boolean]': arePrimitiveWrappersEqual,
850
- '[object DataView]': areDataViewsEqual,
851
- '[object Date]': areDatesEqual,
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
- '[object Error]': areErrorsEqual,
855
- '[object Float16Array]': areTypedArraysEqual,
856
- '[object Float32Array]': areTypedArraysEqual,
857
- '[object Float64Array]': areTypedArraysEqual,
858
- '[object Function]': areFunctionsEqual,
859
- '[object GeneratorFunction]': areFunctionsEqual,
860
- '[object Int8Array]': areTypedArraysEqual,
861
- '[object Int16Array]': areTypedArraysEqual,
862
- '[object Int32Array]': areTypedArraysEqual,
863
- '[object Map]': areMapsEqual,
864
- '[object Number]': arePrimitiveWrappersEqual,
865
- '[object Object]': (a, b, state) =>
866
- // The exception for value comparison is custom `Promise`-like class instances. These should
867
- // be treated the same as standard `Promise` objects, which means strict equality, and if
868
- // it reaches this point then that strict equality comparison has already failed.
869
- typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state),
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
- '[object RegExp]': areRegExpsEqual,
873
- '[object Set]': areSetsEqual,
874
- '[object String]': arePrimitiveWrappersEqual,
875
- '[object URL]': areUrlsEqual,
876
- '[object URLSearchParams]': areUrlSearchParamsEqual,
877
- '[object Uint8Array]': areTypedArraysEqual,
878
- '[object Uint8ClampedArray]': areTypedArraysEqual,
879
- '[object Uint16Array]': areTypedArraysEqual,
880
- '[object Uint32Array]': areTypedArraysEqual,
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.25",
14
- "@types/node": "^24.19.1",
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.71.1",
19
- "@typescript-eslint/parser": "^8.71.1",
20
- "@vitest/coverage-v8": "^4.1.11",
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.52.0",
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.9.9",
35
- "react": "^19.3.0",
36
- "react-dom": "^19.3.0",
37
- "react-fast-compare": "^3.2.2",
38
- "release-it": "^21.1.1",
39
- "rollup": "^4.64.3",
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.1",
41
+ "tinybench": "^6.2.4",
42
42
  "typescript": "^6.0.3",
43
- "typescript-eslint": "^8.71.1",
43
+ "typescript-eslint": "^8.73.0",
44
44
  "underscore": "^1.13.8",
45
- "vite": "^8.3.4",
46
- "vitest": "^4.1.11"
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.0"
114
+ "version": "6.4.1"
114
115
  }