fast-equals 5.3.3-beta.1 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +128 -77
  3. package/dist/cjs/comparator.d.cts +58 -0
  4. package/dist/cjs/index.cjs +133 -156
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/{types/index.d.cts → index.d.cts} +21 -2
  7. package/{src/internalTypes.ts → dist/cjs/internalTypes.d.cts} +7 -43
  8. package/dist/cjs/{types/utils.d.cts → utils.d.cts} +7 -2
  9. package/dist/es/comparator.d.mts +58 -0
  10. package/dist/{esm/types → es}/index.d.mts +21 -2
  11. package/dist/{esm → es}/index.mjs +133 -156
  12. package/dist/es/index.mjs.map +1 -0
  13. package/dist/es/internalTypes.d.mts +174 -0
  14. package/dist/{esm/types → es}/utils.d.mts +7 -2
  15. package/dist/{min/types → umd}/comparator.d.ts +2 -2
  16. package/dist/{min/types → umd}/equals.d.ts +1 -1
  17. package/dist/umd/{types/index.d.ts → index.d.ts} +2 -2
  18. package/dist/umd/index.js +133 -156
  19. package/dist/umd/index.js.map +1 -1
  20. package/dist/umd/{types/utils.d.ts → utils.d.ts} +1 -1
  21. package/index.d.ts +62 -68
  22. package/package.json +46 -54
  23. package/CHANGELOG.md +0 -364
  24. package/dist/cjs/types/comparator.d.cts +0 -26
  25. package/dist/cjs/types/internalTypes.d.cts +0 -157
  26. package/dist/esm/index.mjs.map +0 -1
  27. package/dist/esm/types/comparator.d.mts +0 -26
  28. package/dist/esm/types/internalTypes.d.mts +0 -157
  29. package/dist/min/index.js +0 -1
  30. package/dist/min/types/index.d.ts +0 -47
  31. package/dist/min/types/utils.d.ts +0 -28
  32. package/dist/umd/types/comparator.d.ts +0 -26
  33. package/dist/umd/types/equals.d.ts +0 -54
  34. package/dist/umd/types/internalTypes.d.ts +0 -157
  35. package/src/comparator.ts +0 -376
  36. package/src/equals.ts +0 -355
  37. package/src/index.ts +0 -112
  38. package/src/utils.ts +0 -96
  39. package/dist/cjs/{types/equals.d.cts → equals.d.cts} +1 -1
  40. package/dist/{esm/types → es}/equals.d.mts +1 -1
  41. /package/dist/{min/types → umd}/internalTypes.d.ts +0 -0
@@ -1,5 +1,6 @@
1
- var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
2
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1
+ const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
2
+ // eslint-disable-next-line @typescript-eslint/unbound-method
3
+ const { hasOwnProperty } = Object.prototype;
3
4
  /**
4
5
  * Combine two comparators into a single comparators.
5
6
  */
@@ -18,15 +19,15 @@ function createIsCircular(areItemsEqual) {
18
19
  if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
19
20
  return areItemsEqual(a, b, state);
20
21
  }
21
- var cache = state.cache;
22
- var cachedA = cache.get(a);
23
- var cachedB = cache.get(b);
22
+ const { cache } = state;
23
+ const cachedA = cache.get(a);
24
+ const cachedB = cache.get(b);
24
25
  if (cachedA && cachedB) {
25
26
  return cachedA === b && cachedB === a;
26
27
  }
27
28
  cache.set(a, b);
28
29
  cache.set(b, a);
29
- var result = areItemsEqual(a, b, state);
30
+ const result = areItemsEqual(a, b, state);
30
31
  cache.delete(a);
31
32
  cache.delete(b);
32
33
  return result;
