fast-equals 6.0.3 → 6.0.4
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/dist/cjs/index.cjs +5 -1
- package/dist/es/index.mjs +5 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -416,7 +416,7 @@ function createEqualityComparator(config) {
|
|
|
416
416
|
// Checks are listed in order of commonality of use-case:
|
|
417
417
|
// 1. Common complex object types (plain object, array)
|
|
418
418
|
// 2. Common data values (date, regexp)
|
|
419
|
-
// 3. Less-common complex object types (map, set)
|
|
419
|
+
// 3. Less-common complex object types (map, set, null-prototype object)
|
|
420
420
|
// 4. Less-common data values (promise, primitive wrappers)
|
|
421
421
|
// Inherently this is both subjective and assumptive, however
|
|
422
422
|
// when reviewing comparable libraries in the wild this order
|
|
@@ -449,6 +449,10 @@ function createEqualityComparator(config) {
|
|
|
449
449
|
if (constructor === Set) {
|
|
450
450
|
return areSetsEqual(a, b, state);
|
|
451
451
|
}
|
|
452
|
+
if (constructor == null) {
|
|
453
|
+
// Objects with a prototype of `null` are plain objects.
|
|
454
|
+
return areObjectsEqual(a, b, state);
|
|
455
|
+
}
|
|
452
456
|
if (constructor === Promise) {
|
|
453
457
|
// Avoid tag checks for promise values, since we know if they are not referentially equal
|
|
454
458
|
// then they are not equal.
|
package/dist/es/index.mjs
CHANGED
|
@@ -414,7 +414,7 @@ function createEqualityComparator(config) {
|
|
|
414
414
|
// Checks are listed in order of commonality of use-case:
|
|
415
415
|
// 1. Common complex object types (plain object, array)
|
|
416
416
|
// 2. Common data values (date, regexp)
|
|
417
|
-
// 3. Less-common complex object types (map, set)
|
|
417
|
+
// 3. Less-common complex object types (map, set, null-prototype object)
|
|
418
418
|
// 4. Less-common data values (promise, primitive wrappers)
|
|
419
419
|
// Inherently this is both subjective and assumptive, however
|
|
420
420
|
// when reviewing comparable libraries in the wild this order
|
|
@@ -447,6 +447,10 @@ function createEqualityComparator(config) {
|
|
|
447
447
|
if (constructor === Set) {
|
|
448
448
|
return areSetsEqual(a, b, state);
|
|
449
449
|
}
|
|
450
|
+
if (constructor == null) {
|
|
451
|
+
// Objects with a prototype of `null` are plain objects.
|
|
452
|
+
return areObjectsEqual(a, b, state);
|
|
453
|
+
}
|
|
450
454
|
if (constructor === Promise) {
|
|
451
455
|
// Avoid tag checks for promise values, since we know if they are not referentially equal
|
|
452
456
|
// then they are not equal.
|
package/package.json
CHANGED