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