fast-equals 5.0.0-beta.1 → 5.0.0-beta.3
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 +1 -1
- package/dist/cjs/index.cjs +170 -185
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/types/comparator.d.ts +8 -1
- package/dist/cjs/types/equals.d.ts +0 -13
- package/dist/cjs/types/index.d.ts +12 -21
- package/dist/cjs/types/internalTypes.d.ts +8 -0
- package/dist/cjs/types/utils.d.ts +10 -0
- package/dist/esm/index.mjs +170 -185
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types/comparator.d.ts +8 -1
- package/dist/esm/types/equals.d.ts +0 -13
- package/dist/esm/types/index.d.ts +12 -21
- package/dist/esm/types/internalTypes.d.ts +8 -0
- package/dist/esm/types/utils.d.ts +10 -0
- package/dist/min/index.js +1 -1
- package/dist/min/types/comparator.d.ts +8 -1
- package/dist/min/types/equals.d.ts +0 -13
- package/dist/min/types/index.d.ts +12 -21
- package/dist/min/types/internalTypes.d.ts +8 -0
- package/dist/min/types/utils.d.ts +10 -0
- package/dist/umd/index.js +170 -185
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/types/comparator.d.ts +8 -1
- package/dist/umd/types/equals.d.ts +0 -13
- package/dist/umd/types/index.d.ts +12 -21
- package/dist/umd/types/internalTypes.d.ts +8 -0
- package/dist/umd/types/utils.d.ts +10 -0
- package/index.d.ts +7 -18
- package/package.json +1 -1
- package/src/comparator.ts +63 -0
- package/src/equals.ts +0 -13
- package/src/index.ts +40 -126
- package/src/internalTypes.ts +11 -0
- package/src/utils.ts +10 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"/>
|
|
5
5
|
<img src="https://img.shields.io/badge/license-MIT-blue.svg"/>
|
|
6
6
|
|
|
7
|
-
Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed. It has no dependencies, and is ~1.
|
|
7
|
+
Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed. It has no dependencies, and is ~1.64kB when minified and gzipped.
|
|
8
8
|
|
|
9
9
|
Unlike most equality validation libraries, the following types are handled out-of-the-box:
|
|
10
10
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,112 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var ARGUMENTS_TAG = '[object Arguments]';
|
|
4
|
-
var BOOLEAN_TAG = '[object Boolean]';
|
|
5
|
-
var DATE_TAG = '[object Date]';
|
|
6
|
-
var MAP_TAG = '[object Map]';
|
|
7
|
-
var NUMBER_TAG = '[object Number]';
|
|
8
|
-
var OBJECT_TAG = '[object Object]';
|
|
9
|
-
var REG_EXP_TAG = '[object RegExp]';
|
|
10
|
-
var SET_TAG = '[object Set]';
|
|
11
|
-
var STRING_TAG = '[object String]';
|
|
12
|
-
var isArray = Array.isArray;
|
|
13
|
-
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
14
|
-
function createComparator(_a) {
|
|
15
|
-
var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areMapsEqual = _a.areMapsEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual;
|
|
16
|
-
/**
|
|
17
|
-
* compare the value of the two objects and return true if they are equivalent in values
|
|
18
|
-
*/
|
|
19
|
-
return function comparator(a, b, state) {
|
|
20
|
-
// If the items are strictly equal, no need to do a value comparison.
|
|
21
|
-
if (a === b) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
// If the items are not non-nullish objects, then the only possibility
|
|
25
|
-
// of them being equal but not strictly is if they are both `NaN`. Since
|
|
26
|
-
// `NaN` is uniquely not equal to itself, we can use self-comparison of
|
|
27
|
-
// both objects, which is faster than `isNaN()`.
|
|
28
|
-
if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
|
|
29
|
-
return a !== a && b !== b;
|
|
30
|
-
}
|
|
31
|
-
// Checks are listed in order of commonality of use-case:
|
|
32
|
-
// 1. Common complex object types (plain object, array)
|
|
33
|
-
// 2. Common data values (date, regexp)
|
|
34
|
-
// 3. Less-common complex object types (map, set)
|
|
35
|
-
// 4. Less-common data values (promise, primitive wrappers)
|
|
36
|
-
// Inherently this is both subjective and assumptive, however
|
|
37
|
-
// when reviewing comparable libraries in the wild this order
|
|
38
|
-
// appears to be generally consistent.
|
|
39
|
-
// `isPlainObject` only checks against the object's own realm. Cross-realm
|
|
40
|
-
// comparisons are rare, and will be handled in the ultimate fallback, so
|
|
41
|
-
// we can avoid the `toString.call()` cost unless necessary.
|
|
42
|
-
if (a.constructor === Object && b.constructor === Object) {
|
|
43
|
-
return areObjectsEqual(a, b, state);
|
|
44
|
-
}
|
|
45
|
-
// `isArray()` works on subclasses and is cross-realm, so we can again avoid
|
|
46
|
-
// the `toString.call()` cost unless necessary by just checking if either
|
|
47
|
-
// and then both are arrays.
|
|
48
|
-
var aArray = isArray(a);
|
|
49
|
-
var bArray = isArray(b);
|
|
50
|
-
if (aArray || bArray) {
|
|
51
|
-
return aArray === bArray && areArraysEqual(a, b, state);
|
|
52
|
-
}
|
|
53
|
-
// Since this is a custom object, use the classic `toString.call()` to get its
|
|
54
|
-
// type. This is reasonably performant in modern environments like v8 and
|
|
55
|
-
// SpiderMonkey, and allows for cross-realm comparison when other checks like
|
|
56
|
-
// `instanceof` do not.
|
|
57
|
-
var tag = getTag(a);
|
|
58
|
-
if (tag !== getTag(b)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (tag === DATE_TAG) {
|
|
62
|
-
return areDatesEqual(a, b, state);
|
|
63
|
-
}
|
|
64
|
-
if (tag === REG_EXP_TAG) {
|
|
65
|
-
return areRegExpsEqual(a, b, state);
|
|
66
|
-
}
|
|
67
|
-
if (tag === MAP_TAG) {
|
|
68
|
-
return areMapsEqual(a, b, state);
|
|
69
|
-
}
|
|
70
|
-
if (tag === SET_TAG) {
|
|
71
|
-
return areSetsEqual(a, b, state);
|
|
72
|
-
}
|
|
73
|
-
// If a simple object tag, then we can prioritize a simple object comparison because
|
|
74
|
-
// it is likely a custom class.
|
|
75
|
-
if (tag === OBJECT_TAG) {
|
|
76
|
-
// The exception for value comparison is `Promise`-like contracts. These should be
|
|
77
|
-
// treated the same as standard `Promise` objects, which means strict equality, and if
|
|
78
|
-
// it reaches this point then that strict equality comparison has already failed.
|
|
79
|
-
return (typeof a.then !== 'function' &&
|
|
80
|
-
typeof b.then !== 'function' &&
|
|
81
|
-
areObjectsEqual(a, b, state));
|
|
82
|
-
}
|
|
83
|
-
// If an arguments tag, it should be treated as a standard object.
|
|
84
|
-
if (tag === ARGUMENTS_TAG) {
|
|
85
|
-
return areObjectsEqual(a, b, state);
|
|
86
|
-
}
|
|
87
|
-
// As the penultimate fallback, check if the values passed are primitive wrappers. This
|
|
88
|
-
// is very rare in modern JS, which is why it is deprioritized compared to all other object
|
|
89
|
-
// types.
|
|
90
|
-
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
|
91
|
-
return arePrimitiveWrappersEqual(a, b, state);
|
|
92
|
-
}
|
|
93
|
-
// If not matching any tags that require a specific type of comparison, then we hard-code false because
|
|
94
|
-
// the only thing remaining is strict equality, which has already been compared. This is for a few reasons:
|
|
95
|
-
// - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
|
|
96
|
-
// comparison that can be made.
|
|
97
|
-
// - For types that can be introspected, but rarely have requirements to be compared
|
|
98
|
-
// (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common
|
|
99
|
-
// use-cases (may be included in a future release, if requested enough).
|
|
100
|
-
// - For types that can be introspected but do not have an objective definition of what
|
|
101
|
-
// equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
|
|
102
|
-
// In all cases, these decisions should be reevaluated based on changes to the language and
|
|
103
|
-
// common development practices.
|
|
104
|
-
return false;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
3
|
var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
109
4
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
5
|
+
/**
|
|
6
|
+
* Combine two comparators into a single comparators.
|
|
7
|
+
*/
|
|
110
8
|
function combineComparators(comparatorA, comparatorB) {
|
|
111
9
|
return function isEqual(a, b, state) {
|
|
112
10
|
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
@@ -145,9 +43,16 @@ function createIsCircular(areItemsEqual) {
|
|
|
145
43
|
return result;
|
|
146
44
|
};
|
|
147
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the properties to strictly examine, which include both own properties that are
|
|
48
|
+
* not enumerable and symbol properties.
|
|
49
|
+
*/
|
|
148
50
|
function getStrictProperties(object) {
|
|
149
51
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
150
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether the object contains the property passed as an own property.
|
|
55
|
+
*/
|
|
151
56
|
var hasOwn = Object.hasOwn ||
|
|
152
57
|
(function (object, property) {
|
|
153
58
|
return hasOwnProperty.call(object, property);
|
|
@@ -178,10 +83,6 @@ function areArraysEqual(a, b, state) {
|
|
|
178
83
|
}
|
|
179
84
|
/**
|
|
180
85
|
* Whether the dates passed are equal in value.
|
|
181
|
-
*
|
|
182
|
-
* @NOTE
|
|
183
|
-
* This is a standalone function instead of done inline in the comparator
|
|
184
|
-
* to allow for overrides.
|
|
185
86
|
*/
|
|
186
87
|
function areDatesEqual(a, b) {
|
|
187
88
|
return sameValueZeroEqual(a.getTime(), b.getTime());
|
|
@@ -293,21 +194,12 @@ function areObjectsEqualStrict(a, b, state) {
|
|
|
293
194
|
}
|
|
294
195
|
/**
|
|
295
196
|
* Whether the primitive wrappers passed are equal in value.
|
|
296
|
-
*
|
|
297
|
-
* @NOTE
|
|
298
|
-
* This is a standalone function instead of done inline in the comparator
|
|
299
|
-
* to allow for overrides.
|
|
300
197
|
*/
|
|
301
198
|
function arePrimitiveWrappersEqual(a, b) {
|
|
302
199
|
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
|
303
200
|
}
|
|
304
201
|
/**
|
|
305
202
|
* Whether the regexps passed are equal in value.
|
|
306
|
-
*
|
|
307
|
-
* @NOTE
|
|
308
|
-
* This is a standalone function instead of done inline in the comparator
|
|
309
|
-
* to allow for overrides. An example of this would be supporting a
|
|
310
|
-
* pre-ES2015 environment where the `flags` property is not available.
|
|
311
203
|
*/
|
|
312
204
|
function areRegExpsEqual(a, b) {
|
|
313
205
|
return a.source === b.source && a.flags === b.flags;
|
|
@@ -344,94 +236,191 @@ function areSetsEqual(a, b, state) {
|
|
|
344
236
|
return isValueEqual;
|
|
345
237
|
}
|
|
346
238
|
|
|
239
|
+
var ARGUMENTS_TAG = '[object Arguments]';
|
|
240
|
+
var BOOLEAN_TAG = '[object Boolean]';
|
|
241
|
+
var DATE_TAG = '[object Date]';
|
|
242
|
+
var MAP_TAG = '[object Map]';
|
|
243
|
+
var NUMBER_TAG = '[object Number]';
|
|
244
|
+
var OBJECT_TAG = '[object Object]';
|
|
245
|
+
var REG_EXP_TAG = '[object RegExp]';
|
|
246
|
+
var SET_TAG = '[object Set]';
|
|
247
|
+
var STRING_TAG = '[object String]';
|
|
248
|
+
var isArray = Array.isArray;
|
|
249
|
+
var assign = Object.assign;
|
|
250
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
251
|
+
/**
|
|
252
|
+
* Create a comparator method based on the type-specific equality comparators passed.
|
|
253
|
+
*/
|
|
254
|
+
function createComparator(_a) {
|
|
255
|
+
var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areMapsEqual = _a.areMapsEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual;
|
|
256
|
+
/**
|
|
257
|
+
* compare the value of the two objects and return true if they are equivalent in values
|
|
258
|
+
*/
|
|
259
|
+
return function comparator(a, b, state) {
|
|
260
|
+
// If the items are strictly equal, no need to do a value comparison.
|
|
261
|
+
if (a === b) {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
// If the items are not non-nullish objects, then the only possibility
|
|
265
|
+
// of them being equal but not strictly is if they are both `NaN`. Since
|
|
266
|
+
// `NaN` is uniquely not equal to itself, we can use self-comparison of
|
|
267
|
+
// both objects, which is faster than `isNaN()`.
|
|
268
|
+
if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
|
|
269
|
+
return a !== a && b !== b;
|
|
270
|
+
}
|
|
271
|
+
// Checks are listed in order of commonality of use-case:
|
|
272
|
+
// 1. Common complex object types (plain object, array)
|
|
273
|
+
// 2. Common data values (date, regexp)
|
|
274
|
+
// 3. Less-common complex object types (map, set)
|
|
275
|
+
// 4. Less-common data values (promise, primitive wrappers)
|
|
276
|
+
// Inherently this is both subjective and assumptive, however
|
|
277
|
+
// when reviewing comparable libraries in the wild this order
|
|
278
|
+
// appears to be generally consistent.
|
|
279
|
+
// `isPlainObject` only checks against the object's own realm. Cross-realm
|
|
280
|
+
// comparisons are rare, and will be handled in the ultimate fallback, so
|
|
281
|
+
// we can avoid the `toString.call()` cost unless necessary.
|
|
282
|
+
if (a.constructor === Object && b.constructor === Object) {
|
|
283
|
+
return areObjectsEqual(a, b, state);
|
|
284
|
+
}
|
|
285
|
+
// `isArray()` works on subclasses and is cross-realm, so we can again avoid
|
|
286
|
+
// the `toString.call()` cost unless necessary by just checking if either
|
|
287
|
+
// and then both are arrays.
|
|
288
|
+
var aArray = isArray(a);
|
|
289
|
+
var bArray = isArray(b);
|
|
290
|
+
if (aArray || bArray) {
|
|
291
|
+
return aArray === bArray && areArraysEqual(a, b, state);
|
|
292
|
+
}
|
|
293
|
+
// Since this is a custom object, use the classic `toString.call()` to get its
|
|
294
|
+
// type. This is reasonably performant in modern environments like v8 and
|
|
295
|
+
// SpiderMonkey, and allows for cross-realm comparison when other checks like
|
|
296
|
+
// `instanceof` do not.
|
|
297
|
+
var tag = getTag(a);
|
|
298
|
+
if (tag !== getTag(b)) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
if (tag === DATE_TAG) {
|
|
302
|
+
return areDatesEqual(a, b, state);
|
|
303
|
+
}
|
|
304
|
+
if (tag === REG_EXP_TAG) {
|
|
305
|
+
return areRegExpsEqual(a, b, state);
|
|
306
|
+
}
|
|
307
|
+
if (tag === MAP_TAG) {
|
|
308
|
+
return areMapsEqual(a, b, state);
|
|
309
|
+
}
|
|
310
|
+
if (tag === SET_TAG) {
|
|
311
|
+
return areSetsEqual(a, b, state);
|
|
312
|
+
}
|
|
313
|
+
// If a simple object tag, then we can prioritize a simple object comparison because
|
|
314
|
+
// it is likely a custom class.
|
|
315
|
+
if (tag === OBJECT_TAG) {
|
|
316
|
+
// The exception for value comparison is `Promise`-like contracts. These should be
|
|
317
|
+
// treated the same as standard `Promise` objects, which means strict equality, and if
|
|
318
|
+
// it reaches this point then that strict equality comparison has already failed.
|
|
319
|
+
return (typeof a.then !== 'function' &&
|
|
320
|
+
typeof b.then !== 'function' &&
|
|
321
|
+
areObjectsEqual(a, b, state));
|
|
322
|
+
}
|
|
323
|
+
// If an arguments tag, it should be treated as a standard object.
|
|
324
|
+
if (tag === ARGUMENTS_TAG) {
|
|
325
|
+
return areObjectsEqual(a, b, state);
|
|
326
|
+
}
|
|
327
|
+
// As the penultimate fallback, check if the values passed are primitive wrappers. This
|
|
328
|
+
// is very rare in modern JS, which is why it is deprioritized compared to all other object
|
|
329
|
+
// types.
|
|
330
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
|
331
|
+
return arePrimitiveWrappersEqual(a, b, state);
|
|
332
|
+
}
|
|
333
|
+
// If not matching any tags that require a specific type of comparison, then we hard-code false because
|
|
334
|
+
// the only thing remaining is strict equality, which has already been compared. This is for a few reasons:
|
|
335
|
+
// - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
|
|
336
|
+
// comparison that can be made.
|
|
337
|
+
// - For types that can be introspected, but rarely have requirements to be compared
|
|
338
|
+
// (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common
|
|
339
|
+
// use-cases (may be included in a future release, if requested enough).
|
|
340
|
+
// - For types that can be introspected but do not have an objective definition of what
|
|
341
|
+
// equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
|
|
342
|
+
// In all cases, these decisions should be reevaluated based on changes to the language and
|
|
343
|
+
// common development practices.
|
|
344
|
+
return false;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Create the configuration object used for building comparators.
|
|
349
|
+
*/
|
|
347
350
|
function createComparatorConfig(_a) {
|
|
348
|
-
var circular = _a.circular, strict = _a.strict;
|
|
351
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
|
349
352
|
var config = {
|
|
350
|
-
areArraysEqual:
|
|
353
|
+
areArraysEqual: strict
|
|
354
|
+
? areObjectsEqualStrict
|
|
355
|
+
: areArraysEqual,
|
|
351
356
|
areDatesEqual: areDatesEqual,
|
|
352
|
-
areMapsEqual:
|
|
353
|
-
|
|
357
|
+
areMapsEqual: strict
|
|
358
|
+
? combineComparators(areMapsEqual, areObjectsEqualStrict)
|
|
359
|
+
: areMapsEqual,
|
|
360
|
+
areObjectsEqual: strict
|
|
361
|
+
? areObjectsEqualStrict
|
|
362
|
+
: areObjectsEqual,
|
|
354
363
|
arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
|
|
355
364
|
areRegExpsEqual: areRegExpsEqual,
|
|
356
|
-
areSetsEqual:
|
|
365
|
+
areSetsEqual: strict
|
|
366
|
+
? combineComparators(areSetsEqual, areObjectsEqualStrict)
|
|
367
|
+
: areSetsEqual,
|
|
357
368
|
};
|
|
358
|
-
if (
|
|
359
|
-
config
|
|
360
|
-
config.areMapsEqual = combineComparators(areMapsEqual, areObjectsEqual);
|
|
361
|
-
config.areObjectsEqual = areObjectsEqualStrict;
|
|
362
|
-
config.areSetsEqual = combineComparators(areSetsEqual, areObjectsEqual);
|
|
369
|
+
if (createCustomConfig) {
|
|
370
|
+
config = assign({}, config, createCustomConfig(config));
|
|
363
371
|
}
|
|
364
372
|
if (circular) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
373
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
|
374
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
|
375
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
|
376
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
|
377
|
+
config = assign({}, config, {
|
|
378
|
+
areArraysEqual: areArraysEqual$1,
|
|
379
|
+
areMapsEqual: areMapsEqual$1,
|
|
380
|
+
areObjectsEqual: areObjectsEqual$1,
|
|
381
|
+
areSetsEqual: areSetsEqual$1,
|
|
382
|
+
});
|
|
369
383
|
}
|
|
370
384
|
return config;
|
|
371
385
|
}
|
|
372
|
-
|
|
373
|
-
if (options === void 0) { options = {}; }
|
|
374
|
-
var config = createComparatorConfig(options);
|
|
375
|
-
var isEqual = createComparator(config);
|
|
376
|
-
var isEqualComparator = options.comparator || createInternalComparator(isEqual);
|
|
377
|
-
var strict = !!options.strict;
|
|
378
|
-
if (options.circular) {
|
|
379
|
-
return function equals(a, b) {
|
|
380
|
-
return isEqual(a, b, {
|
|
381
|
-
cache: new WeakMap(),
|
|
382
|
-
equals: isEqualComparator,
|
|
383
|
-
meta: undefined,
|
|
384
|
-
strict: strict,
|
|
385
|
-
});
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
var state = Object.freeze({
|
|
389
|
-
cache: undefined,
|
|
390
|
-
equals: isEqualComparator,
|
|
391
|
-
meta: undefined,
|
|
392
|
-
strict: strict,
|
|
393
|
-
});
|
|
394
|
-
return function equals(a, b) {
|
|
395
|
-
return isEqual(a, b, state);
|
|
396
|
-
};
|
|
397
|
-
}
|
|
386
|
+
|
|
398
387
|
/**
|
|
399
388
|
* Whether the items passed are deeply-equal in value.
|
|
400
389
|
*/
|
|
401
|
-
var deepEqual =
|
|
390
|
+
var deepEqual = createCustomEqual();
|
|
402
391
|
/**
|
|
403
392
|
* Whether the items passed are deeply-equal in value based on strict comparison.
|
|
404
393
|
*/
|
|
405
|
-
var strictDeepEqual =
|
|
394
|
+
var strictDeepEqual = createCustomEqual({ strict: true });
|
|
406
395
|
/**
|
|
407
396
|
* Whether the items passed are deeply-equal in value, including circular references.
|
|
408
397
|
*/
|
|
409
|
-
var circularDeepEqual =
|
|
398
|
+
var circularDeepEqual = createCustomEqual({ circular: true });
|
|
410
399
|
/**
|
|
411
400
|
* Whether the items passed are deeply-equal in value, including circular references,
|
|
412
401
|
* based on strict comparison.
|
|
413
402
|
*/
|
|
414
|
-
var strictCircularDeepEqual =
|
|
403
|
+
var strictCircularDeepEqual = createCustomEqual({
|
|
415
404
|
circular: true,
|
|
416
405
|
strict: true,
|
|
417
406
|
});
|
|
418
407
|
/**
|
|
419
408
|
* Whether the items passed are shallowly-equal in value.
|
|
420
409
|
*/
|
|
421
|
-
var shallowEqual =
|
|
410
|
+
var shallowEqual = createCustomEqual({
|
|
422
411
|
comparator: sameValueZeroEqual,
|
|
423
412
|
});
|
|
424
413
|
/**
|
|
425
414
|
* Whether the items passed are shallowly-equal in value based on strict comparison
|
|
426
415
|
*/
|
|
427
|
-
var strictShallowEqual =
|
|
416
|
+
var strictShallowEqual = createCustomEqual({
|
|
428
417
|
comparator: sameValueZeroEqual,
|
|
429
418
|
strict: true,
|
|
430
419
|
});
|
|
431
420
|
/**
|
|
432
421
|
* Whether the items passed are shallowly-equal in value, including circular references.
|
|
433
422
|
*/
|
|
434
|
-
var circularShallowEqual =
|
|
423
|
+
var circularShallowEqual = createCustomEqual({
|
|
435
424
|
comparator: sameValueZeroEqual,
|
|
436
425
|
circular: true,
|
|
437
426
|
});
|
|
@@ -439,7 +428,7 @@ var circularShallowEqual = createDefaultEqualCreator({
|
|
|
439
428
|
* Whether the items passed are shallowly-equal in value, including circular references,
|
|
440
429
|
* based on strict comparison.
|
|
441
430
|
*/
|
|
442
|
-
var strictCircularShallowEqual =
|
|
431
|
+
var strictCircularShallowEqual = createCustomEqual({
|
|
443
432
|
comparator: sameValueZeroEqual,
|
|
444
433
|
circular: true,
|
|
445
434
|
strict: true,
|
|
@@ -454,35 +443,31 @@ var strictCircularShallowEqual = createDefaultEqualCreator({
|
|
|
454
443
|
*/
|
|
455
444
|
function createCustomEqual(options) {
|
|
456
445
|
if (options === void 0) { options = {}; }
|
|
457
|
-
var comparator = options.comparator, createCustomInternalComparator = options.createInternalComparator,
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
? createCustomInternalComparator(isEqualCustom)
|
|
465
|
-
: createInternalComparator(isEqualCustom);
|
|
466
|
-
var strict = !!options.strict;
|
|
446
|
+
var circular = options.circular, comparator = options.comparator, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _a = options.strict, baseStrict = _a === void 0 ? false : _a;
|
|
447
|
+
var config = createComparatorConfig(options);
|
|
448
|
+
var isEqualCustom = createComparator(config);
|
|
449
|
+
var isEqualCustomComparator = comparator ||
|
|
450
|
+
(createCustomInternalComparator
|
|
451
|
+
? createCustomInternalComparator(isEqualCustom)
|
|
452
|
+
: createInternalComparator(isEqualCustom));
|
|
467
453
|
if (createState) {
|
|
468
454
|
return function isEqual(a, b, metaOverride) {
|
|
469
|
-
var
|
|
455
|
+
var _a = createState(isEqualCustom), _b = _a.cache, cache = _b === void 0 ? circular ? new WeakMap() : undefined : _b, _c = _a.equals, equals = _c === void 0 ? isEqualCustomComparator : _c, meta = _a.meta, _d = _a.strict, strict = _d === void 0 ? baseStrict : _d;
|
|
470
456
|
return isEqualCustom(a, b, {
|
|
471
|
-
cache:
|
|
472
|
-
equals:
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
strict: customState.strict !== undefined ? customState.strict : strict,
|
|
457
|
+
cache: cache,
|
|
458
|
+
equals: equals,
|
|
459
|
+
meta: metaOverride !== undefined ? metaOverride : meta,
|
|
460
|
+
strict: strict,
|
|
476
461
|
});
|
|
477
462
|
};
|
|
478
463
|
}
|
|
479
|
-
if (
|
|
464
|
+
if (circular) {
|
|
480
465
|
return function equals(a, b) {
|
|
481
466
|
return isEqualCustom(a, b, {
|
|
482
467
|
cache: new WeakMap(),
|
|
483
468
|
equals: isEqualCustomComparator,
|
|
484
469
|
meta: undefined,
|
|
485
|
-
strict:
|
|
470
|
+
strict: baseStrict,
|
|
486
471
|
});
|
|
487
472
|
};
|
|
488
473
|
}
|
|
@@ -490,7 +475,7 @@ function createCustomEqual(options) {
|
|
|
490
475
|
cache: undefined,
|
|
491
476
|
equals: isEqualCustomComparator,
|
|
492
477
|
meta: undefined,
|
|
493
|
-
strict:
|
|
478
|
+
strict: baseStrict,
|
|
494
479
|
});
|
|
495
480
|
return function equals(a, b) {
|
|
496
481
|
return isEqualCustom(a, b, state);
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/comparator.ts","../../src/utils.ts","../../src/equals.ts","../../src/index.ts"],"sourcesContent":["import type {\n ComparatorConfig,\n EqualityComparator,\n State,\n} from './internalTypes';\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { isArray } = Array;\nconst getTag = Object.prototype.toString.call.bind(\n Object.prototype.toString,\n) as (a: object) => string;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n}: ComparatorConfig<Meta>): EqualityComparator<Meta> {\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a: any, b: any, state: State<Meta>): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (a.constructor === Object && b.constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = isArray(a);\n const bArray = isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, state);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const tag = getTag(a);\n\n if (tag !== getTag(b)) {\n return false;\n }\n\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class.\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return (\n typeof a.then !== 'function' &&\n typeof b.then !== 'function' &&\n areObjectsEqual(a, b, state)\n );\n }\n\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n","import {\n AnyEqualityComparator,\n BaseCircular,\n CircularState,\n Dictionary,\n EqualityComparator,\n InternalEqualityComparator,\n State,\n TypeEqualityComparator,\n} from './internalTypes';\n\nconst { getOwnPropertyNames, getOwnPropertySymbols } = Object;\nconst { hasOwnProperty } = Object.prototype;\n\nexport function combineComparators<Meta>(\n comparatorA: AnyEqualityComparator<Meta>,\n comparatorB: AnyEqualityComparator<Meta>,\n) {\n return function isEqual<A, B>(a: A, b: B, state: State<Meta>) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createInternalComparator<Meta>(\n compare: EqualityComparator<Meta>,\n): InternalEqualityComparator<Meta> {\n return function (\n a: any,\n b: any,\n _indexOrKeyA: any,\n _indexOrKeyB: any,\n _parentA: any,\n _parentB: any,\n state: State<Meta>,\n ) {\n return compare(a, b, state);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n state: CircularState<BaseCircular>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n\n const { cache } = state;\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, state);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\nexport function getStrictProperties(\n object: Dictionary,\n): Array<string | symbol> {\n return (getOwnPropertyNames(object) as Array<string | symbol>).concat(\n getOwnPropertySymbols(object),\n );\n}\n\nexport const hasOwn =\n Object.hasOwn ||\n ((object: Dictionary, property: number | string | symbol) =>\n hasOwnProperty.call(object, property));\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a || b ? a === b : a === b || (a !== a && b !== b);\n}\n","import { getStrictProperties, hasOwn, sameValueZeroEqual } from './utils';\nimport type { Dictionary, State } from './internalTypes';\n\nconst OWNER = '_owner';\n\nconst { getOwnPropertyDescriptor, keys } = Object;\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(a: any[], b: any[], state: State<any>) {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n state.equals(aKey, bKey, indexA, matchIndexB, a, b, state) &&\n state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = keys(a);\n\n let index = properties.length;\n\n if (keys(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (\n !hasOwn(b, property) ||\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nexport function areObjectsEqualStrict(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = getStrictProperties(a);\n\n let index = properties.length;\n\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n let descriptorA: ReturnType<typeof getOwnPropertyDescriptor>;\n let descriptorB: ReturnType<typeof getOwnPropertyDescriptor>;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (!hasOwn(b, property)) {\n return false;\n }\n\n if (\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n\n if (\n (descriptorA || descriptorB) &&\n (!descriptorA ||\n !descriptorB ||\n descriptorA.configurable !== descriptorB.configurable ||\n descriptorA.enumerable !== descriptorB.enumerable ||\n descriptorA.writable !== descriptorB.writable)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the primitive wrappers passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function arePrimitiveWrappersEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n\n/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n","import { createComparator } from './comparator';\nimport {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areObjectsEqualStrict,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n} from './equals';\nimport type {\n CircularState,\n ComparatorConfig,\n CreateCustomComparatorConfig,\n CreateState,\n DefaultState,\n EqualityComparator,\n} from './internalTypes';\nimport {\n combineComparators,\n createInternalComparator,\n createIsCircular,\n sameValueZeroEqual,\n} from './utils';\n\nexport { sameValueZeroEqual };\n\ninterface DefaultEqualCreatorOptions<Meta> {\n comparator?: EqualityComparator<Meta>;\n circular?: boolean;\n strict?: boolean;\n}\n\ninterface CustomEqualCreatorOptions<Meta>\n extends DefaultEqualCreatorOptions<Meta> {\n createCustomConfig?: CreateCustomComparatorConfig<Meta>;\n createInternalComparator?: typeof createInternalComparator;\n createState?: CreateState<Meta>;\n}\n\nfunction createComparatorConfig<Meta>({\n circular,\n strict,\n}: DefaultEqualCreatorOptions<Meta>) {\n const config: ComparatorConfig<Meta> = {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n };\n\n if (strict) {\n config.areArraysEqual = areObjectsEqual;\n config.areMapsEqual = combineComparators(areMapsEqual, areObjectsEqual);\n config.areObjectsEqual = areObjectsEqualStrict;\n config.areSetsEqual = combineComparators(areSetsEqual, areObjectsEqual);\n }\n\n if (circular) {\n config.areArraysEqual = createIsCircular(config.areArraysEqual);\n config.areMapsEqual = createIsCircular(config.areMapsEqual);\n config.areObjectsEqual = createIsCircular(config.areObjectsEqual);\n config.areSetsEqual = createIsCircular(config.areSetsEqual);\n }\n\n return config;\n}\n\nfunction createDefaultEqualCreator(\n options: DefaultEqualCreatorOptions<undefined> = {},\n) {\n const config = createComparatorConfig(options);\n const isEqual = createComparator(config);\n const isEqualComparator =\n options.comparator || createInternalComparator(isEqual);\n const strict = !!options.strict;\n\n if (options.circular) {\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqual(a, b, {\n cache: new WeakMap(),\n equals: isEqualComparator,\n meta: undefined,\n strict,\n });\n };\n }\n\n const state = Object.freeze({\n cache: undefined,\n equals: isEqualComparator,\n meta: undefined,\n strict,\n });\n\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqual(a, b, state);\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport const deepEqual = createDefaultEqualCreator();\n\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nexport const strictDeepEqual = createDefaultEqualCreator({ strict: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport const circularDeepEqual = createDefaultEqualCreator({ circular: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularDeepEqual = createDefaultEqualCreator({\n circular: true,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport const shallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nexport const strictShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport const circularShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n circular: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n circular: true,\n strict: true,\n});\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta>(\n options: CustomEqualCreatorOptions<Meta> = {},\n) {\n const {\n comparator,\n createInternalComparator: createCustomInternalComparator,\n createCustomConfig,\n createState,\n } = options;\n\n const baseConfig = createComparatorConfig(options);\n const config = createCustomConfig\n ? Object.assign({}, baseConfig, createCustomConfig(baseConfig))\n : baseConfig;\n const isEqualCustom = comparator || createComparator(config);\n const isEqualCustomComparator = createCustomInternalComparator\n ? createCustomInternalComparator(isEqualCustom)\n : createInternalComparator(isEqualCustom);\n const strict = !!options.strict;\n\n if (createState) {\n return function isEqual<A, B>(a: A, b: B, metaOverride?: Meta): boolean {\n const customState = createState(isEqualCustom);\n\n return isEqualCustom(a, b, {\n cache: customState.cache || new WeakMap(),\n equals: customState.equals || isEqualCustomComparator,\n // @ts-expect-error - inferred `Meta` may be undefined, which is okay\n meta: metaOverride !== undefined ? metaOverride : customState.meta,\n strict: customState.strict !== undefined ? customState.strict : strict,\n });\n };\n }\n\n if (options.circular) {\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, {\n cache: new WeakMap(),\n equals: isEqualCustomComparator,\n meta: undefined as Meta,\n strict,\n } as CircularState<Meta>);\n };\n }\n\n const state = Object.freeze({\n cache: undefined,\n equals: isEqualCustomComparator,\n meta: undefined,\n strict,\n });\n\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, state as DefaultState<Meta>);\n };\n}\n"],"names":[],"mappings":";;AAMA,IAAM,aAAa,GAAG,oBAAoB,CAAC;AAC3C,IAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,IAAM,QAAQ,GAAG,eAAe,CAAC;AACjC,IAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,IAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,IAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,IAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,IAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,IAAM,UAAU,GAAG,iBAAiB,CAAC;AAE7B,IAAA,OAAO,GAAK,KAAK,CAAA,OAAV,CAAW;AAC1B,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAChD,MAAM,CAAC,SAAS,CAAC,QAAQ,CACD,CAAC;AAErB,SAAU,gBAAgB,CAAO,EAQd,EAAA;AAPvB,IAAA,IAAA,cAAc,oBAAA,EACd,aAAa,mBAAA,EACb,YAAY,kBAAA,EACZ,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,yBAAyB,GAAA,EAAA,CAAA,yBAAA,EACzB,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,YAAY,GAAA,EAAA,CAAA,YAAA,CAAA;AAEZ;;AAEG;AACH,IAAA,OAAO,SAAS,UAAU,CA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AAC/B,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,MAAM,EAAA,MAAA;AACP,KAAA,CAAC,CAAC;AAEH,IAAA,OAAO,SAAS,MAAM,CAAO,CAAI,EAAE,CAAI,EAAA;QACrC,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAA2B,CAAC,CAAC;AAC1D,KAAC,CAAC;AACJ;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/utils.ts","../../src/equals.ts","../../src/comparator.ts","../../src/index.ts"],"sourcesContent":["import {\n AnyEqualityComparator,\n BaseCircular,\n CircularState,\n Dictionary,\n EqualityComparator,\n InternalEqualityComparator,\n State,\n TypeEqualityComparator,\n} from './internalTypes';\n\nconst { getOwnPropertyNames, getOwnPropertySymbols } = Object;\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * Combine two comparators into a single comparators.\n */\nexport function combineComparators<Meta>(\n comparatorA: AnyEqualityComparator<Meta>,\n comparatorB: AnyEqualityComparator<Meta>,\n) {\n return function isEqual<A, B>(a: A, b: B, state: State<Meta>) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createInternalComparator<Meta>(\n compare: EqualityComparator<Meta>,\n): InternalEqualityComparator<Meta> {\n return function (\n a: any,\n b: any,\n _indexOrKeyA: any,\n _indexOrKeyB: any,\n _parentA: any,\n _parentB: any,\n state: State<Meta>,\n ) {\n return compare(a, b, state);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n state: CircularState<BaseCircular>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n\n const { cache } = state;\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, state);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nexport function getStrictProperties(\n object: Dictionary,\n): Array<string | symbol> {\n return (getOwnPropertyNames(object) as Array<string | symbol>).concat(\n getOwnPropertySymbols(object),\n );\n}\n\n/**\n * Whether the object contains the property passed as an own property.\n */\nexport const hasOwn =\n Object.hasOwn ||\n ((object: Dictionary, property: number | string | symbol) =>\n hasOwnProperty.call(object, property));\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a || b ? a === b : a === b || (a !== a && b !== b);\n}\n","import { getStrictProperties, hasOwn, sameValueZeroEqual } from './utils';\nimport type { Dictionary, State } from './internalTypes';\n\nconst OWNER = '_owner';\n\nconst { getOwnPropertyDescriptor, keys } = Object;\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(a: any[], b: any[], state: State<any>) {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the dates passed are equal in value.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n state.equals(aKey, bKey, indexA, matchIndexB, a, b, state) &&\n state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = keys(a);\n\n let index = properties.length;\n\n if (keys(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (\n !hasOwn(b, property) ||\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nexport function areObjectsEqualStrict(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = getStrictProperties(a);\n\n let index = properties.length;\n\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n let descriptorA: ReturnType<typeof getOwnPropertyDescriptor>;\n let descriptorB: ReturnType<typeof getOwnPropertyDescriptor>;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (!hasOwn(b, property)) {\n return false;\n }\n\n if (\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n\n if (\n (descriptorA || descriptorB) &&\n (!descriptorA ||\n !descriptorB ||\n descriptorA.configurable !== descriptorB.configurable ||\n descriptorA.enumerable !== descriptorB.enumerable ||\n descriptorA.writable !== descriptorB.writable)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nexport function arePrimitiveWrappersEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n\n/**\n * Whether the regexps passed are equal in value.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n","import {\n areArraysEqual as areArraysEqualDefault,\n areDatesEqual as areDatesEqualDefault,\n areMapsEqual as areMapsEqualDefault,\n areObjectsEqual as areObjectsEqualDefault,\n areObjectsEqualStrict as areObjectsEqualStrictDefault,\n arePrimitiveWrappersEqual as arePrimitiveWrappersEqualDefault,\n areRegExpsEqual as areRegExpsEqualDefault,\n areSetsEqual as areSetsEqualDefault,\n} from './equals';\nimport { combineComparators, createIsCircular } from './utils';\nimport type {\n ComparatorConfig,\n CustomEqualCreatorOptions,\n EqualityComparator,\n State,\n} from './internalTypes';\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { isArray } = Array;\nconst { assign } = Object;\nconst getTag = Object.prototype.toString.call.bind(\n Object.prototype.toString,\n) as (a: object) => string;\n\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n}: ComparatorConfig<Meta>): EqualityComparator<Meta> {\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a: any, b: any, state: State<Meta>): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (a.constructor === Object && b.constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = isArray(a);\n const bArray = isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, state);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const tag = getTag(a);\n\n if (tag !== getTag(b)) {\n return false;\n }\n\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class.\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return (\n typeof a.then !== 'function' &&\n typeof b.then !== 'function' &&\n areObjectsEqual(a, b, state)\n );\n }\n\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n\n/**\n * Create the configuration object used for building comparators.\n */\nexport function createComparatorConfig<Meta>({\n circular,\n createCustomConfig,\n strict,\n}: CustomEqualCreatorOptions<Meta>): ComparatorConfig<Meta> {\n let config = {\n areArraysEqual: strict\n ? areObjectsEqualStrictDefault\n : areArraysEqualDefault,\n areDatesEqual: areDatesEqualDefault,\n areMapsEqual: strict\n ? combineComparators(areMapsEqualDefault, areObjectsEqualStrictDefault)\n : areMapsEqualDefault,\n areObjectsEqual: strict\n ? areObjectsEqualStrictDefault\n : areObjectsEqualDefault,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqualDefault,\n areRegExpsEqual: areRegExpsEqualDefault,\n areSetsEqual: strict\n ? combineComparators(areSetsEqualDefault, areObjectsEqualStrictDefault)\n : areSetsEqualDefault,\n };\n\n if (createCustomConfig) {\n config = assign({}, config, createCustomConfig(config));\n }\n\n if (circular) {\n const areArraysEqual = createIsCircular(config.areArraysEqual);\n const areMapsEqual = createIsCircular(config.areMapsEqual);\n const areObjectsEqual = createIsCircular(config.areObjectsEqual);\n const areSetsEqual = createIsCircular(config.areSetsEqual);\n\n config = assign({}, config, {\n areArraysEqual,\n areMapsEqual,\n areObjectsEqual,\n areSetsEqual,\n });\n }\n\n return config;\n}\n","import { createComparator, createComparatorConfig } from './comparator';\nimport type {\n CircularState,\n CustomEqualCreatorOptions,\n DefaultState,\n} from './internalTypes';\nimport { createInternalComparator, sameValueZeroEqual } from './utils';\n\nexport { sameValueZeroEqual };\nexport * from './internalTypes';\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport const deepEqual = createCustomEqual();\n\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nexport const strictDeepEqual = createCustomEqual({ strict: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport const circularDeepEqual = createCustomEqual({ circular: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport const shallowEqual = createCustomEqual({\n comparator: sameValueZeroEqual,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nexport const strictShallowEqual = createCustomEqual({\n comparator: sameValueZeroEqual,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport const circularShallowEqual = createCustomEqual({\n comparator: sameValueZeroEqual,\n circular: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularShallowEqual = createCustomEqual({\n comparator: sameValueZeroEqual,\n circular: true,\n strict: true,\n});\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta>(\n options: CustomEqualCreatorOptions<Meta> = {},\n) {\n const {\n circular,\n comparator,\n createInternalComparator: createCustomInternalComparator,\n createState,\n strict: baseStrict = false,\n } = options;\n\n const config = createComparatorConfig<Meta>(options);\n const isEqualCustom = createComparator(config);\n const isEqualCustomComparator =\n comparator ||\n (createCustomInternalComparator\n ? createCustomInternalComparator(isEqualCustom)\n : createInternalComparator(isEqualCustom));\n\n if (createState) {\n return function isEqual<A, B>(\n a: A,\n b: B,\n metaOverride?: Meta | undefined,\n ): boolean {\n const {\n cache = circular ? new WeakMap() : undefined,\n equals = isEqualCustomComparator,\n meta,\n strict = baseStrict,\n } = createState!(isEqualCustom);\n\n return isEqualCustom(a, b, {\n cache,\n equals,\n meta: metaOverride !== undefined ? metaOverride : meta,\n strict,\n } as CircularState<Meta>);\n };\n }\n\n if (circular) {\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, {\n cache: new WeakMap(),\n equals: isEqualCustomComparator,\n meta: undefined as Meta,\n strict: baseStrict,\n } as CircularState<Meta>);\n };\n }\n\n const state = Object.freeze({\n cache: undefined,\n equals: isEqualCustomComparator,\n meta: undefined,\n strict: baseStrict,\n });\n\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, state as DefaultState<Meta>);\n };\n}\n"],"names":["areObjectsEqualStrictDefault","areArraysEqualDefault","areDatesEqualDefault","areMapsEqualDefault","areObjectsEqualDefault","arePrimitiveWrappersEqualDefault","areRegExpsEqualDefault","areSetsEqualDefault","areArraysEqual","areMapsEqual","areObjectsEqual","areSetsEqual"],"mappings":";;AAWQ,IAAA,mBAAmB,GAA4B,MAAM,CAAA,mBAAlC,EAAE,qBAAqB,GAAK,MAAM,CAAA,qBAAX,CAAY;AACtD,IAAA,cAAc,GAAK,MAAM,CAAC,SAAS,eAArB,CAAsB;AAE5C;;AAEG;AACa,SAAA,kBAAkB,CAChC,WAAwC,EACxC,WAAwC,EAAA;AAExC,IAAA,OAAO,SAAS,OAAO,CAAO,CAAI,EAAE,CAAI,EAAE,KAAkB,EAAA;AAC1D,QAAA,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;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