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