fast-equals 6.2.0 → 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  > fast-equals
2
2
 
3
3
  Perform [blazing fast](#benchmarks) equality comparisons between two objects, while also allowing for flexibility for
4
- various use-cases. It has no dependencies, and is ~2.46kB when minified and gzipped.
4
+ various use-cases. It has no dependencies, and is ~2.65kB when minified and gzipped.
5
5
 
6
6
  The following types are handled out-of-the-box:
7
7
 
@@ -445,74 +445,74 @@ Testing mixed objects equal...
445
445
  ┌────────────────────────────────────────┬────────────────┐
446
446
  │ Name │ Ops / sec │
447
447
  ├────────────────────────────────────────┼────────────────┤
448
- │ fast-equals (passed) │ 1522774.1567 │
448
+ │ fast-equals (passed) │ 1763109.81851 │
449
449
  ├────────────────────────────────────────┼────────────────┤
450
- │ react-fast-compare (passed) │ 1285289.880042 │
450
+ │ fast-deep-equal (passed) │ 1297247.799465 │
451
451
  ├────────────────────────────────────────┼────────────────┤
452
- │ fast-deep-equal (passed) │ 1285105.414715 │
452
+ │ react-fast-compare (passed) │ 1271146.258704 │
453
453
  ├────────────────────────────────────────┼────────────────┤
454
- │ shallow-equal-fuzzy (passed) │ 1248325.039481 │
454
+ │ shallow-equal-fuzzy (passed) │ 1235115.693854 │
455
455
  ├────────────────────────────────────────┼────────────────┤
456
- │ nano-equal (failed) │ 962152.688616 │
456
+ │ nano-equal (failed) │ 964815.367752 │
457
457
  ├────────────────────────────────────────┼────────────────┤
458
- │ fast-equals (circular) (passed) │ 800100.693495 │
458
+ │ fast-equals (circular) (passed) │ 834232.686567 │
459
459
  ├────────────────────────────────────────┼────────────────┤
460
- │ dequal/lite (passed) │ 778011.650869 │
460
+ │ dequal (passed) │ 759417.072806 │
461
461
  ├────────────────────────────────────────┼────────────────┤
462
- │ dequal (passed) │ 770187.208947 │
462
+ │ dequal/lite (passed) │ 751901.517376 │
463
463
  ├────────────────────────────────────────┼────────────────┤
464
- │ underscore.isEqual (passed) │ 449433.41171 │
464
+ │ underscore.isEqual (passed) │ 447789.934941 │
465
465
  ├────────────────────────────────────────┼────────────────┤
466
- │ assert.deepStrictEqual (passed) │ 442249.829162 │
466
+ │ assert.deepStrictEqual (passed) │ 433256.455121 │
467
467
  ├────────────────────────────────────────┼────────────────┤
468
- │ es-toolkit (passed) │ 355943.82757 │
468
+ │ es-toolkit (passed) │ 343382.909087 │
469
469
  ├────────────────────────────────────────┼────────────────┤
470
- │ fast-equals (strict) (passed) │ 307931.96677 │
470
+ │ fast-equals (strict) (passed) │ 294211.792998 │
471
471
  ├────────────────────────────────────────┼────────────────┤
472
- │ lodash.isEqual (passed) │ 294660.269815 │
472
+ │ lodash.isEqual (passed) │ 290477.460766 │
473
473
  ├────────────────────────────────────────┼────────────────┤
474
- │ fast-equals (strict circular) (passed) │ 252760.794458 │
474
+ │ fast-equals (strict circular) (passed) │ 232110.748904 │
475
475
  ├────────────────────────────────────────┼────────────────┤
476
- │ deep-eql (passed) │ 166131.383227 │
476
+ │ deep-eql (passed) │ 161408.4511 │
477
477
  ├────────────────────────────────────────┼────────────────┤
478
- │ deep-equal (passed) │ 970.944208 │
478
+ │ deep-equal (passed) │ 951.279346 │
479
479
  └────────────────────────────────────────┴────────────────┘
480
480
 
481
481
  Testing mixed objects not equal...
482
482
  ┌────────────────────────────────────────┬────────────────┐
483
483
  │ Name │ Ops / sec │
484
484
  ├────────────────────────────────────────┼────────────────┤
485
- │ fast-equals (passed) │ 5122472.769802 │
485
+ │ fast-equals (passed) │ 5402008.064431 │
486
486
  ├────────────────────────────────────────┼────────────────┤
487
- │ fast-deep-equal (passed) │ 3520297.242957 │
487
+ │ fast-equals (circular) (passed) │ 3687783.563818 │
488
488
  ├────────────────────────────────────────┼────────────────┤
489
- │ fast-equals (circular) (passed) │ 3485912.9348 │
489
+ │ fast-deep-equal (passed) │ 3479884.479164 │
490
490
  ├────────────────────────────────────────┼────────────────┤
491
- │ react-fast-compare (passed) │ 3414203.488651 │
491
+ │ react-fast-compare (passed) │ 3356141.586592 │
492
492
  ├────────────────────────────────────────┼────────────────┤
493
- │ fast-equals (strict) (passed) │ 3038182.032793 │
493
+ │ fast-equals (strict) (passed) │ 2927133.435788 │
494
494
  ├────────────────────────────────────────┼────────────────┤
495
- │ fast-equals (strict circular) (passed) │ 2344879.08551 │
495
+ │ fast-equals (strict circular) (passed) │ 1566187.833636 │
496
496
  ├────────────────────────────────────────┼────────────────┤
497
- │ dequal/lite (passed) │ 1340883.333611 │
497
+ │ dequal/lite (passed) │ 1316031.262808 │
498
498
  ├────────────────────────────────────────┼────────────────┤
499
- │ dequal (passed) │ 1311832.728093 │
499
+ │ dequal (passed) │ 1298255.762153 │
500
500
  ├────────────────────────────────────────┼────────────────┤
501
- │ shallow-equal-fuzzy (failed) │ 1249967.301358 │
501
+ │ shallow-equal-fuzzy (failed) │ 1219217.578795 │
502
502
  ├────────────────────────────────────────┼────────────────┤
503
- │ nano-equal (passed) │ 1096529.56672 │
503
+ │ nano-equal (passed) │ 1074115.593615 │
504
504
  ├────────────────────────────────────────┼────────────────┤
505
- │ underscore.isEqual (passed) │ 660524.165237 │
505
+ │ underscore.isEqual (passed) │ 659016.868085 │
506
506
  ├────────────────────────────────────────┼────────────────┤
507
- │ lodash.isEqual (passed) │ 385500.174796 │
507
+ │ lodash.isEqual (passed) │ 374944.853605 │
508
508
  ├────────────────────────────────────────┼────────────────┤
509
- │ es-toolkit (passed) │ 365617.977684 │
509
+ │ es-toolkit (passed) │ 355882.255615 │
510
510
  ├────────────────────────────────────────┼────────────────┤
511
- │ deep-eql (passed) │ 186388.440331 │
511
+ │ deep-eql (passed) │ 182235.73069 │
512
512
  ├────────────────────────────────────────┼────────────────┤
513
- │ assert.deepStrictEqual (passed) │ 21060.162935 │
513
+ │ assert.deepStrictEqual (passed) │ 20975.582116 │
514
514
  ├────────────────────────────────────────┼────────────────┤
515
- │ deep-equal (passed) │ 3819.218852 │
515
+ │ deep-equal (passed) │ 3760.574487 │
516
516
  └────────────────────────────────────────┴────────────────┘
517
517
  ```
518
518
 
@@ -1,8 +1,40 @@
1
1
  'use strict';
2
2
 
3
- const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
3
+ const { getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols } = Object;
4
4
  const { hasOwnProperty, toString: toString$1 } = Object.prototype;
5
5
  const OBJECT_TAG = '[object Object]';
6
+ /**
7
+ * Whether the own properties from `end` onward are equal with strict property checking, where the
8
+ * caller has already verified that both objects have the same number of own properties.
9
+ */
10
+ function areStrictPropertiesEqual(a, b, state, properties, end) {
11
+ let index = properties.length;
12
+ let property;
13
+ let descriptorA;
14
+ let descriptorB;
15
+ // Decrementing `while` showed faster results than either incrementing or
16
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
17
+ // methods like `some` / `every` were not used to avoid incurring the garbage
18
+ // cost of anonymous callbacks.
19
+ while (index-- > end) {
20
+ property = properties[index];
21
+ if (!isReactProperty(a, b, property)
22
+ && (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state))) {
23
+ return false;
24
+ }
25
+ descriptorA = getOwnPropertyDescriptor(a, property);
26
+ descriptorB = getOwnPropertyDescriptor(b, property);
27
+ if ((descriptorA || descriptorB)
28
+ && (!descriptorA
29
+ || !descriptorB
30
+ || descriptorA.configurable !== descriptorB.configurable
31
+ || descriptorA.enumerable !== descriptorB.enumerable
32
+ || descriptorA.writable !== descriptorB.writable)) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
6
38
  /**
7
39
  * Combine two comparators into a single comparators.
8
40
  */
@@ -45,6 +77,10 @@ function getStrictProperties(object) {
45
77
  ? getOwnPropertyNames(object).concat(symbols)
46
78
  : getOwnPropertyNames(object);
47
79
  }
80
+ /**
81
+ * Identify the element type of TypedArrays across realms and subclasses.
82
+ */
83
+ const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
48
84
  /**
49
85
  * Whether the object contains the property passed as an own property.
50
86
  */
@@ -67,15 +103,37 @@ function isNullPrototypeComparable(a, b) {
67
103
  }
68
104
  return false;
69
105
  }
106
+ /**
107
+ * Whether the property passed is a property specific to React/Preact elements. These are ignored in comparison, as they
108
+ * are deeply circular and will return frequent false negatives for the comparison that matters, which is often the
109
+ * React element's aspects (`props`, `type`, etc.).
110
+ */
111
+ function isReactProperty(a, b, property) {
112
+ return (
113
+ // _owner -> React owner
114
+ // __o -> Preact owner
115
+ // __v -> Preact vnode
116
+ (property === '_owner' || property === '__o' || property === '__v') && !!(a.$$typeof || b.$$typeof));
117
+ }
118
+ /**
119
+ * Reorder a serialized query string so that params holding the same pairs compare as equal
120
+ * regardless of the order they appear in.
121
+ *
122
+ * @note
123
+ * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
124
+ * splitting on `&` recovers exactly the pairs and nothing else.
125
+ */
126
+ function sortSearchParams(serialized) {
127
+ return serialized.split('&').sort().join('&');
128
+ }
70
129
 
71
- const PREACT_VNODE = '__v';
72
- const PREACT_OWNER = '__o';
73
- const REACT_OWNER = '_owner';
74
- const { getOwnPropertyDescriptor, keys } = Object;
75
130
  /**
76
- * Identify the element type of TypedArrays across realms and subclasses.
131
+ * Above this many keys, out-of-position keys are checked with `propertyIsEnumerable` rather than by
132
+ * scanning the other object's keys. Measured in V8: scanning wins up to 50 keys and loses from 100.
77
133
  */
78
- const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
134
+ const MAX_SCANNED_PROPERTIES = 64;
135
+ const { keys } = Object;
136
+ const { propertyIsEnumerable } = Object.prototype;
79
137
  /**
80
138
  * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
81
139
  * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
@@ -149,16 +207,68 @@ function areDatesEqual(a, b) {
149
207
  *
150
208
  * @note
151
209
  * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
152
- * explicitly. `cause` is compared by value rather than by reference, matching how every other
153
- * nested value in the comparison is treated. Own enumerable properties (which custom `Error`
154
- * subclasses commonly add) are compared by composing this with the object comparator in the
155
- * comparator config, so that the strict and circular variants apply to them as well.
210
+ * explicitly. `cause` and `errors` are compared by value rather than by reference, matching how
211
+ * every other nested value in the comparison is treated. They are compared exactly once, regardless
212
+ * of whether they were assigned (enumerable) or set by the constructor (non-enumerable). Other own
213
+ * enumerable properties (which custom `Error` subclasses commonly add) are compared afterward.
214
+ *
215
+ * The own property comparison is inlined rather than extracted, which measured faster in V8 when
216
+ * recursing through `cause`. Keep the bytecode under V8's 460-byte TurboFan inlining limit (383 bytes
217
+ * at time of writing; check with `node --print-bytecode --print-bytecode-filter=areErrorsEqual`), or
218
+ * this stops being inlined into its callers.
156
219
  */
157
220
  function areErrorsEqual(a, b, state) {
158
- return (a.name === b.name
159
- && a.message === b.message
160
- && a.stack === b.stack
161
- && state.equals(a.cause, b.cause, 'cause', 'cause', a, b, state));
221
+ if (a.name !== b.name || a.message !== b.message || a.stack !== b.stack) {
222
+ return false;
223
+ }
224
+ const causeA = a.cause;
225
+ const causeB = b.cause;
226
+ if (causeA !== causeB && !state.equals(causeA, causeB, 'cause', 'cause', a, b, state)) {
227
+ return false;
228
+ }
229
+ const errorsA = a.errors;
230
+ const errorsB = b.errors;
231
+ if (errorsA !== errorsB && !state.equals(errorsA, errorsB, 'errors', 'errors', a, b, state)) {
232
+ return false;
233
+ }
234
+ const propertiesA = keys(a);
235
+ const propertiesB = keys(b);
236
+ let index = propertiesA.length;
237
+ // Constructed errors rarely have enumerable own properties.
238
+ if (!index && !propertiesB.length) {
239
+ return true;
240
+ }
241
+ let compared = 0;
242
+ let property;
243
+ while (index-- > 0) {
244
+ property = propertiesA[index];
245
+ // Already compared above regardless of enumerability, so we can ignore them.
246
+ if (property === 'cause' || property === 'errors') {
247
+ continue;
248
+ }
249
+ // `propertyIsEnumerable` rather than `hasOwn`, so that a non-enumerable own property on `b` cannot
250
+ // stand in for an enumerable one. Keys in the same position are trivially enumerable on `b`.
251
+ if ((property !== propertiesB[index] && !propertyIsEnumerable.call(b, property))
252
+ || !state.equals(a[property], b[property], property, property, a, b, state)) {
253
+ return false;
254
+ }
255
+ ++compared;
256
+ }
257
+ // Every compared key is enumerable on `b`, so any of `b`'s keys left over must be `cause` / `errors`.
258
+ const remaining = propertiesB.length - compared;
259
+ return (!remaining
260
+ || remaining === (propertyIsEnumerable.call(b, 'cause') ? 1 : 0) + (propertyIsEnumerable.call(b, 'errors') ? 1 : 0));
261
+ }
262
+ /**
263
+ * Whether the errors passed are equal in value.
264
+ *
265
+ * @note
266
+ * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
267
+ * explicitly. `cause` and `errors` are own properties, so `areObjectsEqualStrict` compares them along
268
+ * with every other own property; they are not compared explicitly to avoid comparing them twice.
269
+ */
270
+ function areErrorsEqualStrict(a, b, state) {
271
+ return a.name === b.name && a.message === b.message && a.stack === b.stack && areObjectsEqualStrict(a, b, state);
162
272
  }
163
273
  /**
164
274
  * Whether the `Map`s are equal in value.
@@ -171,7 +281,7 @@ function areMapsEqual(a, b, state) {
171
281
  if (!size) {
172
282
  return true;
173
283
  }
174
- const matchedIndices = new Uint8Array(size);
284
+ const matchedIndices = new Array(size);
175
285
  const aIterable = a.entries();
176
286
  let aResult;
177
287
  let bResult;
@@ -182,7 +292,7 @@ function areMapsEqual(a, b, state) {
182
292
  break;
183
293
  }
184
294
  const bIterable = b.entries();
185
- let hasMatch = 0;
295
+ let hasMatch = false;
186
296
  let matchIndex = 0;
187
297
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
188
298
  while ((bResult = bIterable.next())) {
@@ -197,7 +307,7 @@ function areMapsEqual(a, b, state) {
197
307
  const bEntry = bResult.value;
198
308
  if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
199
309
  && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
200
- hasMatch = matchedIndices[matchIndex] = 1;
310
+ hasMatch = matchedIndices[matchIndex] = true;
201
311
  break;
202
312
  }
203
313
  matchIndex++;
@@ -214,16 +324,30 @@ function areMapsEqual(a, b, state) {
214
324
  */
215
325
  function areObjectsEqual(a, b, state) {
216
326
  const properties = keys(a);
327
+ const propertiesB = keys(b);
217
328
  let index = properties.length;
218
- if (keys(b).length !== index) {
329
+ if (propertiesB.length !== index) {
219
330
  return false;
220
331
  }
332
+ const isScannable = index <= MAX_SCANNED_PROPERTIES;
333
+ let property;
221
334
  // Decrementing `while` showed faster results than either incrementing or
222
335
  // decrementing `for` loop and than an incrementing `while` loop. Declarative
223
336
  // methods like `some` / `every` were not used to avoid incurring the garbage
224
337
  // cost of anonymous callbacks.
225
338
  while (index-- > 0) {
226
- if (!isPropertyEqual(a, b, state, properties[index])) {
339
+ property = properties[index];
340
+ if (isReactProperty(a, b, property)) {
341
+ continue;
342
+ }
343
+ // Objects built the same way list their keys in the same order, in which case the key is
344
+ // already known to be an own enumerable property of `b` and the lookup can be skipped.
345
+ // Otherwise, `propertiesB` is exactly `b`'s own enumerable keys. Scanning it is faster than
346
+ // `propertyIsEnumerable` for smaller objects, but it is linear per key, so larger objects
347
+ // (where reordering would make it quadratic) use the lookup instead.
348
+ if ((property !== propertiesB[index]
349
+ && !(isScannable ? propertiesB.includes(property) : propertyIsEnumerable.call(b, property)))
350
+ || !state.equals(a[property], b[property], property, property, a, b, state)) {
227
351
  return false;
228
352
  }
229
353
  }
@@ -234,34 +358,7 @@ function areObjectsEqual(a, b, state) {
234
358
  */
235
359
  function areObjectsEqualStrict(a, b, state) {
236
360
  const properties = getStrictProperties(a);
237
- let index = properties.length;
238
- if (getStrictProperties(b).length !== index) {
239
- return false;
240
- }
241
- let property;
242
- let descriptorA;
243
- let descriptorB;
244
- // Decrementing `while` showed faster results than either incrementing or
245
- // decrementing `for` loop and than an incrementing `while` loop. Declarative
246
- // methods like `some` / `every` were not used to avoid incurring the garbage
247
- // cost of anonymous callbacks.
248
- while (index-- > 0) {
249
- property = properties[index];
250
- if (!isPropertyEqual(a, b, state, property)) {
251
- return false;
252
- }
253
- descriptorA = getOwnPropertyDescriptor(a, property);
254
- descriptorB = getOwnPropertyDescriptor(b, property);
255
- if ((descriptorA || descriptorB)
256
- && (!descriptorA
257
- || !descriptorB
258
- || descriptorA.configurable !== descriptorB.configurable
259
- || descriptorA.enumerable !== descriptorB.enumerable
260
- || descriptorA.writable !== descriptorB.writable)) {
261
- return false;
262
- }
263
- }
264
- return true;
361
+ return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, 0);
265
362
  }
266
363
  /**
267
364
  * Whether the primitive wrappers passed are equal in value.
@@ -275,6 +372,21 @@ function arePrimitiveWrappersEqual(a, b) {
275
372
  function areRegExpsEqual(a, b) {
276
373
  return a.source === b.source && a.flags === b.flags;
277
374
  }
375
+ /**
376
+ * Whether the search params passed are equal in value.
377
+ *
378
+ * @note
379
+ * Order is not significant, matching how the other unordered collections in the library are
380
+ * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
381
+ * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
382
+ */
383
+ function areSearchParamsEqual(a, b) {
384
+ const serializedA = a.toString();
385
+ const serializedB = b.toString();
386
+ // Identical serializations are equal under any ordering, and this is by far the common case, so
387
+ // it is worth checking before sorting anything.
388
+ return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
389
+ }
278
390
  /**
279
391
  * Whether the `Set`s are equal in value.
280
392
  */
@@ -286,7 +398,7 @@ function areSetsEqual(a, b, state) {
286
398
  if (!size) {
287
399
  return true;
288
400
  }
289
- const matchedIndices = new Uint8Array(size);
401
+ const matchedIndices = new Array(size);
290
402
  const aIterable = a.values();
291
403
  let aResult;
292
404
  let bResult;
@@ -296,7 +408,7 @@ function areSetsEqual(a, b, state) {
296
408
  break;
297
409
  }
298
410
  const bIterable = b.values();
299
- let hasMatch = 0;
411
+ let hasMatch = false;
300
412
  let matchIndex = 0;
301
413
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
302
414
  while ((bResult = bIterable.next())) {
@@ -305,7 +417,7 @@ function areSetsEqual(a, b, state) {
305
417
  }
306
418
  if (!matchedIndices[matchIndex]
307
419
  && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
308
- hasMatch = matchedIndices[matchIndex] = 1;
420
+ hasMatch = matchedIndices[matchIndex] = true;
309
421
  break;
310
422
  }
311
423
  matchIndex++;
@@ -345,6 +457,21 @@ function areTypedArraysEqual(a, b) {
345
457
  }
346
458
  return true;
347
459
  }
460
+ /**
461
+ * Whether the TypedArray instances are equal in value with strict property checking.
462
+ *
463
+ * @note
464
+ * Indexed elements are also own properties, listed first and in order, with descriptors fixed by the
465
+ * spec. They are compared once by `areTypedArraysEqual`, so only the own properties after them
466
+ * (including symbols) are compared with strict property checking.
467
+ */
468
+ function areTypedArraysEqualStrict(a, b, state) {
469
+ if (!areTypedArraysEqual(a, b)) {
470
+ return false;
471
+ }
472
+ const properties = getStrictProperties(a);
473
+ return (getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, a.length));
474
+ }
348
475
  /**
349
476
  * Whether the URL instances are equal in value.
350
477
  */
@@ -363,39 +490,6 @@ function areUrlsEqual(a, b) {
363
490
  && a.hash === b.hash
364
491
  && areSearchParamsEqual(a.searchParams, b.searchParams));
365
492
  }
366
- /**
367
- * Whether the search params passed are equal in value.
368
- *
369
- * @note
370
- * Order is not significant, matching how the other unordered collections in the library are
371
- * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
372
- * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
373
- */
374
- function areSearchParamsEqual(a, b) {
375
- const serializedA = a.toString();
376
- const serializedB = b.toString();
377
- // Identical serializations are equal under any ordering, and this is by far the common case, so
378
- // it is worth checking before sorting anything.
379
- return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
380
- }
381
- /**
382
- * Reorder a serialized query string so that params holding the same pairs compare as equal
383
- * regardless of the order they appear in.
384
- *
385
- * @note
386
- * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
387
- * splitting on `&` recovers exactly the pairs and nothing else.
388
- */
389
- function sortSearchParams(serialized) {
390
- return serialized.split('&').sort().join('&');
391
- }
392
- function isPropertyEqual(a, b, state, property) {
393
- if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)
394
- && (a.$$typeof || b.$$typeof)) {
395
- return true;
396
- }
397
- return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
398
- }
399
493
 
400
494
  const { toString } = Object.prototype;
401
495
  /**
@@ -526,13 +620,11 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
526
620
  areDatesEqual: strict
527
621
  ? combineComparators(areDatesEqual, areObjectsEqualStrict)
528
622
  : areDatesEqual,
529
- // `Error` subclasses routinely carry their own enumerable properties (`status`, `code`, ...),
530
- // which the error comparator alone does not see, so it is composed with the object comparator.
531
- // `name` / `message` / `stack` are own but not enumerable, which is why errors need a
532
- // comparator of their own rather than being treated as plain objects in the first place.
533
- areErrorsEqual: strict
534
- ? combineComparators(areErrorsEqual, areObjectsEqualStrict)
535
- : combineComparators(areErrorsEqual, areObjectsEqual),
623
+ // `name` / `message` / `stack` / `cause` / `errors` are not enumerable (unless assigned), which is why
624
+ // errors need a comparator of their own rather than being treated as plain objects. Each variant also
625
+ // compares the own properties that `Error` subclasses routinely carry (`status`, `code`, ...):
626
+ // enumerable ones in loose mode, and all of them (via `areObjectsEqualStrict`) in strict mode.
627
+ areErrorsEqual: strict ? areErrorsEqualStrict : areErrorsEqual,
536
628
  areFunctionsEqual: strictEqual,
537
629
  areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
538
630
  areNumbersEqual: sameValueEqual,
@@ -540,9 +632,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
540
632
  arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
541
633
  areRegExpsEqual: areRegExpsEqual,
542
634
  areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
543
- areTypedArraysEqual: strict
544
- ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)
545
- : areTypedArraysEqual,
635
+ areTypedArraysEqual: strict ? areTypedArraysEqualStrict : areTypedArraysEqual,
546
636
  areUrlsEqual: areUrlsEqual,
547
637
  getUnsupportedCustomComparator: undefined,
548
638
  strictNullPrototypeComparison,
@@ -559,6 +649,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
559
649
  const areMapsEqual = createIsCircular(config.areMapsEqual);
560
650
  const areObjectsEqual = createIsCircular(config.areObjectsEqual);
561
651
  const areSetsEqual = createIsCircular(config.areSetsEqual);
652
+ const areTypedArraysEqual = strict ? createIsCircular(config.areTypedArraysEqual) : config.areTypedArraysEqual;
562
653
  config = Object.assign({}, config, {
563
654
  areArraysEqual,
564
655
  areDatesEqual,
@@ -566,6 +657,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
566
657
  areMapsEqual,
567
658
  areObjectsEqual,
568
659
  areSetsEqual,
660
+ areTypedArraysEqual,
569
661
  });
570
662
  }
571
663
  return config;
package/dist/es/index.mjs CHANGED
@@ -1,6 +1,38 @@
1
- const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
1
+ const { getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols } = Object;
2
2
  const { hasOwnProperty, toString: toString$1 } = Object.prototype;
3
3
  const OBJECT_TAG = '[object Object]';
4
+ /**
5
+ * Whether the own properties from `end` onward are equal with strict property checking, where the
6
+ * caller has already verified that both objects have the same number of own properties.
7
+ */
8
+ function areStrictPropertiesEqual(a, b, state, properties, end) {
9
+ let index = properties.length;
10
+ let property;
11
+ let descriptorA;
12
+ let descriptorB;
13
+ // Decrementing `while` showed faster results than either incrementing or
14
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
15
+ // methods like `some` / `every` were not used to avoid incurring the garbage
16
+ // cost of anonymous callbacks.
17
+ while (index-- > end) {
18
+ property = properties[index];
19
+ if (!isReactProperty(a, b, property)
20
+ && (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state))) {
21
+ return false;
22
+ }
23
+ descriptorA = getOwnPropertyDescriptor(a, property);
24
+ descriptorB = getOwnPropertyDescriptor(b, property);
25
+ if ((descriptorA || descriptorB)
26
+ && (!descriptorA
27
+ || !descriptorB
28
+ || descriptorA.configurable !== descriptorB.configurable
29
+ || descriptorA.enumerable !== descriptorB.enumerable
30
+ || descriptorA.writable !== descriptorB.writable)) {
31
+ return false;
32
+ }
33
+ }
34
+ return true;
35
+ }
4
36
  /**
5
37
  * Combine two comparators into a single comparators.
6
38
  */
@@ -43,6 +75,10 @@ function getStrictProperties(object) {
43
75
  ? getOwnPropertyNames(object).concat(symbols)
44
76
  : getOwnPropertyNames(object);
45
77
  }
78
+ /**
79
+ * Identify the element type of TypedArrays across realms and subclasses.
80
+ */
81
+ const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
46
82
  /**
47
83
  * Whether the object contains the property passed as an own property.
48
84
  */
@@ -65,15 +101,37 @@ function isNullPrototypeComparable(a, b) {
65
101
  }
66
102
  return false;
67
103
  }
104
+ /**
105
+ * Whether the property passed is a property specific to React/Preact elements. These are ignored in comparison, as they
106
+ * are deeply circular and will return frequent false negatives for the comparison that matters, which is often the
107
+ * React element's aspects (`props`, `type`, etc.).
108
+ */
109
+ function isReactProperty(a, b, property) {
110
+ return (
111
+ // _owner -> React owner
112
+ // __o -> Preact owner
113
+ // __v -> Preact vnode
114
+ (property === '_owner' || property === '__o' || property === '__v') && !!(a.$$typeof || b.$$typeof));
115
+ }
116
+ /**
117
+ * Reorder a serialized query string so that params holding the same pairs compare as equal
118
+ * regardless of the order they appear in.
119
+ *
120
+ * @note
121
+ * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
122
+ * splitting on `&` recovers exactly the pairs and nothing else.
123
+ */
124
+ function sortSearchParams(serialized) {
125
+ return serialized.split('&').sort().join('&');
126
+ }
68
127
 
69
- const PREACT_VNODE = '__v';
70
- const PREACT_OWNER = '__o';
71
- const REACT_OWNER = '_owner';
72
- const { getOwnPropertyDescriptor, keys } = Object;
73
128
  /**
74
- * Identify the element type of TypedArrays across realms and subclasses.
129
+ * Above this many keys, out-of-position keys are checked with `propertyIsEnumerable` rather than by
130
+ * scanning the other object's keys. Measured in V8: scanning wins up to 50 keys and loses from 100.
75
131
  */
76
- const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
132
+ const MAX_SCANNED_PROPERTIES = 64;
133
+ const { keys } = Object;
134
+ const { propertyIsEnumerable } = Object.prototype;
77
135
  /**
78
136
  * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
79
137
  * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
@@ -147,16 +205,68 @@ function areDatesEqual(a, b) {
147
205
  *
148
206
  * @note
149
207
  * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
150
- * explicitly. `cause` is compared by value rather than by reference, matching how every other
151
- * nested value in the comparison is treated. Own enumerable properties (which custom `Error`
152
- * subclasses commonly add) are compared by composing this with the object comparator in the
153
- * comparator config, so that the strict and circular variants apply to them as well.
208
+ * explicitly. `cause` and `errors` are compared by value rather than by reference, matching how
209
+ * every other nested value in the comparison is treated. They are compared exactly once, regardless
210
+ * of whether they were assigned (enumerable) or set by the constructor (non-enumerable). Other own
211
+ * enumerable properties (which custom `Error` subclasses commonly add) are compared afterward.
212
+ *
213
+ * The own property comparison is inlined rather than extracted, which measured faster in V8 when
214
+ * recursing through `cause`. Keep the bytecode under V8's 460-byte TurboFan inlining limit (383 bytes
215
+ * at time of writing; check with `node --print-bytecode --print-bytecode-filter=areErrorsEqual`), or
216
+ * this stops being inlined into its callers.
154
217
  */
155
218
  function areErrorsEqual(a, b, state) {
156
- return (a.name === b.name
157
- && a.message === b.message
158
- && a.stack === b.stack
159
- && state.equals(a.cause, b.cause, 'cause', 'cause', a, b, state));
219
+ if (a.name !== b.name || a.message !== b.message || a.stack !== b.stack) {
220
+ return false;
221
+ }
222
+ const causeA = a.cause;
223
+ const causeB = b.cause;
224
+ if (causeA !== causeB && !state.equals(causeA, causeB, 'cause', 'cause', a, b, state)) {
225
+ return false;
226
+ }
227
+ const errorsA = a.errors;
228
+ const errorsB = b.errors;
229
+ if (errorsA !== errorsB && !state.equals(errorsA, errorsB, 'errors', 'errors', a, b, state)) {
230
+ return false;
231
+ }
232
+ const propertiesA = keys(a);
233
+ const propertiesB = keys(b);
234
+ let index = propertiesA.length;
235
+ // Constructed errors rarely have enumerable own properties.
236
+ if (!index && !propertiesB.length) {
237
+ return true;
238
+ }
239
+ let compared = 0;
240
+ let property;
241
+ while (index-- > 0) {
242
+ property = propertiesA[index];
243
+ // Already compared above regardless of enumerability, so we can ignore them.
244
+ if (property === 'cause' || property === 'errors') {
245
+ continue;
246
+ }
247
+ // `propertyIsEnumerable` rather than `hasOwn`, so that a non-enumerable own property on `b` cannot
248
+ // stand in for an enumerable one. Keys in the same position are trivially enumerable on `b`.
249
+ if ((property !== propertiesB[index] && !propertyIsEnumerable.call(b, property))
250
+ || !state.equals(a[property], b[property], property, property, a, b, state)) {
251
+ return false;
252
+ }
253
+ ++compared;
254
+ }
255
+ // Every compared key is enumerable on `b`, so any of `b`'s keys left over must be `cause` / `errors`.
256
+ const remaining = propertiesB.length - compared;
257
+ return (!remaining
258
+ || remaining === (propertyIsEnumerable.call(b, 'cause') ? 1 : 0) + (propertyIsEnumerable.call(b, 'errors') ? 1 : 0));
259
+ }
260
+ /**
261
+ * Whether the errors passed are equal in value.
262
+ *
263
+ * @note
264
+ * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
265
+ * explicitly. `cause` and `errors` are own properties, so `areObjectsEqualStrict` compares them along
266
+ * with every other own property; they are not compared explicitly to avoid comparing them twice.
267
+ */
268
+ function areErrorsEqualStrict(a, b, state) {
269
+ return a.name === b.name && a.message === b.message && a.stack === b.stack && areObjectsEqualStrict(a, b, state);
160
270
  }
161
271
  /**
162
272
  * Whether the `Map`s are equal in value.
@@ -169,7 +279,7 @@ function areMapsEqual(a, b, state) {
169
279
  if (!size) {
170
280
  return true;
171
281
  }
172
- const matchedIndices = new Uint8Array(size);
282
+ const matchedIndices = new Array(size);
173
283
  const aIterable = a.entries();
174
284
  let aResult;
175
285
  let bResult;
@@ -180,7 +290,7 @@ function areMapsEqual(a, b, state) {
180
290
  break;
181
291
  }
182
292
  const bIterable = b.entries();
183
- let hasMatch = 0;
293
+ let hasMatch = false;
184
294
  let matchIndex = 0;
185
295
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
186
296
  while ((bResult = bIterable.next())) {
@@ -195,7 +305,7 @@ function areMapsEqual(a, b, state) {
195
305
  const bEntry = bResult.value;
196
306
  if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
197
307
  && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
198
- hasMatch = matchedIndices[matchIndex] = 1;
308
+ hasMatch = matchedIndices[matchIndex] = true;
199
309
  break;
200
310
  }
201
311
  matchIndex++;
@@ -212,16 +322,30 @@ function areMapsEqual(a, b, state) {
212
322
  */
213
323
  function areObjectsEqual(a, b, state) {
214
324
  const properties = keys(a);
325
+ const propertiesB = keys(b);
215
326
  let index = properties.length;
216
- if (keys(b).length !== index) {
327
+ if (propertiesB.length !== index) {
217
328
  return false;
218
329
  }
330
+ const isScannable = index <= MAX_SCANNED_PROPERTIES;
331
+ let property;
219
332
  // Decrementing `while` showed faster results than either incrementing or
220
333
  // decrementing `for` loop and than an incrementing `while` loop. Declarative
221
334
  // methods like `some` / `every` were not used to avoid incurring the garbage
222
335
  // cost of anonymous callbacks.
223
336
  while (index-- > 0) {
224
- if (!isPropertyEqual(a, b, state, properties[index])) {
337
+ property = properties[index];
338
+ if (isReactProperty(a, b, property)) {
339
+ continue;
340
+ }
341
+ // Objects built the same way list their keys in the same order, in which case the key is
342
+ // already known to be an own enumerable property of `b` and the lookup can be skipped.
343
+ // Otherwise, `propertiesB` is exactly `b`'s own enumerable keys. Scanning it is faster than
344
+ // `propertyIsEnumerable` for smaller objects, but it is linear per key, so larger objects
345
+ // (where reordering would make it quadratic) use the lookup instead.
346
+ if ((property !== propertiesB[index]
347
+ && !(isScannable ? propertiesB.includes(property) : propertyIsEnumerable.call(b, property)))
348
+ || !state.equals(a[property], b[property], property, property, a, b, state)) {
225
349
  return false;
226
350
  }
227
351
  }
@@ -232,34 +356,7 @@ function areObjectsEqual(a, b, state) {
232
356
  */
233
357
  function areObjectsEqualStrict(a, b, state) {
234
358
  const properties = getStrictProperties(a);
235
- let index = properties.length;
236
- if (getStrictProperties(b).length !== index) {
237
- return false;
238
- }
239
- let property;
240
- let descriptorA;
241
- let descriptorB;
242
- // Decrementing `while` showed faster results than either incrementing or
243
- // decrementing `for` loop and than an incrementing `while` loop. Declarative
244
- // methods like `some` / `every` were not used to avoid incurring the garbage
245
- // cost of anonymous callbacks.
246
- while (index-- > 0) {
247
- property = properties[index];
248
- if (!isPropertyEqual(a, b, state, property)) {
249
- return false;
250
- }
251
- descriptorA = getOwnPropertyDescriptor(a, property);
252
- descriptorB = getOwnPropertyDescriptor(b, property);
253
- if ((descriptorA || descriptorB)
254
- && (!descriptorA
255
- || !descriptorB
256
- || descriptorA.configurable !== descriptorB.configurable
257
- || descriptorA.enumerable !== descriptorB.enumerable
258
- || descriptorA.writable !== descriptorB.writable)) {
259
- return false;
260
- }
261
- }
262
- return true;
359
+ return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, 0);
263
360
  }
264
361
  /**
265
362
  * Whether the primitive wrappers passed are equal in value.
@@ -273,6 +370,21 @@ function arePrimitiveWrappersEqual(a, b) {
273
370
  function areRegExpsEqual(a, b) {
274
371
  return a.source === b.source && a.flags === b.flags;
275
372
  }
373
+ /**
374
+ * Whether the search params passed are equal in value.
375
+ *
376
+ * @note
377
+ * Order is not significant, matching how the other unordered collections in the library are
378
+ * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
379
+ * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
380
+ */
381
+ function areSearchParamsEqual(a, b) {
382
+ const serializedA = a.toString();
383
+ const serializedB = b.toString();
384
+ // Identical serializations are equal under any ordering, and this is by far the common case, so
385
+ // it is worth checking before sorting anything.
386
+ return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
387
+ }
276
388
  /**
277
389
  * Whether the `Set`s are equal in value.
278
390
  */
@@ -284,7 +396,7 @@ function areSetsEqual(a, b, state) {
284
396
  if (!size) {
285
397
  return true;
286
398
  }
287
- const matchedIndices = new Uint8Array(size);
399
+ const matchedIndices = new Array(size);
288
400
  const aIterable = a.values();
289
401
  let aResult;
290
402
  let bResult;
@@ -294,7 +406,7 @@ function areSetsEqual(a, b, state) {
294
406
  break;
295
407
  }
296
408
  const bIterable = b.values();
297
- let hasMatch = 0;
409
+ let hasMatch = false;
298
410
  let matchIndex = 0;
299
411
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
300
412
  while ((bResult = bIterable.next())) {
@@ -303,7 +415,7 @@ function areSetsEqual(a, b, state) {
303
415
  }
304
416
  if (!matchedIndices[matchIndex]
305
417
  && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
306
- hasMatch = matchedIndices[matchIndex] = 1;
418
+ hasMatch = matchedIndices[matchIndex] = true;
307
419
  break;
308
420
  }
309
421
  matchIndex++;
@@ -343,6 +455,21 @@ function areTypedArraysEqual(a, b) {
343
455
  }
344
456
  return true;
345
457
  }
458
+ /**
459
+ * Whether the TypedArray instances are equal in value with strict property checking.
460
+ *
461
+ * @note
462
+ * Indexed elements are also own properties, listed first and in order, with descriptors fixed by the
463
+ * spec. They are compared once by `areTypedArraysEqual`, so only the own properties after them
464
+ * (including symbols) are compared with strict property checking.
465
+ */
466
+ function areTypedArraysEqualStrict(a, b, state) {
467
+ if (!areTypedArraysEqual(a, b)) {
468
+ return false;
469
+ }
470
+ const properties = getStrictProperties(a);
471
+ return (getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, a.length));
472
+ }
346
473
  /**
347
474
  * Whether the URL instances are equal in value.
348
475
  */
@@ -361,39 +488,6 @@ function areUrlsEqual(a, b) {
361
488
  && a.hash === b.hash
362
489
  && areSearchParamsEqual(a.searchParams, b.searchParams));
363
490
  }
364
- /**
365
- * Whether the search params passed are equal in value.
366
- *
367
- * @note
368
- * Order is not significant, matching how the other unordered collections in the library are
369
- * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
370
- * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
371
- */
372
- function areSearchParamsEqual(a, b) {
373
- const serializedA = a.toString();
374
- const serializedB = b.toString();
375
- // Identical serializations are equal under any ordering, and this is by far the common case, so
376
- // it is worth checking before sorting anything.
377
- return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
378
- }
379
- /**
380
- * Reorder a serialized query string so that params holding the same pairs compare as equal
381
- * regardless of the order they appear in.
382
- *
383
- * @note
384
- * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
385
- * splitting on `&` recovers exactly the pairs and nothing else.
386
- */
387
- function sortSearchParams(serialized) {
388
- return serialized.split('&').sort().join('&');
389
- }
390
- function isPropertyEqual(a, b, state, property) {
391
- if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)
392
- && (a.$$typeof || b.$$typeof)) {
393
- return true;
394
- }
395
- return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
396
- }
397
491
 
398
492
  const { toString } = Object.prototype;
399
493
  /**
@@ -524,13 +618,11 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
524
618
  areDatesEqual: strict
525
619
  ? combineComparators(areDatesEqual, areObjectsEqualStrict)
526
620
  : areDatesEqual,
527
- // `Error` subclasses routinely carry their own enumerable properties (`status`, `code`, ...),
528
- // which the error comparator alone does not see, so it is composed with the object comparator.
529
- // `name` / `message` / `stack` are own but not enumerable, which is why errors need a
530
- // comparator of their own rather than being treated as plain objects in the first place.
531
- areErrorsEqual: strict
532
- ? combineComparators(areErrorsEqual, areObjectsEqualStrict)
533
- : combineComparators(areErrorsEqual, areObjectsEqual),
621
+ // `name` / `message` / `stack` / `cause` / `errors` are not enumerable (unless assigned), which is why
622
+ // errors need a comparator of their own rather than being treated as plain objects. Each variant also
623
+ // compares the own properties that `Error` subclasses routinely carry (`status`, `code`, ...):
624
+ // enumerable ones in loose mode, and all of them (via `areObjectsEqualStrict`) in strict mode.
625
+ areErrorsEqual: strict ? areErrorsEqualStrict : areErrorsEqual,
534
626
  areFunctionsEqual: strictEqual,
535
627
  areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
536
628
  areNumbersEqual: sameValueEqual,
@@ -538,9 +630,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
538
630
  arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
539
631
  areRegExpsEqual: areRegExpsEqual,
540
632
  areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
541
- areTypedArraysEqual: strict
542
- ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)
543
- : areTypedArraysEqual,
633
+ areTypedArraysEqual: strict ? areTypedArraysEqualStrict : areTypedArraysEqual,
544
634
  areUrlsEqual: areUrlsEqual,
545
635
  getUnsupportedCustomComparator: undefined,
546
636
  strictNullPrototypeComparison,
@@ -557,6 +647,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
557
647
  const areMapsEqual = createIsCircular(config.areMapsEqual);
558
648
  const areObjectsEqual = createIsCircular(config.areObjectsEqual);
559
649
  const areSetsEqual = createIsCircular(config.areSetsEqual);
650
+ const areTypedArraysEqual = strict ? createIsCircular(config.areTypedArraysEqual) : config.areTypedArraysEqual;
560
651
  config = Object.assign({}, config, {
561
652
  areArraysEqual,
562
653
  areDatesEqual,
@@ -564,6 +655,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
564
655
  areMapsEqual,
565
656
  areObjectsEqual,
566
657
  areSetsEqual,
658
+ areTypedArraysEqual,
567
659
  });
568
660
  }
569
661
  return config;
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "sideEffects": false,
111
111
  "type": "module",
112
112
  "types": "./index.d.ts",
113
- "version": "6.2.0"
113
+ "version": "6.2.2"
114
114
  }