fast-equals 4.0.3 → 5.0.0-beta.0

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.
Files changed (71) hide show
  1. package/.babelrc +34 -0
  2. package/.prettierrc +4 -0
  3. package/CHANGELOG.md +39 -0
  4. package/README.md +145 -39
  5. package/build/rollup/config.base.js +49 -0
  6. package/build/rollup/config.cjs.js +10 -0
  7. package/build/rollup/config.esm.js +10 -0
  8. package/build/rollup/config.min.js +13 -0
  9. package/build/rollup/config.umd.js +10 -0
  10. package/build/tsconfig/base.json +32 -0
  11. package/build/tsconfig/cjs.json +8 -0
  12. package/build/tsconfig/declarations.json +9 -0
  13. package/build/tsconfig/esm.json +8 -0
  14. package/build/tsconfig/min.json +8 -0
  15. package/build/tsconfig/umd.json +8 -0
  16. package/build/webpack.config.js +57 -0
  17. package/dist/cjs/index.cjs +510 -0
  18. package/dist/cjs/index.cjs.map +1 -0
  19. package/dist/cjs/types/comparator.d.ts +2 -0
  20. package/dist/cjs/types/equals.d.ts +46 -0
  21. package/dist/cjs/types/index.d.ts +56 -0
  22. package/dist/cjs/types/internalTypes.d.ts +36 -0
  23. package/dist/cjs/types/utils.d.ts +19 -0
  24. package/dist/esm/index.mjs +499 -0
  25. package/dist/esm/index.mjs.map +1 -0
  26. package/dist/esm/types/comparator.d.ts +2 -0
  27. package/dist/esm/types/equals.d.ts +46 -0
  28. package/dist/esm/types/index.d.ts +56 -0
  29. package/dist/esm/types/internalTypes.d.ts +36 -0
  30. package/dist/esm/types/utils.d.ts +19 -0
  31. package/dist/min/index.js +1 -0
  32. package/dist/min/types/comparator.d.ts +2 -0
  33. package/dist/min/types/equals.d.ts +46 -0
  34. package/dist/min/types/index.d.ts +56 -0
  35. package/dist/min/types/internalTypes.d.ts +36 -0
  36. package/dist/min/types/utils.d.ts +19 -0
  37. package/dist/umd/index.js +516 -0
  38. package/dist/umd/index.js.map +1 -0
  39. package/dist/umd/types/comparator.d.ts +2 -0
  40. package/dist/umd/types/equals.d.ts +46 -0
  41. package/dist/umd/types/index.d.ts +56 -0
  42. package/dist/umd/types/internalTypes.d.ts +36 -0
  43. package/dist/umd/types/utils.d.ts +19 -0
  44. package/package.json +58 -37
  45. package/recipes/explicit-property-check.md +4 -6
  46. package/recipes/legacy-circular-equal-support.md +28 -20
  47. package/recipes/legacy-regexp-support.md +15 -16
  48. package/recipes/non-standard-properties.md +35 -23
  49. package/recipes/using-meta-in-comparison.md +10 -13
  50. package/src/comparator.ts +43 -40
  51. package/src/equals.ts +263 -0
  52. package/src/index.ts +183 -79
  53. package/src/internalTypes.ts +74 -0
  54. package/src/utils.ts +42 -49
  55. package/dist/fast-equals.cjs.js +0 -432
  56. package/dist/fast-equals.cjs.js.map +0 -1
  57. package/dist/fast-equals.esm.js +0 -422
  58. package/dist/fast-equals.esm.js.map +0 -1
  59. package/dist/fast-equals.js +0 -438
  60. package/dist/fast-equals.js.map +0 -1
  61. package/dist/fast-equals.min.js +0 -1
  62. package/dist/fast-equals.mjs +0 -422
  63. package/dist/fast-equals.mjs.map +0 -1
  64. package/index.d.ts +0 -58
  65. package/recipes/strict-property-descriptor-check.md +0 -42
  66. package/src/arrays.ts +0 -36
  67. package/src/dates.ts +0 -12
  68. package/src/maps.ts +0 -66
  69. package/src/objects.ts +0 -62
  70. package/src/regexps.ts +0 -11
  71. package/src/sets.ts +0 -61
@@ -0,0 +1,510 @@
1
+ 'use strict';
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
+ var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
109
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
110
+ function combineComparators(comparatorA, comparatorB) {
111
+ return function isEqual(a, b, state) {
112
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
113
+ };
114
+ }
115
+ /**
116
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
117
+ * use inside the built comparator.
118
+ */
119
+ function createInternalComparator(compare) {
120
+ return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
121
+ return compare(a, b, state);
122
+ };
123
+ }
124
+ /**
125
+ * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
126
+ * for circular references to be safely included in the comparison without creating
127
+ * stack overflows.
128
+ */
129
+ function createIsCircular(areItemsEqual) {
130
+ return function isCircular(a, b, state) {
131
+ if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
132
+ return areItemsEqual(a, b, state);
133
+ }
134
+ var cache = state.cache;
135
+ var cachedA = cache.get(a);
136
+ var cachedB = cache.get(b);
137
+ if (cachedA && cachedB) {
138
+ return cachedA === b && cachedB === a;
139
+ }
140
+ cache.set(a, b);
141
+ cache.set(b, a);
142
+ var result = areItemsEqual(a, b, state);
143
+ cache.delete(a);
144
+ cache.delete(b);
145
+ return result;
146
+ };
147
+ }
148
+ function getStrictProperties(object) {
149
+ return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
150
+ }
151
+ var hasOwn = Object.hasOwn ||
152
+ (function (object, property) {
153
+ return hasOwnProperty.call(object, property);
154
+ });
155
+ /**
156
+ * Whether the values passed are strictly equal or both NaN.
157
+ */
158
+ function sameValueZeroEqual(a, b) {
159
+ return a || b ? a === b : a === b || (a !== a && b !== b);
160
+ }
161
+
162
+ var OWNER = '_owner';
163
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;
164
+ /**
165
+ * Whether the arrays are equal in value.
166
+ */
167
+ function areArraysEqual(a, b, state) {
168
+ var index = a.length;
169
+ if (b.length !== index) {
170
+ return false;
171
+ }
172
+ while (index-- > 0) {
173
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
174
+ return false;
175
+ }
176
+ }
177
+ return true;
178
+ }
179
+ /**
180
+ * 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
+ */
186
+ function areDatesEqual(a, b) {
187
+ return sameValueZeroEqual(a.getTime(), b.getTime());
188
+ }
189
+ /**
190
+ * Whether the `Map`s are equal in value.
191
+ */
192
+ function areMapsEqual(a, b, state) {
193
+ var isValueEqual = a.size === b.size;
194
+ if (isValueEqual && a.size) {
195
+ // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and
196
+ // the inability to control the performance of the resulting code. It also avoids excessive
197
+ // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,
198
+ // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the
199
+ // equality checks themselves.
200
+ var matchedIndices_1 = {};
201
+ var indexA_1 = 0;
202
+ a.forEach(function (aValue, aKey) {
203
+ if (!isValueEqual) {
204
+ return;
205
+ }
206
+ var hasMatch = false;
207
+ var matchIndexB = 0;
208
+ b.forEach(function (bValue, bKey) {
209
+ if (!hasMatch &&
210
+ !matchedIndices_1[matchIndexB] &&
211
+ (hasMatch =
212
+ state.equals(aKey, bKey, indexA_1, matchIndexB, a, b, state) &&
213
+ state.equals(aValue, bValue, aKey, bKey, a, b, state))) {
214
+ matchedIndices_1[matchIndexB] = true;
215
+ }
216
+ matchIndexB++;
217
+ });
218
+ indexA_1++;
219
+ isValueEqual = hasMatch;
220
+ });
221
+ }
222
+ return isValueEqual;
223
+ }
224
+ /**
225
+ * Whether the objects are equal in value.
226
+ */
227
+ function areObjectsEqual(a, b, state) {
228
+ var properties = keys(a);
229
+ var index = properties.length;
230
+ if (keys(b).length !== index) {
231
+ return false;
232
+ }
233
+ var property;
234
+ // Decrementing `while` showed faster results than either incrementing or
235
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
236
+ // methods like `some` / `every` were not used to avoid incurring the garbage
237
+ // cost of anonymous callbacks.
238
+ while (index-- > 0) {
239
+ property = properties[index];
240
+ if (property === OWNER &&
241
+ (a.$$typeof || b.$$typeof) &&
242
+ a.$$typeof !== b.$$typeof) {
243
+ return false;
244
+ }
245
+ if (!hasOwn(b, property) ||
246
+ !state.equals(a[property], b[property], property, property, a, b, state)) {
247
+ return false;
248
+ }
249
+ }
250
+ return true;
251
+ }
252
+ /**
253
+ * Whether the objects are equal in value with strict property checking.
254
+ */
255
+ function areObjectsEqualStrict(a, b, state) {
256
+ var properties = getStrictProperties(a);
257
+ var index = properties.length;
258
+ if (getStrictProperties(b).length !== index) {
259
+ return false;
260
+ }
261
+ var property;
262
+ var descriptorA;
263
+ var descriptorB;
264
+ // Decrementing `while` showed faster results than either incrementing or
265
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
266
+ // methods like `some` / `every` were not used to avoid incurring the garbage
267
+ // cost of anonymous callbacks.
268
+ while (index-- > 0) {
269
+ property = properties[index];
270
+ if (property === OWNER &&
271
+ (a.$$typeof || b.$$typeof) &&
272
+ a.$$typeof !== b.$$typeof) {
273
+ return false;
274
+ }
275
+ if (!hasOwn(b, property)) {
276
+ return false;
277
+ }
278
+ if (!state.equals(a[property], b[property], property, property, a, b, state)) {
279
+ return false;
280
+ }
281
+ descriptorA = getOwnPropertyDescriptor(a, property);
282
+ descriptorB = getOwnPropertyDescriptor(b, property);
283
+ if ((descriptorA || descriptorB) &&
284
+ (!descriptorA ||
285
+ !descriptorB ||
286
+ descriptorA.configurable !== descriptorB.configurable ||
287
+ descriptorA.enumerable !== descriptorB.enumerable ||
288
+ descriptorA.writable !== descriptorB.writable)) {
289
+ return false;
290
+ }
291
+ }
292
+ return true;
293
+ }
294
+ /**
295
+ * 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
+ */
301
+ function arePrimitiveWrappersEqual(a, b) {
302
+ return sameValueZeroEqual(a.valueOf(), b.valueOf());
303
+ }
304
+ /**
305
+ * 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
+ */
312
+ function areRegExpsEqual(a, b) {
313
+ return a.source === b.source && a.flags === b.flags;
314
+ }
315
+ /**
316
+ * Whether the `Set`s are equal in value.
317
+ */
318
+ function areSetsEqual(a, b, state) {
319
+ var isValueEqual = a.size === b.size;
320
+ if (isValueEqual && a.size) {
321
+ // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and
322
+ // the inability to control the performance of the resulting code. It also avoids excessive
323
+ // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,
324
+ // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the
325
+ // equality checks themselves.
326
+ var matchedIndices_2 = {};
327
+ a.forEach(function (aValue, aKey) {
328
+ if (!isValueEqual) {
329
+ return;
330
+ }
331
+ var hasMatch = false;
332
+ var matchIndex = 0;
333
+ b.forEach(function (bValue, bKey) {
334
+ if (!hasMatch &&
335
+ !matchedIndices_2[matchIndex] &&
336
+ (hasMatch = state.equals(aValue, bValue, aKey, bKey, a, b, state))) {
337
+ matchedIndices_2[matchIndex] = true;
338
+ }
339
+ matchIndex++;
340
+ });
341
+ isValueEqual = hasMatch;
342
+ });
343
+ }
344
+ return isValueEqual;
345
+ }
346
+
347
+ function createComparatorConfig(_a) {
348
+ var circular = _a.circular, strict = _a.strict;
349
+ var config = {
350
+ areArraysEqual: areArraysEqual,
351
+ areDatesEqual: areDatesEqual,
352
+ areMapsEqual: areMapsEqual,
353
+ areObjectsEqual: areObjectsEqual,
354
+ arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
355
+ areRegExpsEqual: areRegExpsEqual,
356
+ areSetsEqual: areSetsEqual,
357
+ };
358
+ if (strict) {
359
+ config.areArraysEqual = areObjectsEqual;
360
+ config.areMapsEqual = combineComparators(areMapsEqual, areObjectsEqual);
361
+ config.areObjectsEqual = areObjectsEqualStrict;
362
+ config.areSetsEqual = combineComparators(areSetsEqual, areObjectsEqual);
363
+ }
364
+ if (circular) {
365
+ config.areArraysEqual = createIsCircular(config.areArraysEqual);
366
+ config.areMapsEqual = createIsCircular(config.areMapsEqual);
367
+ config.areObjectsEqual = createIsCircular(config.areObjectsEqual);
368
+ config.areSetsEqual = createIsCircular(config.areSetsEqual);
369
+ }
370
+ return config;
371
+ }
372
+ function createDefaultEqualCreator(options) {
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
+ }
398
+ /**
399
+ * Whether the items passed are deeply-equal in value.
400
+ */
401
+ var deepEqual = createDefaultEqualCreator();
402
+ /**
403
+ * Whether the items passed are deeply-equal in value based on strict comparison.
404
+ */
405
+ var strictDeepEqual = createDefaultEqualCreator({ strict: true });
406
+ /**
407
+ * Whether the items passed are deeply-equal in value, including circular references.
408
+ */
409
+ var circularDeepEqual = createDefaultEqualCreator({ circular: true });
410
+ /**
411
+ * Whether the items passed are deeply-equal in value, including circular references,
412
+ * based on strict comparison.
413
+ */
414
+ var strictCircularDeepEqual = createDefaultEqualCreator({
415
+ circular: true,
416
+ strict: true,
417
+ });
418
+ /**
419
+ * Whether the items passed are shallowly-equal in value.
420
+ */
421
+ var shallowEqual = createDefaultEqualCreator({
422
+ comparator: sameValueZeroEqual,
423
+ });
424
+ /**
425
+ * Whether the items passed are shallowly-equal in value based on strict comparison
426
+ */
427
+ var strictShallowEqual = createDefaultEqualCreator({
428
+ comparator: sameValueZeroEqual,
429
+ strict: true,
430
+ });
431
+ /**
432
+ * Whether the items passed are shallowly-equal in value, including circular references.
433
+ */
434
+ var circularShallowEqual = createDefaultEqualCreator({
435
+ comparator: sameValueZeroEqual,
436
+ circular: true,
437
+ });
438
+ /**
439
+ * Whether the items passed are shallowly-equal in value, including circular references,
440
+ * based on strict comparison.
441
+ */
442
+ var strictCircularShallowEqual = createDefaultEqualCreator({
443
+ comparator: sameValueZeroEqual,
444
+ circular: true,
445
+ strict: true,
446
+ });
447
+ /**
448
+ * Create a custom equality comparison method.
449
+ *
450
+ * This can be done to create very targeted comparisons in extreme hot-path scenarios
451
+ * where the standard methods are not performant enough, but can also be used to provide
452
+ * support for legacy environments that do not support expected features like
453
+ * `RegExp.prototype.flags` out of the box.
454
+ */
455
+ function createCustomEqual(options) {
456
+ if (options === void 0) { options = {}; }
457
+ var comparator = options.comparator, createCustomInternalComparator = options.createInternalComparator, createCustomConfig = options.createCustomConfig, createState = options.createState;
458
+ var baseConfig = createComparatorConfig(options);
459
+ var config = createCustomConfig
460
+ ? Object.assign({}, baseConfig, createCustomConfig(baseConfig))
461
+ : baseConfig;
462
+ var isEqualCustom = comparator || createComparator(config);
463
+ var isEqualCustomComparator = createCustomInternalComparator
464
+ ? createCustomInternalComparator(isEqualCustom)
465
+ : createInternalComparator(isEqualCustom);
466
+ var strict = !!options.strict;
467
+ if (createState) {
468
+ return function isEqual(a, b, metaOverride) {
469
+ var customState = createState(isEqualCustom);
470
+ return isEqualCustom(a, b, {
471
+ cache: customState.cache || new WeakMap(),
472
+ equals: customState.equals || isEqualCustomComparator,
473
+ // @ts-expect-error - inferred `Meta` may be undefined, which is okay
474
+ meta: metaOverride !== undefined ? metaOverride : customState.meta,
475
+ strict: customState.strict !== undefined ? customState.strict : strict,
476
+ });
477
+ };
478
+ }
479
+ if (options.circular) {
480
+ return function equals(a, b) {
481
+ return isEqualCustom(a, b, {
482
+ cache: new WeakMap(),
483
+ equals: isEqualCustomComparator,
484
+ meta: undefined,
485
+ strict: strict,
486
+ });
487
+ };
488
+ }
489
+ var state = Object.freeze({
490
+ cache: undefined,
491
+ equals: isEqualCustomComparator,
492
+ meta: undefined,
493
+ strict: strict,
494
+ });
495
+ return function equals(a, b) {
496
+ return isEqualCustom(a, b, state);
497
+ };
498
+ }
499
+
500
+ exports.circularDeepEqual = circularDeepEqual;
501
+ exports.circularShallowEqual = circularShallowEqual;
502
+ exports.createCustomEqual = createCustomEqual;
503
+ exports.deepEqual = deepEqual;
504
+ exports.sameValueZeroEqual = sameValueZeroEqual;
505
+ exports.shallowEqual = shallowEqual;
506
+ exports.strictCircularDeepEqual = strictCircularDeepEqual;
507
+ exports.strictCircularShallowEqual = strictCircularShallowEqual;
508
+ exports.strictDeepEqual = strictDeepEqual;
509
+ exports.strictShallowEqual = strictShallowEqual;
510
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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,CAAC,CAAM,EAAE,CAAM,EAAE,KAAkB,EAAA;;QAE3D,IAAI,CAAC,KAAK,CAAC,EAAE;AACX,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;;;;;AAMD,QAAA,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI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E,CAAC,EAAE,KAA2B,CAAC,CAAC;AAC1D,KAAC,CAAC;AACJ;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import type { ComparatorConfig, EqualityComparator } from './internalTypes';
2
+ export declare function createComparator<Meta>({ areArraysEqual, areDatesEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, }: ComparatorConfig<Meta>): EqualityComparator<Meta>;
@@ -0,0 +1,46 @@
1
+ import type { Dictionary, State } from './internalTypes';
2
+ /**
3
+ * Whether the arrays are equal in value.
4
+ */
5
+ export declare function areArraysEqual(a: any[], b: any[], state: State<any>): boolean;
6
+ /**
7
+ * Whether the dates passed are equal in value.
8
+ *
9
+ * @NOTE
10
+ * This is a standalone function instead of done inline in the comparator
11
+ * to allow for overrides.
12
+ */
13
+ export declare function areDatesEqual(a: Date, b: Date): boolean;
14
+ /**
15
+ * Whether the `Map`s are equal in value.
16
+ */
17
+ export declare function areMapsEqual(a: Map<any, any>, b: Map<any, any>, state: State<any>): boolean;
18
+ /**
19
+ * Whether the objects are equal in value.
20
+ */
21
+ export declare function areObjectsEqual(a: Dictionary, b: Dictionary, state: State<any>): boolean;
22
+ /**
23
+ * Whether the objects are equal in value with strict property checking.
24
+ */
25
+ export declare function areObjectsEqualStrict(a: Dictionary, b: Dictionary, state: State<any>): boolean;
26
+ /**
27
+ * Whether the primitive wrappers passed are equal in value.
28
+ *
29
+ * @NOTE
30
+ * This is a standalone function instead of done inline in the comparator
31
+ * to allow for overrides.
32
+ */
33
+ export declare function arePrimitiveWrappersEqual(a: Date, b: Date): boolean;
34
+ /**
35
+ * Whether the regexps passed are equal in value.
36
+ *
37
+ * @NOTE
38
+ * This is a standalone function instead of done inline in the comparator
39
+ * to allow for overrides. An example of this would be supporting a
40
+ * pre-ES2015 environment where the `flags` property is not available.
41
+ */
42
+ export declare function areRegExpsEqual(a: RegExp, b: RegExp): boolean;
43
+ /**
44
+ * Whether the `Set`s are equal in value.
45
+ */
46
+ export declare function areSetsEqual(a: Set<any>, b: Set<any>, state: State<any>): boolean;