@@ -48,12 +49,9 @@ function getStrictProperties(object) {
48
49
  /**
49
50
  * Whether the object contains the property passed as an own property.
50
51
  */
51
- var hasOwn =
52
+ const hasOwn =
52
53
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
53
- Object.hasOwn ||
54
- (function (object, property) {
55
- return hasOwnProperty.call(object, property);
56
- });
54
+ Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
57
55
  /**
58
56
  * Whether the values passed are strictly equal or both NaN.
59
57
  */
@@ -61,15 +59,15 @@ function sameValueZeroEqual(a, b) {
61
59
  return a === b || (!a && !b && a !== a && b !== b);
62
60
  }
63
61
 
64
- var PREACT_VNODE = '__v';
65
- var PREACT_OWNER = '__o';
66
- var REACT_OWNER = '_owner';
67
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;
62
+ const PREACT_VNODE = '__v';
63
+ const PREACT_OWNER = '__o';
64
+ const REACT_OWNER = '_owner';
65
+ const { getOwnPropertyDescriptor, keys } = Object;
68
66
  /**
69
67
  * Whether the arrays are equal in value.
70
68
  */
71
69
  function areArraysEqual(a, b, state) {
72
- var index = a.length;
70
+ let index = a.length;
73
71
  if (b.length !== index) {
74
72
  return false;
75
73
  }
@@ -90,10 +88,7 @@ function areDatesEqual(a, b) {
90
88
  * Whether the errors passed are equal in value.
91
89
  */
92
90
  function areErrorsEqual(a, b) {
93
- return (a.name === b.name &&
94
- a.message === b.message &&
95
- a.cause === b.cause &&
96
- a.stack === b.stack);
91
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
97
92
  }
98
93
  /**
99
94
  * Whether the functions passed are equal in value.
@@ -105,26 +100,26 @@ function areFunctionsEqual(a, b) {
105
100
  * Whether the `Map`s are equal in value.
106
101
  */
107
102
  function areMapsEqual(a, b, state) {
108
- var size = a.size;
103
+ const size = a.size;
109
104
  if (size !== b.size) {
110
105
  return false;
111
106
  }
112
107
  if (!size) {
113
108
  return true;
114
109
  }
115
- var matchedIndices = new Array(size);
116
- var aIterable = a.entries();
117
- var aResult;
118
- var bResult;
119
- var index = 0;
110
+ const matchedIndices = new Array(size);
111
+ const aIterable = a.entries();
112
+ let aResult;
113
+ let bResult;
114
+ let index = 0;
120
115
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
121
116
  while ((aResult = aIterable.next())) {
122
117
  if (aResult.done) {
123
118
  break;
124
119
  }
125
- var bIterable = b.entries();
126
- var hasMatch = false;
127
- var matchIndex = 0;
120
+ const bIterable = b.entries();
121
+ let hasMatch = false;
122
+ let matchIndex = 0;
128
123
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
129
124
  while ((bResult = bIterable.next())) {
130
125
  if (bResult.done) {
@@ -134,10 +129,10 @@ function areMapsEqual(a, b, state) {
134
129
  matchIndex++;
135
130
  continue;
136
131
  }
137
- var aEntry = aResult.value;
138
- var bEntry = bResult.value;
139
- if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) &&
140
- state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
132
+ const aEntry = aResult.value;
133
+ const bEntry = bResult.value;
134
+ if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
135
+ && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
141
136
  hasMatch = matchedIndices[matchIndex] = true;
142
137
  break;
143
138
  }
@@ -153,13 +148,13 @@ function areMapsEqual(a, b, state) {
153
148
  /**
154
149
  * Whether the numbers are equal in value.
155
150
  */
156
- var areNumbersEqual = sameValueZeroEqual;
151
+ const areNumbersEqual = sameValueZeroEqual;
157
152
  /**
158
153
  * Whether the objects are equal in value.
159
154
  */
160
155
  function areObjectsEqual(a, b, state) {
161
- var properties = keys(a);
162
- var index = properties.length;
156
+ const properties = keys(a);
157
+ let index = properties.length;
163
158
  if (keys(b).length !== index) {
164
159
  return false;
165
160
  }
@@ -178,14 +173,14 @@ function areObjectsEqual(a, b, state) {
178
173
  * Whether the objects are equal in value with strict property checking.
179
174
  */
180
175
  function areObjectsEqualStrict(a, b, state) {
181
- var properties = getStrictProperties(a);
182
- var index = properties.length;
176
+ const properties = getStrictProperties(a);
177
+ let index = properties.length;
183
178
  if (getStrictProperties(b).length !== index) {
184
179
  return false;
185
180
  }
186
- var property;
187
- var descriptorA;
188
- var descriptorB;
181
+ let property;
182
+ let descriptorA;
183
+ let descriptorB;
189
184
  // Decrementing `while` showed faster results than either incrementing or
190
185
  // decrementing `for` loop and than an incrementing `while` loop. Declarative
191
186
  // methods like `some` / `every` were not used to avoid incurring the garbage
@@ -197,12 +192,12 @@ function areObjectsEqualStrict(a, b, state) {
197
192
  }
198
193
  descriptorA = getOwnPropertyDescriptor(a, property);
199
194
  descriptorB = getOwnPropertyDescriptor(b, property);
200
- if ((descriptorA || descriptorB) &&
201
- (!descriptorA ||
202
- !descriptorB ||
203
- descriptorA.configurable !== descriptorB.configurable ||
204
- descriptorA.enumerable !== descriptorB.enumerable ||
205
- descriptorA.writable !== descriptorB.writable)) {
195
+ if ((descriptorA || descriptorB)
196
+ && (!descriptorA
197
+ || !descriptorB
198
+ || descriptorA.configurable !== descriptorB.configurable
199
+ || descriptorA.enumerable !== descriptorB.enumerable
200
+ || descriptorA.writable !== descriptorB.writable)) {
206
201
  return false;
207
202
  }
208
203
  }
@@ -224,32 +219,32 @@ function areRegExpsEqual(a, b) {
224
219
  * Whether the `Set`s are equal in value.
225
220
  */
226
221
  function areSetsEqual(a, b, state) {
227
- var size = a.size;
222
+ const size = a.size;
228
223
  if (size !== b.size) {
229
224
  return false;
230
225
  }
231
226
  if (!size) {
232
227
  return true;
233
228
  }
234
- var matchedIndices = new Array(size);
235
- var aIterable = a.values();
236
- var aResult;
237
- var bResult;
229
+ const matchedIndices = new Array(size);
230
+ const aIterable = a.values();
231
+ let aResult;
232
+ let bResult;
238
233
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
239
234
  while ((aResult = aIterable.next())) {
240
235
  if (aResult.done) {
241
236
  break;
242
237
  }
243
- var bIterable = b.values();
244
- var hasMatch = false;
245
- var matchIndex = 0;
238
+ const bIterable = b.values();
239
+ let hasMatch = false;
240
+ let matchIndex = 0;
246
241
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
247
242
  while ((bResult = bIterable.next())) {
248
243
  if (bResult.done) {
249
244
  break;
250
245
  }
251
- if (!matchedIndices[matchIndex] &&
252
- state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
246
+ if (!matchedIndices[matchIndex]
247
+ && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
253
248
  hasMatch = matchedIndices[matchIndex] = true;
254
249
  break;
255
250
  }
@@ -265,7 +260,7 @@ function areSetsEqual(a, b, state) {
265
260
  * Whether the TypedArray instances are equal in value.
266
261
  */
267
262
  function areTypedArraysEqual(a, b) {
268
- var index = a.length;
263
+ let index = a.length;
269
264
  if (b.length !== index) {
270
265
  return false;
271
266
  }
@@ -280,47 +275,44 @@ function areTypedArraysEqual(a, b) {
280
275
  * Whether the URL instances are equal in value.
281
276
  */
282
277
  function areUrlsEqual(a, b) {
283
- return (a.hostname === b.hostname &&
284
- a.pathname === b.pathname &&
285
- a.protocol === b.protocol &&
286
- a.port === b.port &&
287
- a.hash === b.hash &&
288
- a.username === b.username &&
289
- a.password === b.password);
278
+ return (a.hostname === b.hostname
279
+ && a.pathname === b.pathname
280
+ && a.protocol === b.protocol
281
+ && a.port === b.port
282
+ && a.hash === b.hash
283
+ && a.username === b.username
284
+ && a.password === b.password);
290
285
  }
291
286
  function isPropertyEqual(a, b, state, property) {
292
- if ((property === REACT_OWNER ||
293
- property === PREACT_OWNER ||
294
- property === PREACT_VNODE) &&
295
- (a.$$typeof || b.$$typeof)) {
287
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)
288
+ && (a.$$typeof || b.$$typeof)) {
296
289
  return true;
297
290
  }
298
- return (hasOwn(b, property) &&
299
- state.equals(a[property], b[property], property, property, a, b, state));
291
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
300
292
  }
301
293
 
302
- var ARGUMENTS_TAG = '[object Arguments]';
303
- var BOOLEAN_TAG = '[object Boolean]';
304
- var DATE_TAG = '[object Date]';
305
- var ERROR_TAG = '[object Error]';
306
- var MAP_TAG = '[object Map]';
307
- var NUMBER_TAG = '[object Number]';
308
- var OBJECT_TAG = '[object Object]';
309
- var REG_EXP_TAG = '[object RegExp]';
310
- var SET_TAG = '[object Set]';
311
- var STRING_TAG = '[object String]';
312
- var URL_TAG = '[object URL]';
313
- var isArray = Array.isArray;
314
- var isTypedArray = typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function'
315
- ? ArrayBuffer.isView
316
- : null;
317
- var assign = Object.assign;
318
- var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
294
+ const ARGUMENTS_TAG = '[object Arguments]';
295
+ const BOOLEAN_TAG = '[object Boolean]';
296
+ const DATE_TAG = '[object Date]';
297
+ const ERROR_TAG = '[object Error]';
298
+ const MAP_TAG = '[object Map]';
299
+ const NUMBER_TAG = '[object Number]';
300
+ const OBJECT_TAG = '[object Object]';
301
+ const REG_EXP_TAG = '[object RegExp]';
302
+ const SET_TAG = '[object Set]';
303
+ const STRING_TAG = '[object String]';
304
+ const URL_TAG = '[object URL]';
305
+ const { isArray } = Array;
306
+ const isTypedArray =
307
+ // eslint-disable-next-line @typescript-eslint/unbound-method
308
+ typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView : null;
309
+ const { assign } = Object;
310
+ // eslint-disable-next-line @typescript-eslint/unbound-method
311
+ const getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
319
312
  /**
320
313
  * Create a comparator method based on the type-specific equality comparators passed.
321
314
  */
322
- function createEqualityComparator(_a) {
323
- var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areErrorsEqual = _a.areErrorsEqual, areFunctionsEqual = _a.areFunctionsEqual, areMapsEqual = _a.areMapsEqual, areNumbersEqual = _a.areNumbersEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual, areTypedArraysEqual = _a.areTypedArraysEqual, areUrlsEqual = _a.areUrlsEqual, unknownTagComparators = _a.unknownTagComparators;
315
+ function createEqualityComparator({ areArraysEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, unknownTagComparators, }) {
324
316
  /**
325
317
  * compare the value of the two objects and return true if they are equivalent in values
326
318
  */
@@ -334,7 +326,7 @@ function createEqualityComparator(_a) {
334
326
  if (a == null || b == null) {
335
327
  return false;
336
328
  }
337
- var type = typeof a;
329
+ const type = typeof a;
338
330
  if (type !== typeof b) {
339
331
  return false;
340
332
  }
@@ -348,7 +340,7 @@ function createEqualityComparator(_a) {
348
340
  // If a primitive value that is not strictly equal, it must be unequal.
349
341
  return false;
350
342
  }
351
- var constructor = a.constructor;
343
+ const constructor = a.constructor;
352
344
  // Checks are listed in order of commonality of use-case:
353
345
  // 1. Common complex object types (plain object, array)
354
346
  // 2. Common data values (date, regexp)
@@ -375,7 +367,7 @@ function createEqualityComparator(_a) {
375
367
  }
376
368
  // `isTypedArray()` works on all possible TypedArray classes, so we can avoid
377
369
  // capturing the string tag or comparing against all possible constructors.
378
- if (isTypedArray === null || isTypedArray === void 0 ? void 0 : isTypedArray(a)) {
370
+ if (isTypedArray != null && isTypedArray(a)) {
379
371
  return areTypedArraysEqual(a, b, state);
380
372
  }
381
373
  // Try to fast-path equality checks for other complex object types in the
@@ -397,7 +389,7 @@ function createEqualityComparator(_a) {
397
389
  }
398
390
  // Since this is a custom object, capture the string tag to determing its type.
399
391
  // This is reasonably performant in modern environments like v8 and SpiderMonkey.
400
- var tag = getTag(a);
392
+ const tag = getTag(a);
401
393
  if (tag === DATE_TAG) {
402
394
  return areDatesEqual(a, b, state);
403
395
  }
@@ -416,9 +408,7 @@ function createEqualityComparator(_a) {
416
408
  // The exception for value comparison is custom `Promise`-like class instances. These should
417
409
  // be treated the same as standard `Promise` objects, which means strict equality, and if
418
410
  // it reaches this point then that strict equality comparison has already failed.
419
- return (typeof a.then !== 'function' &&
420
- typeof b.then !== 'function' &&
421
- areObjectsEqual(a, b, state));
411
+ return typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state);
422
412
  }
423
413
  // If a URL tag, it should be tested explicitly. Like RegExp, the properties are not
424
414
  // enumerable, and therefore will give false positives if tested like a standard object.
@@ -441,9 +431,9 @@ function createEqualityComparator(_a) {
441
431
  return arePrimitiveWrappersEqual(a, b, state);
442
432
  }
443
433
  if (unknownTagComparators) {
444
- var unknownTagComparator = unknownTagComparators[tag];
434
+ let unknownTagComparator = unknownTagComparators[tag];
445
435
  if (!unknownTagComparator) {
446
- var shortTag = getShortTag(a);
436
+ const shortTag = getShortTag(a);
447
437
  if (shortTag) {
448
438
  unknownTagComparator = unknownTagComparators[shortTag];
449
439
  }
@@ -471,30 +461,19 @@ function createEqualityComparator(_a) {
471
461
  /**
472
462
  * Create the configuration object used for building comparators.
473
463
  */
474
- function createEqualityComparatorConfig(_a) {
475
- var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
476
- var config = {
477
- areArraysEqual: strict
478
- ? areObjectsEqualStrict
479
- : areArraysEqual,
464
+ function createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {
465
+ let config = {
466
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
480
467
  areDatesEqual: areDatesEqual,
481
468
  areErrorsEqual: areErrorsEqual,
482
469
  areFunctionsEqual: areFunctionsEqual,
483
- areMapsEqual: strict
484
- ? combineComparators(areMapsEqual, areObjectsEqualStrict)
485
- : areMapsEqual,
470
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
486
471
  areNumbersEqual: areNumbersEqual,
487
- areObjectsEqual: strict
488
- ? areObjectsEqualStrict
489
- : areObjectsEqual,
472
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
490
473
  arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
491
474
  areRegExpsEqual: areRegExpsEqual,
492
- areSetsEqual: strict
493
- ? combineComparators(areSetsEqual, areObjectsEqualStrict)
494
- : areSetsEqual,
495
- areTypedArraysEqual: strict
496
- ? areObjectsEqualStrict
497
- : areTypedArraysEqual,
475
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
476
+ areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
498
477
  areUrlsEqual: areUrlsEqual,
499
478
  unknownTagComparators: undefined,
500
479
  };
@@ -502,15 +481,15 @@ function createEqualityComparatorConfig(_a) {
502
481
  config = assign({}, config, createCustomConfig(config));
503
482
  }
504
483
  if (circular) {
505
- var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
506
- var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
507
- var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
508
- var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
484
+ const areArraysEqual = createIsCircular(config.areArraysEqual);
485
+ const areMapsEqual = createIsCircular(config.areMapsEqual);
486
+ const areObjectsEqual = createIsCircular(config.areObjectsEqual);
487
+ const areSetsEqual = createIsCircular(config.areSetsEqual);
509
488
  config = assign({}, config, {
510
- areArraysEqual: areArraysEqual$1,
511
- areMapsEqual: areMapsEqual$1,
512
- areObjectsEqual: areObjectsEqual$1,
513
- areSetsEqual: areSetsEqual$1,
489
+ areArraysEqual,
490
+ areMapsEqual,
491
+ areObjectsEqual,
492
+ areSetsEqual,
514
493
  });
515
494
  }
516
495
  return config;
@@ -527,16 +506,15 @@ function createInternalEqualityComparator(compare) {
527
506
  /**
528
507
  * Create the `isEqual` function used by the consuming application.
529
508
  */
530
- function createIsEqual(_a) {
531
- var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
509
+ function createIsEqual({ circular, comparator, createState, equals, strict }) {
532
510
  if (createState) {
533
511
  return function isEqual(a, b) {
534
- var _a = createState(), _b = _a.cache, cache = _b === void 0 ? circular ? new WeakMap() : undefined : _b, meta = _a.meta;
512
+ const { cache = circular ? new WeakMap() : undefined, meta } = createState();
535
513
  return comparator(a, b, {
536
- cache: cache,
537
- equals: equals,
538
- meta: meta,
539
- strict: strict,
514
+ cache,
515
+ equals,
516
+ meta,
517
+ strict,
540
518
  });
541
519
  };
542
520
  }
@@ -544,17 +522,17 @@ function createIsEqual(_a) {
544
522
  return function isEqual(a, b) {
545
523
  return comparator(a, b, {
546
524
  cache: new WeakMap(),
547
- equals: equals,
525
+ equals,
548
526
  meta: undefined,
549
- strict: strict,
527
+ strict,
550
528
  });
551
529
  };
552
530
  }
553
- var state = {
531
+ const state = {
554
532
  cache: undefined,
555
- equals: equals,
533
+ equals,
556
534
  meta: undefined,
557
- strict: strict,
535
+ strict,
558
536
  };
559
537
  return function isEqual(a, b) {
560
538
  return comparator(a, b, state);
@@ -564,50 +542,50 @@ function createIsEqual(_a) {
564
542
  /**
565
543
  * Whether the items passed are deeply-equal in value.
566
544
  */
567
- var deepEqual = createCustomEqual();
545
+ const deepEqual = createCustomEqual();
568
546
  /**
569
547
  * Whether the items passed are deeply-equal in value based on strict comparison.
570
548
  */
571
- var strictDeepEqual = createCustomEqual({ strict: true });
549
+ const strictDeepEqual = createCustomEqual({ strict: true });
572
550
  /**
573
551
  * Whether the items passed are deeply-equal in value, including circular references.
574
552
  */
575
- var circularDeepEqual = createCustomEqual({ circular: true });
553
+ const circularDeepEqual = createCustomEqual({ circular: true });
576
554
  /**
577
555
  * Whether the items passed are deeply-equal in value, including circular references,
578
556
  * based on strict comparison.
579
557
  */
580
- var strictCircularDeepEqual = createCustomEqual({
558
+ const strictCircularDeepEqual = createCustomEqual({
581
559
  circular: true,
582
560
  strict: true,
583
561
  });
584
562
  /**
585
563
  * Whether the items passed are shallowly-equal in value.
586
564
  */
587
- var shallowEqual = createCustomEqual({
588
- createInternalComparator: function () { return sameValueZeroEqual; },
565
+ const shallowEqual = createCustomEqual({
566
+ createInternalComparator: () => sameValueZeroEqual,
589
567
  });
590
568
  /**
591
569
  * Whether the items passed are shallowly-equal in value based on strict comparison
592
570
  */
593
- var strictShallowEqual = createCustomEqual({
571
+ const strictShallowEqual = createCustomEqual({
594
572
  strict: true,
595
- createInternalComparator: function () { return sameValueZeroEqual; },
573
+ createInternalComparator: () => sameValueZeroEqual,
596
574
  });
597
575
  /**
598
576
  * Whether the items passed are shallowly-equal in value, including circular references.
599
577
  */
600
- var circularShallowEqual = createCustomEqual({
578
+ const circularShallowEqual = createCustomEqual({
601
579
  circular: true,
602
- createInternalComparator: function () { return sameValueZeroEqual; },
580
+ createInternalComparator: () => sameValueZeroEqual,
603
581
  });
604
582
  /**
605
583
  * Whether the items passed are shallowly-equal in value, including circular references,
606
584
  * based on strict comparison.
607
585
  */
608
- var strictCircularShallowEqual = createCustomEqual({
586
+ const strictCircularShallowEqual = createCustomEqual({
609
587
  circular: true,
610
- createInternalComparator: function () { return sameValueZeroEqual; },
588
+ createInternalComparator: () => sameValueZeroEqual,
611
589
  strict: true,
612
590
  });
613
591
  /**
@@ -618,15 +596,14 @@ var strictCircularShallowEqual = createCustomEqual({
618
596
  * support for legacy environments that do not support expected features like
619
597
  * `RegExp.prototype.flags` out of the box.
620
598
  */
621
- function createCustomEqual(options) {
622
- if (options === void 0) { options = {}; }
623
- var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
624
- var config = createEqualityComparatorConfig(options);
625
- var comparator = createEqualityComparator(config);
626
- var equals = createCustomInternalComparator
599
+ function createCustomEqual(options = {}) {
600
+ const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;
601
+ const config = createEqualityComparatorConfig(options);
602
+ const comparator = createEqualityComparator(config);
603
+ const equals = createCustomInternalComparator
627
604
  ? createCustomInternalComparator(comparator)
628
605
  : createInternalEqualityComparator(comparator);
629
- return createIsEqual({ circular: circular, comparator: comparator, createState: createState, equals: equals, strict: strict });
606
+ return createIsEqual({ circular, comparator, createState, equals, strict });
630
607
  }
631
608
 
632
609
  export { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictShallowEqual };