fast-equals 4.0.0-beta.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # fast-equals CHANGELOG
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ #### Certain ES2015 features are now required
8
+
9
+ In previous versions, there were automatic fallbacks for certain ES2015 features if they did not exist:
10
+
11
+ - [`RegExp.prototype.flags`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags)
12
+ - [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
13
+
14
+ Due to the omnipresence of support in both browser and NodeJS, these have been deprecated. There is still an option if you require support for these legacy environments, however; see [`createCustomEqual`](./README.md#createcustomequal) and [`createCustomCircularEqual`](./README.md#createcustomcircularequal) for more details.
15
+
16
+ #### `createCustomEqual` contract has changed
17
+
18
+ To allow more flexibility and customizability for a variety of edge cases, `createCustomEqual` now allows override of specific type value comparisons in addition to the general comparator it did prior. See [the documentation](./README.md#createcustomequal) for more details.
19
+
20
+ ### Enhancements
21
+
22
+ #### `createCustomCircularEqual` added
23
+
24
+ Like `createCustomEqual`, it will create a custom equality comparator, with the exception that it will handle circular references. See [the documentation](./README.md#createcustomcircularequal) for more details.
25
+
26
+ #### Cross-realm comparisons are now supported
27
+
28
+ Prior to `4.x.x.`, `instanceof` was used internally for checking of object classes, which only worked when comparing objects from the same [Realm](https://262.ecma-international.org/6.0/#sec-code-realms). This has changed to instead use an object's [StringTag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag), which is not realm-specific.
29
+
30
+ #### TypeScript typings improved
31
+
32
+ For better typing in edge-case scenarios like custom comparators with `meta` values, typings have been refactored for accuracy and better narrow flow-through.
33
+
3
34
  ## 3.0.3
4
35
 
5
36
  - Fix [#77](https://github.com/planttheidea/fast-equals/issues/73) - better circular object validation
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"/>
5
5
  <img src="https://img.shields.io/badge/license-MIT-blue.svg"/>
6
6
 
7
- Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed. It has no dependencies, and is ~1.23kB when minified and gzipped.
7
+ Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed. It has no dependencies, and is ~1.26kB when minified and gzipped.
8
8
 
9
9
  Unlike most equality validation libraries, the following types are handled out-of-the-box:
10
10
 
@@ -31,6 +31,9 @@ Starting with version `1.5.0`, circular objects are supported for both deep and
31
31
  - [circularDeepEqual](#circulardeepequal)
32
32
  - [circularShallowEqual](#circularshallowequal)
33
33
  - [createCustomEqual](#createcustomequal)
34
+ - [Recipes](#recipes)
35
+ - [`createCustomCircularEqual`](#createcustomcircularequal)
36
+ - [Recipes](#recipes-1)
34
37
  - [Benchmarks](#benchmarks)
35
38
  - [Development](#development)
36
39
 
@@ -199,143 +202,25 @@ The `meta` parameter above is whatever you want it to be. It will be passed thro
199
202
 
200
203
  _**NOTE**: `Map` implementations compare equality for both keys and value. When using a custom comparator and comparing equality of the keys, the iteration index is provided as both `indexOrKeyA` and `indexOrKeyB` to help use-cases where ordering of keys matters to equality._
201
204
 
202
- #### Legacy environment support
205
+ #### Recipes
203
206
 
204
- Starting in `4.x.x`, `RegExp.prototype.flags` is expected to be available in the environment. All modern browsers support this feature, however there may be situations where a legacy environmental support is required (example: IE11). If you need to support such an environment, creating a custom comparator that uses a more verbose comparison of all possible flags is a simple solution.
207
+ Some recipes have been created to provide examples of use-cases for `createCustomEqual`. Even if not directly applicable to the problem you are solving, they can offer guidance of how to structure your solution.
205
208
 
206
- ```ts
207
- import { createCustomEqual, sameValueZeroEqual } from 'deep-Equals';
208
-
209
- function areRegExpsEqual(a: RegExp, b: RegExp): Boolean {
210
- return (
211
- a.source === b.source &&
212
- a.global === b.global &&
213
- a.ignoreCase === b.ignoreCase &&
214
- a.multiline === b.multiline &&
215
- a.unicode === b.unicode &&
216
- a.sticky === b.sticky &&
217
- a.lastIndex === b.lastIndex
218
- );
219
- }
220
-
221
- const deepEqual = createCustomEqual(() => ({ areRegExpEqual }));
222
- const shallowEqual = createCustomEqual(() => ({
223
- areRegExpsEqual,
224
- createIsNestedEqual: () => sameValueZeroEqual,
225
- }));
226
- ```
227
-
228
- #### Custom targeted comparisons
229
-
230
- Sometimes it is necessary to squeeze every once of performance out of your runtime code, and deep equality checks can be a bottleneck. When this is occurs, it can be advantageous to build a custom comparison that allows for highly specific equality checks.
231
-
232
- An example where you know the shape of the objects being passed in, where the `foo` property is a simple primitive and the `bar` property is a nested object:
233
-
234
- ```ts
235
- import { createCustomEqual } from 'fast-equals';
236
-
237
- const isCollectionEqual = createCustomEqual<Meta>({
238
- areObjectsEqual(a, b, isEqual, meta) {
239
- return a.foo === b.foo && isEqual(a.bar, b.bar, meta);
240
- },
241
- });
242
- ```
243
-
244
- This avoids ambiguous iteration and type-checking, which can boost performance in extreme hot-path scenarios.
245
-
246
- Here is another example, with a custom equality comparison that also checks against values in the meta object:
247
-
248
- ```ts
249
- import { createCustomEqual } from 'fast-equals';
250
-
251
- const isDeepEqualOrFooMatchesMeta = createCustomEqual<Meta>(() => ({
252
- createIsNestedEqual(deepEqual) {
253
- return (a, b, keyA, keyB, parentA, parentB, meta) =>
254
- a === meta || b === meta || deepEqual(a, b, meta);
255
- },
256
- }));
257
-
258
- console.log(
259
- 'shallow',
260
- isDeepEqualOrFooMatchesMeta({ foo: 'bar' }, { foo: 'baz' }, 'bar'),
261
- );
262
- console.log(
263
- 'deep',
264
- isDeepEqualOrFooMatchesMeta(
265
- { nested: { foo: 'bar' } },
266
- { nested: { foo: 'baz' } },
267
- 'bar',
268
- ),
269
- ); // true
270
- ```
209
+ - [Legacy environment support for `RegExp` comparators](./recipes/legacy-regexp-support.md)
210
+ - [Explicit property check](./recipes/explicit-property-check.md)
211
+ - [Using `meta` in comparison](./recipes//using-meta-in-comparison.md)
212
+ - [Comparing non-standard properties](./recipes/non-standard-properties.md)
213
+ - [Strict property descriptor comparison](./recipes/strict-equality-checks.md)
271
214
 
272
215
  ### `createCustomCircularEqual`
273
216
 
274
217
  Operates nearly identically to [`createCustomEqual`](#createcustomequal), with the difference being that the `meta` property expected by the comparator is expected to have a `WeakMap` contract. This is because it is used for caching accessed objects to avoid maximum stack exceeded errors. The most common use for this method is a simple way to support circular checks for references that do not have `WeakMap` natively.
275
218
 
276
- #### Legacy environment support
277
-
278
- Starting in `4.x.x`, `WeakMap` is expected to be available in the environment. All modern browsers support this global object, however there may be situations where a legacy environmental support is required (example: IE11). If you need to support such an environment, creating a custom comparator that uses a custom cache implementation with the same contract is a simple solution.
279
-
280
- ```ts
281
- import { createCustomEqual, sameValueZeroEqual } from 'deep-Equals';
219
+ #### Recipes
282
220
 
283
- interface Cache {
284
- delete(key: object): boolean;
285
- get(key: object): any;
286
- set(key: object, value: any);
221
+ Some recipes have been created to provide examples of use-cases for `createCustomEqual`. Even if not directly applicable to the problem you are solving, they can offer guidance of how to structure your solution.
287
222
 
288
- customMethod(): void;
289
- customValue: string;
290
- }
291
-
292
- function getCache(): Cache {
293
- const entries = [];
294
-
295
- return {
296
- delete(key) {
297
- for (let index = 0; index < entries.length; ++index) {
298
- if (entries[index][0] === key) {
299
- entries.splice(index, 1);
300
- return true;
301
- }
302
- }
303
-
304
- return false;
305
- },
306
-
307
- get(key) {
308
- for (let index = 0; index < entries.length; ++index) {
309
- if (entries[index][0] === key) {
310
- return entries[index][1];
311
- }
312
- }
313
- },
314
-
315
- set(key, value) {
316
- for (let index = 0; index < entries.length; ++index) {
317
- if (entries[index][0] === key) {
318
- entries[index][1] = value;
319
- return this;
320
- }
321
- }
322
-
323
- entries.push([key, value]);
324
-
325
- return this;
326
- },
327
-
328
- customMethod() {
329
- console.log('hello!');
330
- },
331
- customValue: 'goodbye',
332
- };
333
- }
334
-
335
- const customCircularHandler = createCustomCircularEqual(() => ({}));
336
-
337
- const circularDeepEqual = (a, b) => customCircularHandler(a, b, getCache());
338
- ```
223
+ - [Legacy environment support for circualr equal comparators](./recipes/legacy-circular-equal-support.md)
339
224
 
340
225
  ## Benchmarks
341
226
 
@@ -412,7 +412,11 @@ function createCustomEqual(getComparatorOptions) {
412
412
  * `WeakMap` out of the box.
413
413
  */
414
414
  function createCustomCircularEqual(getComparatorOptions) {
415
- return createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
415
+ var comparator = createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
416
+ return (function (a, b, meta) {
417
+ if (meta === void 0) { meta = new WeakMap(); }
418
+ return comparator(a, b, meta);
419
+ });
416
420
  }
417
421
 
418
422
  exports.circularDeepEqual = circularDeepEqual;
@@ -1 +1 @@
1
- {"version":3,"file":"fast-equals.cjs.js","sources":["../src/utils.ts","../src/comparator.ts","../src/arrays.ts","../src/dates.ts","../src/maps.ts","../src/objects.ts","../src/regexps.ts","../src/sets.ts","../src/index.ts"],"sourcesContent":["export type InternalEqualityComparator = (\n a: any,\n b: any,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: any,\n) => boolean;\n\nexport type EqualityComparator<Meta> = <A, B>(\n a: A,\n b: B,\n meta?: Meta,\n) => boolean;\n\nexport type EqualityComparatorCreator<Meta> = (\n fn: EqualityComparator<Meta>,\n) => InternalEqualityComparator;\n\nexport type NativeEqualityComparator = <A, B>(a: A, b: B) => boolean;\n\nexport type TypeEqualityComparator<Type, Meta> = (\n a: Type,\n b: Type,\n isEqual: InternalEqualityComparator,\n meta: Meta,\n) => boolean;\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createDefaultIsNestedEqual<Meta>(\n comparator: EqualityComparator<Meta>,\n): InternalEqualityComparator {\n return function isEqual<A, B>(\n a: A,\n b: B,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n ) {\n return comparator(a, b, meta);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular cache, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n isEqual: InternalEqualityComparator,\n cache: WeakMap<any, any>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, isEqual, cache);\n }\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, isEqual, cache);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\n/**\n * Targeted shallow merge of two objects.\n *\n * @NOTE\n * This exists as a tinier compiled version of the `__assign` helper that\n * `tsc` injects in case of `Object.assign` not being present.\n */\nexport function merge<A extends object, B extends object>(a: A, b: B): A & B {\n const merged: Record<string, any> = {};\n\n for (const key in a) {\n merged[key] = a[key];\n }\n\n for (const key in b) {\n merged[key] = b[key];\n }\n\n return merged as A & B;\n}\n\n/**\n * Whether the value is a plain object.\n *\n * @NOTE\n * This is a same-realm compariosn only.\n */\nexport function isPlainObject(value: any): boolean {\n return value.constructor === Object || value.constructor == null;\n}\n\n/**\n * When the value is `Promise`-like, aka \"then-able\".\n */\nexport function isPromiseLike(value: any): boolean {\n return typeof value.then === 'function';\n}\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a === b || (a !== a && b !== b);\n}\n","import { isPlainObject, isPromiseLike, sameValueZeroEqual } from './utils';\n\nimport type {\n EqualityComparator,\n EqualityComparatorCreator,\n TypeEqualityComparator,\n} from './utils';\n\nexport interface CreateComparatorCreatorOptions<Meta> {\n areArraysEqual: TypeEqualityComparator<any[], Meta>;\n areDatesEqual: TypeEqualityComparator<Date, Meta>;\n areMapsEqual: TypeEqualityComparator<Map<any, any>, Meta>;\n areObjectsEqual: TypeEqualityComparator<Record<string, any>, Meta>;\n areRegExpsEqual: TypeEqualityComparator<RegExp, Meta>;\n areSetsEqual: TypeEqualityComparator<Set<any>, Meta>;\n createIsNestedEqual: EqualityComparatorCreator<Meta>;\n}\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { toString } = Object.prototype;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual,\n}: CreateComparatorCreatorOptions<Meta>): EqualityComparator<Meta> {\n const isEqual = createIsNestedEqual(comparator);\n\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n function comparator(a: any, b: any, meta: any): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectsEqual(a, b, isEqual, meta);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = Array.isArray(a);\n const bArray = Array.isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, isEqual, meta);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const aTag = toString.call(a);\n\n if (aTag !== toString.call(b)) {\n return false;\n }\n\n if (aTag === DATE_TAG) {\n // `getTime()` showed better results compared to alternatives like `valueOf()`\n // or the unary `+` operator.\n return areDatesEqual(a, b, isEqual, meta);\n }\n\n if (aTag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === MAP_TAG) {\n return areMapsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === SET_TAG) {\n return areSetsEqual(a, b, isEqual, meta);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class. If an arguments tag, it should be treated as a standard\n // object.\n if (aTag === OBJECT_TAG || aTag === ARGUMENTS_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality.\n return isPromiseLike(a) || isPromiseLike(b)\n ? a === b\n : areObjectsEqual(a, b, isEqual, meta);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (aTag === BOOLEAN_TAG || aTag === NUMBER_TAG || aTag === STRING_TAG) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n }\n\n // If not matching any tags that require a specific type of comparison, then use strict\n // equality. This is for a few reasons:\n // - For types that cannot be introspected (`Promise`, `WeakMap`, etc.), this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases.\n // - For types that can be introspected, but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision was to be conservative.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return a === b;\n }\n\n return comparator;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(\n a: any[],\n b: any[],\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isEqual(a[index], b[index], index, index, a, b, meta)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the arrays are equal in value, including circular references.\n */\nexport const areArraysEqualCircular = createIsCircular(areArraysEqual);\n","import { sameValueZeroEqual } from './utils';\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n isEqual(aKey, bKey, indexA, matchIndexB, a, b, meta) &&\n isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Map`s are equal in value, including circular references.\n */\nexport const areMapsEqualCircular = createIsCircular(areMapsEqual);\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\ninterface Dictionary<Value> {\n [key: string]: Value;\n}\n\nconst OWNER = '_owner';\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary<any>,\n b: Dictionary<any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n const keysA = Object.keys(a);\n\n let index = keysA.length;\n\n if (Object.keys(b).length !== index) {\n return false;\n }\n\n let key: string;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n key = keysA[index];\n\n if (key === OWNER) {\n const reactElementA = !!a.$$typeof;\n const reactElementB = !!b.$$typeof;\n\n if ((reactElementA || reactElementB) && reactElementA !== reactElementB) {\n return false;\n }\n }\n\n if (\n !hasOwnProperty.call(b, key) ||\n !isEqual(a[key], b[key], key, key, a, b, meta)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value, including circular references.\n */\nexport const areObjectsEqualCircular = createIsCircular(areObjectsEqual);\n","/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Set`s are equal in value, including circular references.\n */\nexport const areSetsEqualCircular = createIsCircular(areSetsEqual);\n","import { createComparator } from './comparator';\nimport { areArraysEqual, areArraysEqualCircular } from './arrays';\nimport { areDatesEqual } from './dates';\nimport { areMapsEqual, areMapsEqualCircular } from './maps';\nimport { areObjectsEqual, areObjectsEqualCircular } from './objects';\nimport { areRegExpsEqual } from './regexps';\nimport { areSetsEqual, areSetsEqualCircular } from './sets';\nimport {\n createDefaultIsNestedEqual,\n EqualityComparator,\n merge,\n sameValueZeroEqual,\n} from './utils';\n\nimport type { CreateComparatorCreatorOptions } from './comparator';\n\nexport { sameValueZeroEqual };\n\nexport type { CreateComparatorCreatorOptions } from './comparator';\nexport type {\n EqualityComparator,\n EqualityComparatorCreator,\n InternalEqualityComparator,\n NativeEqualityComparator,\n} from './utils';\n\nexport type BaseCircularMeta = Pick<\n WeakMap<any, any>,\n 'delete' | 'get' | 'set'\n>;\n\nexport type GetComparatorOptions<Meta> = (\n defaultOptions: CreateComparatorCreatorOptions<Meta>,\n) => Partial<CreateComparatorCreatorOptions<Meta>>;\n\nconst DEFAULT_CONFIG: CreateComparatorCreatorOptions<undefined> = Object.freeze(\n {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual: createDefaultIsNestedEqual,\n },\n);\nconst DEFAULT_CIRCULAR_CONFIG: CreateComparatorCreatorOptions<\n WeakMap<object, any>\n> = Object.freeze(\n merge(DEFAULT_CONFIG, {\n areArraysEqual: areArraysEqualCircular,\n areMapsEqual: areMapsEqualCircular,\n areObjectsEqual: areObjectsEqualCircular,\n areSetsEqual: areSetsEqualCircular,\n }),\n);\n\nconst isDeepEqual = createComparator(DEFAULT_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport function deepEqual<A, B>(a: A, b: B): boolean {\n return isDeepEqual(a, b, undefined);\n}\n\nconst isShallowEqual = createComparator(\n merge(DEFAULT_CONFIG, { createIsNestedEqual: () => sameValueZeroEqual }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport function shallowEqual<A, B>(a: A, b: B): boolean {\n return isShallowEqual(a, b, undefined);\n}\n\nconst isCircularDeepEqual = createComparator(DEFAULT_CIRCULAR_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport function circularDeepEqual<A, B>(a: A, b: B): boolean {\n return isCircularDeepEqual(a, b, new WeakMap());\n}\n\nconst isCircularShallowEqual = createComparator(\n merge(DEFAULT_CIRCULAR_CONFIG, {\n createIsNestedEqual: () => sameValueZeroEqual,\n }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport function circularShallowEqual<A, B>(a: A, b: B): boolean {\n return isCircularShallowEqual(a, b, new WeakMap());\n}\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(DEFAULT_CONFIG, getComparatorOptions(DEFAULT_CONFIG)),\n );\n}\n\n/**\n * Create a custom equality comparison method that handles circular references. This is very\n * similar to `createCustomEqual`, with the only difference being that `meta` expects to be\n * populated with a `WeakMap`-like contract.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `WeakMap` out of the box.\n */\nexport function createCustomCircularEqual<Meta extends BaseCircularMeta>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(\n DEFAULT_CIRCULAR_CONFIG,\n getComparatorOptions(DEFAULT_CIRCULAR_CONFIG as any),\n ),\n );\n}\n"],"names":[],"mappings":";;;;AA6BA;;;AAGG;AACG,SAAU,0BAA0B,CACxC,UAAoC,EAAA;AAEpC,IAAA,OAAO,SAAS,OAAO,CACrB,CAAI,EACJ,CAAI,EACJ,WAAgB,EAChB,WAAgB,EAChB,OAAY,EACZ,OAAY,EACZ,IAAU,EAAA;QAEV,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,I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D,CACF,CAAC;AACJ;;;;;;;;;;"}
1
+ {"version":3,"file":"fast-equals.cjs.js","sources":["../src/utils.ts","../src/comparator.ts","../src/arrays.ts","../src/dates.ts","../src/maps.ts","../src/objects.ts","../src/regexps.ts","../src/sets.ts","../src/index.ts"],"sourcesContent":["export type InternalEqualityComparator<Meta> = (\n a: any,\n b: any,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n) => boolean;\n\nexport type EqualityComparator<Meta> = Meta extends undefined\n ? <A, B>(a: A, b: B, meta?: Meta) => boolean\n : <A, B>(a: A, b: B, meta: Meta) => boolean;\n\nexport type EqualityComparatorCreator<Meta> = (\n fn: EqualityComparator<Meta>,\n) => InternalEqualityComparator<Meta>;\n\nexport type NativeEqualityComparator = <A, B>(a: A, b: B) => boolean;\n\nexport type TypeEqualityComparator<Type, Meta> = (\n a: Type,\n b: Type,\n isEqual: InternalEqualityComparator<Meta>,\n meta: Meta,\n) => boolean;\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createDefaultIsNestedEqual<Meta>(\n comparator: EqualityComparator<Meta>,\n): InternalEqualityComparator<Meta> {\n return function isEqual<A, B>(\n a: A,\n b: B,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n ) {\n return comparator(a, b, meta);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular cache, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n isEqual: InternalEqualityComparator<WeakMap<any, any>>,\n cache: WeakMap<any, any>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, isEqual, cache);\n }\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, isEqual, cache);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\n/**\n * Targeted shallow merge of two objects.\n *\n * @NOTE\n * This exists as a tinier compiled version of the `__assign` helper that\n * `tsc` injects in case of `Object.assign` not being present.\n */\nexport function merge<A extends object, B extends object>(a: A, b: B): A & B {\n const merged: Record<string, any> = {};\n\n for (const key in a) {\n merged[key] = a[key];\n }\n\n for (const key in b) {\n merged[key] = b[key];\n }\n\n return merged as A & B;\n}\n\n/**\n * Whether the value is a plain object.\n *\n * @NOTE\n * This is a same-realm compariosn only.\n */\nexport function isPlainObject(value: any): boolean {\n return value.constructor === Object || value.constructor == null;\n}\n\n/**\n * When the value is `Promise`-like, aka \"then-able\".\n */\nexport function isPromiseLike(value: any): boolean {\n return typeof value.then === 'function';\n}\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a === b || (a !== a && b !== b);\n}\n","import { isPlainObject, isPromiseLike, sameValueZeroEqual } from './utils';\n\nimport type {\n EqualityComparator,\n EqualityComparatorCreator,\n TypeEqualityComparator,\n} from './utils';\n\nexport interface CreateComparatorCreatorOptions<Meta> {\n areArraysEqual: TypeEqualityComparator<any[], Meta>;\n areDatesEqual: TypeEqualityComparator<Date, Meta>;\n areMapsEqual: TypeEqualityComparator<Map<any, any>, Meta>;\n areObjectsEqual: TypeEqualityComparator<Record<string, any>, Meta>;\n areRegExpsEqual: TypeEqualityComparator<RegExp, Meta>;\n areSetsEqual: TypeEqualityComparator<Set<any>, Meta>;\n createIsNestedEqual: EqualityComparatorCreator<Meta>;\n}\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { toString } = Object.prototype;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual,\n}: CreateComparatorCreatorOptions<Meta>): EqualityComparator<Meta> {\n const isEqual = createIsNestedEqual(comparator as EqualityComparator<Meta>);\n\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n function comparator(a: any, b: any, meta: Meta): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectsEqual(a, b, isEqual, meta);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = Array.isArray(a);\n const bArray = Array.isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, isEqual, meta);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const aTag = toString.call(a);\n\n if (aTag !== toString.call(b)) {\n return false;\n }\n\n if (aTag === DATE_TAG) {\n // `getTime()` showed better results compared to alternatives like `valueOf()`\n // or the unary `+` operator.\n return areDatesEqual(a, b, isEqual, meta);\n }\n\n if (aTag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === MAP_TAG) {\n return areMapsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === SET_TAG) {\n return areSetsEqual(a, b, isEqual, meta);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class. If an arguments tag, it should be treated as a standard\n // object.\n if (aTag === OBJECT_TAG || aTag === ARGUMENTS_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality.\n return isPromiseLike(a) || isPromiseLike(b)\n ? a === b\n : areObjectsEqual(a, b, isEqual, meta);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (aTag === BOOLEAN_TAG || aTag === NUMBER_TAG || aTag === STRING_TAG) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n }\n\n // If not matching any tags that require a specific type of comparison, then use strict\n // equality. This is for a few reasons:\n // - For types that cannot be introspected (`Promise`, `WeakMap`, etc.), this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases.\n // - For types that can be introspected, but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision was to be conservative.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return a === b;\n }\n\n return comparator as EqualityComparator<Meta>;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(\n a: any[],\n b: any[],\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isEqual(a[index], b[index], index, index, a, b, meta)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the arrays are equal in value, including circular references.\n */\nexport const areArraysEqualCircular = createIsCircular(areArraysEqual);\n","import { sameValueZeroEqual } from './utils';\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n isEqual(aKey, bKey, indexA, matchIndexB, a, b, meta) &&\n isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Map`s are equal in value, including circular references.\n */\nexport const areMapsEqualCircular = createIsCircular(areMapsEqual);\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\ninterface Dictionary<Value> {\n [key: string]: Value;\n}\n\nconst OWNER = '_owner';\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary<any>,\n b: Dictionary<any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n const keysA = Object.keys(a);\n\n let index = keysA.length;\n\n if (Object.keys(b).length !== index) {\n return false;\n }\n\n let key: string;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n key = keysA[index];\n\n if (key === OWNER) {\n const reactElementA = !!a.$$typeof;\n const reactElementB = !!b.$$typeof;\n\n if ((reactElementA || reactElementB) && reactElementA !== reactElementB) {\n return false;\n }\n }\n\n if (\n !hasOwnProperty.call(b, key) ||\n !isEqual(a[key], b[key], key, key, a, b, meta)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value, including circular references.\n */\nexport const areObjectsEqualCircular = createIsCircular(areObjectsEqual);\n","/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Set`s are equal in value, including circular references.\n */\nexport const areSetsEqualCircular = createIsCircular(areSetsEqual);\n","import { createComparator } from './comparator';\nimport { areArraysEqual, areArraysEqualCircular } from './arrays';\nimport { areDatesEqual } from './dates';\nimport { areMapsEqual, areMapsEqualCircular } from './maps';\nimport { areObjectsEqual, areObjectsEqualCircular } from './objects';\nimport { areRegExpsEqual } from './regexps';\nimport { areSetsEqual, areSetsEqualCircular } from './sets';\nimport {\n createDefaultIsNestedEqual,\n EqualityComparator,\n merge,\n sameValueZeroEqual,\n} from './utils';\n\nimport type { CreateComparatorCreatorOptions } from './comparator';\n\nexport { sameValueZeroEqual };\n\nexport type { CreateComparatorCreatorOptions } from './comparator';\nexport type {\n EqualityComparator,\n EqualityComparatorCreator,\n InternalEqualityComparator,\n NativeEqualityComparator,\n TypeEqualityComparator,\n} from './utils';\n\nexport type BaseCircularMeta = Pick<\n WeakMap<any, any>,\n 'delete' | 'get' | 'set'\n>;\n\nexport type GetComparatorOptions<Meta> = (\n defaultOptions: CreateComparatorCreatorOptions<Meta>,\n) => Partial<CreateComparatorCreatorOptions<Meta>>;\n\nconst DEFAULT_CONFIG: CreateComparatorCreatorOptions<undefined> = Object.freeze(\n {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual: createDefaultIsNestedEqual,\n },\n);\nconst DEFAULT_CIRCULAR_CONFIG: CreateComparatorCreatorOptions<\n WeakMap<object, any>\n> = Object.freeze(\n merge(DEFAULT_CONFIG, {\n areArraysEqual: areArraysEqualCircular,\n areMapsEqual: areMapsEqualCircular,\n areObjectsEqual: areObjectsEqualCircular,\n areSetsEqual: areSetsEqualCircular,\n }),\n);\n\nconst isDeepEqual = createComparator(DEFAULT_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport function deepEqual<A, B>(a: A, b: B): boolean {\n return isDeepEqual(a, b, undefined);\n}\n\nconst isShallowEqual = createComparator(\n merge(DEFAULT_CONFIG, { createIsNestedEqual: () => sameValueZeroEqual }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport function shallowEqual<A, B>(a: A, b: B): boolean {\n return isShallowEqual(a, b, undefined);\n}\n\nconst isCircularDeepEqual = createComparator(DEFAULT_CIRCULAR_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport function circularDeepEqual<A, B>(a: A, b: B): boolean {\n return isCircularDeepEqual(a, b, new WeakMap());\n}\n\nconst isCircularShallowEqual = createComparator(\n merge(DEFAULT_CIRCULAR_CONFIG, {\n createIsNestedEqual: () => sameValueZeroEqual,\n }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport function circularShallowEqual<A, B>(a: A, b: B): boolean {\n return isCircularShallowEqual(a, b, new WeakMap());\n}\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta = undefined>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(DEFAULT_CONFIG, getComparatorOptions(DEFAULT_CONFIG)),\n );\n}\n\n/**\n * Create a custom equality comparison method that handles circular references. This is very\n * similar to `createCustomEqual`, with the only difference being that `meta` expects to be\n * populated with a `WeakMap`-like contract.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `WeakMap` out of the box.\n */\nexport function createCustomCircularEqual<\n Meta extends BaseCircularMeta = WeakMap<any, any>,\n>(getComparatorOptions: GetComparatorOptions<Meta>): EqualityComparator<Meta> {\n const comparator = createComparator<Meta>(\n merge(\n DEFAULT_CIRCULAR_CONFIG,\n getComparatorOptions(DEFAULT_CIRCULAR_CONFIG as any),\n ),\n );\n\n return ((a: any, b: any, meta: any = new WeakMap()) =>\n comparator(a, b, meta)) as EqualityComparator<Meta>;\n}\n"],"names":[],"mappings":";;;;AA2BA;;;AAGG;AACG,SAAU,0BAA0B,CACxC,UAAoC,EAAA;AAEpC,IAAA,OAAO,SAAS,OAAO,CACrB,CAAI,EACJ,CAAI,EACJ,WAAgB,EAChB,WAAgB,EAChB,OAAY,EACZ,OAAY,EACZ,IAAU,EAAA;QAEV,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAChC,KAAC,CAAC;AACJ,CAAC;AAED;;;;AAIG;AACG,SAAU,gBAAgB,CAE9B,aAA4B,EAAA;IAC5B,OAAO,SAAS,UAAU,CACxB,CAAM,EACN,CAAM,EACN,OAAsD,EACtD,KAAwB,EAAA;AAExB,QAAA,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YAC9D,OAAO,aAAa,CAAC,CAAC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getComparatorOptions) {
408
408
  * `WeakMap` out of the box.
409
409
  */
410
410
  function createCustomCircularEqual(getComparatorOptions) {
411
- return createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
411
+ var comparator = createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
412
+ return (function (a, b, meta) {
413
+ if (meta === void 0) { meta = new WeakMap(); }
414
+ return comparator(a, b, meta);
415
+ });
412
416
  }
413
417
 
414
418
  export { circularDeepEqual, circularShallowEqual, createCustomCircularEqual, createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual };
@@ -1 +1 @@
1
- {"version":3,"file":"fast-equals.esm.js","sources":["../src/utils.ts","../src/comparator.ts","../src/arrays.ts","../src/dates.ts","../src/maps.ts","../src/objects.ts","../src/regexps.ts","../src/sets.ts","../src/index.ts"],"sourcesContent":["export type InternalEqualityComparator = (\n a: any,\n b: any,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: any,\n) => boolean;\n\nexport type EqualityComparator<Meta> = <A, B>(\n a: A,\n b: B,\n meta?: Meta,\n) => boolean;\n\nexport type EqualityComparatorCreator<Meta> = (\n fn: EqualityComparator<Meta>,\n) => InternalEqualityComparator;\n\nexport type NativeEqualityComparator = <A, B>(a: A, b: B) => boolean;\n\nexport type TypeEqualityComparator<Type, Meta> = (\n a: Type,\n b: Type,\n isEqual: InternalEqualityComparator,\n meta: Meta,\n) => boolean;\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createDefaultIsNestedEqual<Meta>(\n comparator: EqualityComparator<Meta>,\n): InternalEqualityComparator {\n return function isEqual<A, B>(\n a: A,\n b: B,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n ) {\n return comparator(a, b, meta);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular cache, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n isEqual: InternalEqualityComparator,\n cache: WeakMap<any, any>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, isEqual, cache);\n }\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, isEqual, cache);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\n/**\n * Targeted shallow merge of two objects.\n *\n * @NOTE\n * This exists as a tinier compiled version of the `__assign` helper that\n * `tsc` injects in case of `Object.assign` not being present.\n */\nexport function merge<A extends object, B extends object>(a: A, b: B): A & B {\n const merged: Record<string, any> = {};\n\n for (const key in a) {\n merged[key] = a[key];\n }\n\n for (const key in b) {\n merged[key] = b[key];\n }\n\n return merged as A & B;\n}\n\n/**\n * Whether the value is a plain object.\n *\n * @NOTE\n * This is a same-realm compariosn only.\n */\nexport function isPlainObject(value: any): boolean {\n return value.constructor === Object || value.constructor == null;\n}\n\n/**\n * When the value is `Promise`-like, aka \"then-able\".\n */\nexport function isPromiseLike(value: any): boolean {\n return typeof value.then === 'function';\n}\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a === b || (a !== a && b !== b);\n}\n","import { isPlainObject, isPromiseLike, sameValueZeroEqual } from './utils';\n\nimport type {\n EqualityComparator,\n EqualityComparatorCreator,\n TypeEqualityComparator,\n} from './utils';\n\nexport interface CreateComparatorCreatorOptions<Meta> {\n areArraysEqual: TypeEqualityComparator<any[], Meta>;\n areDatesEqual: TypeEqualityComparator<Date, Meta>;\n areMapsEqual: TypeEqualityComparator<Map<any, any>, Meta>;\n areObjectsEqual: TypeEqualityComparator<Record<string, any>, Meta>;\n areRegExpsEqual: TypeEqualityComparator<RegExp, Meta>;\n areSetsEqual: TypeEqualityComparator<Set<any>, Meta>;\n createIsNestedEqual: EqualityComparatorCreator<Meta>;\n}\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { toString } = Object.prototype;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual,\n}: CreateComparatorCreatorOptions<Meta>): EqualityComparator<Meta> {\n const isEqual = createIsNestedEqual(comparator);\n\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n function comparator(a: any, b: any, meta: any): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectsEqual(a, b, isEqual, meta);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = Array.isArray(a);\n const bArray = Array.isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, isEqual, meta);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const aTag = toString.call(a);\n\n if (aTag !== toString.call(b)) {\n return false;\n }\n\n if (aTag === DATE_TAG) {\n // `getTime()` showed better results compared to alternatives like `valueOf()`\n // or the unary `+` operator.\n return areDatesEqual(a, b, isEqual, meta);\n }\n\n if (aTag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === MAP_TAG) {\n return areMapsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === SET_TAG) {\n return areSetsEqual(a, b, isEqual, meta);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class. If an arguments tag, it should be treated as a standard\n // object.\n if (aTag === OBJECT_TAG || aTag === ARGUMENTS_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality.\n return isPromiseLike(a) || isPromiseLike(b)\n ? a === b\n : areObjectsEqual(a, b, isEqual, meta);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (aTag === BOOLEAN_TAG || aTag === NUMBER_TAG || aTag === STRING_TAG) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n }\n\n // If not matching any tags that require a specific type of comparison, then use strict\n // equality. This is for a few reasons:\n // - For types that cannot be introspected (`Promise`, `WeakMap`, etc.), this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases.\n // - For types that can be introspected, but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision was to be conservative.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return a === b;\n }\n\n return comparator;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(\n a: any[],\n b: any[],\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isEqual(a[index], b[index], index, index, a, b, meta)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the arrays are equal in value, including circular references.\n */\nexport const areArraysEqualCircular = createIsCircular(areArraysEqual);\n","import { sameValueZeroEqual } from './utils';\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n isEqual(aKey, bKey, indexA, matchIndexB, a, b, meta) &&\n isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Map`s are equal in value, including circular references.\n */\nexport const areMapsEqualCircular = createIsCircular(areMapsEqual);\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\ninterface Dictionary<Value> {\n [key: string]: Value;\n}\n\nconst OWNER = '_owner';\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary<any>,\n b: Dictionary<any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n const keysA = Object.keys(a);\n\n let index = keysA.length;\n\n if (Object.keys(b).length !== index) {\n return false;\n }\n\n let key: string;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n key = keysA[index];\n\n if (key === OWNER) {\n const reactElementA = !!a.$$typeof;\n const reactElementB = !!b.$$typeof;\n\n if ((reactElementA || reactElementB) && reactElementA !== reactElementB) {\n return false;\n }\n }\n\n if (\n !hasOwnProperty.call(b, key) ||\n !isEqual(a[key], b[key], key, key, a, b, meta)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value, including circular references.\n */\nexport const areObjectsEqualCircular = createIsCircular(areObjectsEqual);\n","/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n isEqual: InternalEqualityComparator,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Set`s are equal in value, including circular references.\n */\nexport const areSetsEqualCircular = createIsCircular(areSetsEqual);\n","import { createComparator } from './comparator';\nimport { areArraysEqual, areArraysEqualCircular } from './arrays';\nimport { areDatesEqual } from './dates';\nimport { areMapsEqual, areMapsEqualCircular } from './maps';\nimport { areObjectsEqual, areObjectsEqualCircular } from './objects';\nimport { areRegExpsEqual } from './regexps';\nimport { areSetsEqual, areSetsEqualCircular } from './sets';\nimport {\n createDefaultIsNestedEqual,\n EqualityComparator,\n merge,\n sameValueZeroEqual,\n} from './utils';\n\nimport type { CreateComparatorCreatorOptions } from './comparator';\n\nexport { sameValueZeroEqual };\n\nexport type { CreateComparatorCreatorOptions } from './comparator';\nexport type {\n EqualityComparator,\n EqualityComparatorCreator,\n InternalEqualityComparator,\n NativeEqualityComparator,\n} from './utils';\n\nexport type BaseCircularMeta = Pick<\n WeakMap<any, any>,\n 'delete' | 'get' | 'set'\n>;\n\nexport type GetComparatorOptions<Meta> = (\n defaultOptions: CreateComparatorCreatorOptions<Meta>,\n) => Partial<CreateComparatorCreatorOptions<Meta>>;\n\nconst DEFAULT_CONFIG: CreateComparatorCreatorOptions<undefined> = Object.freeze(\n {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual: createDefaultIsNestedEqual,\n },\n);\nconst DEFAULT_CIRCULAR_CONFIG: CreateComparatorCreatorOptions<\n WeakMap<object, any>\n> = Object.freeze(\n merge(DEFAULT_CONFIG, {\n areArraysEqual: areArraysEqualCircular,\n areMapsEqual: areMapsEqualCircular,\n areObjectsEqual: areObjectsEqualCircular,\n areSetsEqual: areSetsEqualCircular,\n }),\n);\n\nconst isDeepEqual = createComparator(DEFAULT_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport function deepEqual<A, B>(a: A, b: B): boolean {\n return isDeepEqual(a, b, undefined);\n}\n\nconst isShallowEqual = createComparator(\n merge(DEFAULT_CONFIG, { createIsNestedEqual: () => sameValueZeroEqual }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport function shallowEqual<A, B>(a: A, b: B): boolean {\n return isShallowEqual(a, b, undefined);\n}\n\nconst isCircularDeepEqual = createComparator(DEFAULT_CIRCULAR_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport function circularDeepEqual<A, B>(a: A, b: B): boolean {\n return isCircularDeepEqual(a, b, new WeakMap());\n}\n\nconst isCircularShallowEqual = createComparator(\n merge(DEFAULT_CIRCULAR_CONFIG, {\n createIsNestedEqual: () => sameValueZeroEqual,\n }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport function circularShallowEqual<A, B>(a: A, b: B): boolean {\n return isCircularShallowEqual(a, b, new WeakMap());\n}\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(DEFAULT_CONFIG, getComparatorOptions(DEFAULT_CONFIG)),\n );\n}\n\n/**\n * Create a custom equality comparison method that handles circular references. This is very\n * similar to `createCustomEqual`, with the only difference being that `meta` expects to be\n * populated with a `WeakMap`-like contract.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `WeakMap` out of the box.\n */\nexport function createCustomCircularEqual<Meta extends BaseCircularMeta>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(\n DEFAULT_CIRCULAR_CONFIG,\n getComparatorOptions(DEFAULT_CIRCULAR_CONFIG as any),\n ),\n );\n}\n"],"names":[],"mappings":"AA6BA;;;AAGG;AACG,SAAU,0BAA0B,CACxC,UAAoC,EAAA;AAEpC,IAAA,OAAO,SAAS,OAAO,CACrB,CAAI,EACJ,CAAI,EACJ,WAAgB,EAChB,WAAgB,EAChB,OAAY,EACZ,OAAY,EACZ,IAAU,EAAA;QAEV,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAChC,KAAC,CAAC;AACJ,CAAC;AAED;;;;AAIG;AACG,SAAU,gBAAgB,CAE9B,aAA4B,EAAA;IAC5B,OAAO,SAAS,UAAU,CACxB,CAAM,EACN,CAAM,EACN,OAAmC,EACnC,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B,EAAE,YAAA,EAAM,OAAA,kBAAkB,CAAA,EAAA,EAAE,CAAC,CACzE,CAAC;AAEF;;AAEG;AACa,SAAA,YAAY,CAAO,CAAI,EAAE,CAAI,EAAA;IAC3C,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC;AAED,IAAM,mBAAmB,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;AAEtE;;AAEG;AACa,SAAA,iBAAiB,CAAO,CAAI,EAAE,CAAI,EAAA;IAChD,OAAO,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,IAAM,sBAAsB,GAAG,gBAAgB,CAC7C,KAAK,CAAC,uBAAuB,EAAE;AAC7B,IAAA,mBAAmB,EAAE,YAAA,EAAM,OAAA,kBAAkB,GAAA;AAC9C,CAAA,CAAC,CACH,CAAC;AAEF;;AAEG;AACa,SAAA,oBAAoB,CAAO,CAAI,EAAE,CAAI,EAAA;IACnD,OAAO,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAC/B,oBAAgD,EAAA;AAEhD,IAAA,OAAO,gBAAgB,CACrB,KAAK,CAAC,cAAc,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED;;;;;;;;;AASG;AACG,SAAU,yBAAyB,CACvC,oBAAgD,EAAA;AAEhD,IAAA,OAAO,gBAAgB,CACrB,KAAK,CACH,uBAAuB,EACvB,oBAAoB,CAAC,uBAA8B,CAAC,CACrD,CACF,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"fast-equals.esm.js","sources":["../src/utils.ts","../src/comparator.ts","../src/arrays.ts","../src/dates.ts","../src/maps.ts","../src/objects.ts","../src/regexps.ts","../src/sets.ts","../src/index.ts"],"sourcesContent":["export type InternalEqualityComparator<Meta> = (\n a: any,\n b: any,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n) => boolean;\n\nexport type EqualityComparator<Meta> = Meta extends undefined\n ? <A, B>(a: A, b: B, meta?: Meta) => boolean\n : <A, B>(a: A, b: B, meta: Meta) => boolean;\n\nexport type EqualityComparatorCreator<Meta> = (\n fn: EqualityComparator<Meta>,\n) => InternalEqualityComparator<Meta>;\n\nexport type NativeEqualityComparator = <A, B>(a: A, b: B) => boolean;\n\nexport type TypeEqualityComparator<Type, Meta> = (\n a: Type,\n b: Type,\n isEqual: InternalEqualityComparator<Meta>,\n meta: Meta,\n) => boolean;\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createDefaultIsNestedEqual<Meta>(\n comparator: EqualityComparator<Meta>,\n): InternalEqualityComparator<Meta> {\n return function isEqual<A, B>(\n a: A,\n b: B,\n indexOrKeyA: any,\n indexOrKeyB: any,\n parentA: any,\n parentB: any,\n meta: Meta,\n ) {\n return comparator(a, b, meta);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular cache, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n isEqual: InternalEqualityComparator<WeakMap<any, any>>,\n cache: WeakMap<any, any>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, isEqual, cache);\n }\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, isEqual, cache);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\n/**\n * Targeted shallow merge of two objects.\n *\n * @NOTE\n * This exists as a tinier compiled version of the `__assign` helper that\n * `tsc` injects in case of `Object.assign` not being present.\n */\nexport function merge<A extends object, B extends object>(a: A, b: B): A & B {\n const merged: Record<string, any> = {};\n\n for (const key in a) {\n merged[key] = a[key];\n }\n\n for (const key in b) {\n merged[key] = b[key];\n }\n\n return merged as A & B;\n}\n\n/**\n * Whether the value is a plain object.\n *\n * @NOTE\n * This is a same-realm compariosn only.\n */\nexport function isPlainObject(value: any): boolean {\n return value.constructor === Object || value.constructor == null;\n}\n\n/**\n * When the value is `Promise`-like, aka \"then-able\".\n */\nexport function isPromiseLike(value: any): boolean {\n return typeof value.then === 'function';\n}\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a === b || (a !== a && b !== b);\n}\n","import { isPlainObject, isPromiseLike, sameValueZeroEqual } from './utils';\n\nimport type {\n EqualityComparator,\n EqualityComparatorCreator,\n TypeEqualityComparator,\n} from './utils';\n\nexport interface CreateComparatorCreatorOptions<Meta> {\n areArraysEqual: TypeEqualityComparator<any[], Meta>;\n areDatesEqual: TypeEqualityComparator<Date, Meta>;\n areMapsEqual: TypeEqualityComparator<Map<any, any>, Meta>;\n areObjectsEqual: TypeEqualityComparator<Record<string, any>, Meta>;\n areRegExpsEqual: TypeEqualityComparator<RegExp, Meta>;\n areSetsEqual: TypeEqualityComparator<Set<any>, Meta>;\n createIsNestedEqual: EqualityComparatorCreator<Meta>;\n}\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { toString } = Object.prototype;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual,\n}: CreateComparatorCreatorOptions<Meta>): EqualityComparator<Meta> {\n const isEqual = createIsNestedEqual(comparator as EqualityComparator<Meta>);\n\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n function comparator(a: any, b: any, meta: Meta): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectsEqual(a, b, isEqual, meta);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = Array.isArray(a);\n const bArray = Array.isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, isEqual, meta);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const aTag = toString.call(a);\n\n if (aTag !== toString.call(b)) {\n return false;\n }\n\n if (aTag === DATE_TAG) {\n // `getTime()` showed better results compared to alternatives like `valueOf()`\n // or the unary `+` operator.\n return areDatesEqual(a, b, isEqual, meta);\n }\n\n if (aTag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === MAP_TAG) {\n return areMapsEqual(a, b, isEqual, meta);\n }\n\n if (aTag === SET_TAG) {\n return areSetsEqual(a, b, isEqual, meta);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class. If an arguments tag, it should be treated as a standard\n // object.\n if (aTag === OBJECT_TAG || aTag === ARGUMENTS_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality.\n return isPromiseLike(a) || isPromiseLike(b)\n ? a === b\n : areObjectsEqual(a, b, isEqual, meta);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (aTag === BOOLEAN_TAG || aTag === NUMBER_TAG || aTag === STRING_TAG) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n }\n\n // If not matching any tags that require a specific type of comparison, then use strict\n // equality. This is for a few reasons:\n // - For types that cannot be introspected (`Promise`, `WeakMap`, etc.), this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases.\n // - For types that can be introspected, but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision was to be conservative.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return a === b;\n }\n\n return comparator as EqualityComparator<Meta>;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(\n a: any[],\n b: any[],\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isEqual(a[index], b[index], index, index, a, b, meta)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the arrays are equal in value, including circular references.\n */\nexport const areArraysEqualCircular = createIsCircular(areArraysEqual);\n","import { sameValueZeroEqual } from './utils';\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n isEqual(aKey, bKey, indexA, matchIndexB, a, b, meta) &&\n isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Map`s are equal in value, including circular references.\n */\nexport const areMapsEqualCircular = createIsCircular(areMapsEqual);\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\ninterface Dictionary<Value> {\n [key: string]: Value;\n}\n\nconst OWNER = '_owner';\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary<any>,\n b: Dictionary<any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n const keysA = Object.keys(a);\n\n let index = keysA.length;\n\n if (Object.keys(b).length !== index) {\n return false;\n }\n\n let key: string;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n key = keysA[index];\n\n if (key === OWNER) {\n const reactElementA = !!a.$$typeof;\n const reactElementB = !!b.$$typeof;\n\n if ((reactElementA || reactElementB) && reactElementA !== reactElementB) {\n return false;\n }\n }\n\n if (\n !hasOwnProperty.call(b, key) ||\n !isEqual(a[key], b[key], key, key, a, b, meta)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value, including circular references.\n */\nexport const areObjectsEqualCircular = createIsCircular(areObjectsEqual);\n","/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n","import { createIsCircular } from './utils';\n\nimport type { InternalEqualityComparator } from './utils';\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n isEqual: InternalEqualityComparator<any>,\n meta: any,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (!isValueEqual) {\n return false;\n }\n\n if (!a.size) {\n return true;\n }\n\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = isEqual(aValue, bValue, aKey, bKey, a, b, meta))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n\n return isValueEqual;\n}\n\n/**\n * Whether the `Set`s are equal in value, including circular references.\n */\nexport const areSetsEqualCircular = createIsCircular(areSetsEqual);\n","import { createComparator } from './comparator';\nimport { areArraysEqual, areArraysEqualCircular } from './arrays';\nimport { areDatesEqual } from './dates';\nimport { areMapsEqual, areMapsEqualCircular } from './maps';\nimport { areObjectsEqual, areObjectsEqualCircular } from './objects';\nimport { areRegExpsEqual } from './regexps';\nimport { areSetsEqual, areSetsEqualCircular } from './sets';\nimport {\n createDefaultIsNestedEqual,\n EqualityComparator,\n merge,\n sameValueZeroEqual,\n} from './utils';\n\nimport type { CreateComparatorCreatorOptions } from './comparator';\n\nexport { sameValueZeroEqual };\n\nexport type { CreateComparatorCreatorOptions } from './comparator';\nexport type {\n EqualityComparator,\n EqualityComparatorCreator,\n InternalEqualityComparator,\n NativeEqualityComparator,\n TypeEqualityComparator,\n} from './utils';\n\nexport type BaseCircularMeta = Pick<\n WeakMap<any, any>,\n 'delete' | 'get' | 'set'\n>;\n\nexport type GetComparatorOptions<Meta> = (\n defaultOptions: CreateComparatorCreatorOptions<Meta>,\n) => Partial<CreateComparatorCreatorOptions<Meta>>;\n\nconst DEFAULT_CONFIG: CreateComparatorCreatorOptions<undefined> = Object.freeze(\n {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areRegExpsEqual,\n areSetsEqual,\n createIsNestedEqual: createDefaultIsNestedEqual,\n },\n);\nconst DEFAULT_CIRCULAR_CONFIG: CreateComparatorCreatorOptions<\n WeakMap<object, any>\n> = Object.freeze(\n merge(DEFAULT_CONFIG, {\n areArraysEqual: areArraysEqualCircular,\n areMapsEqual: areMapsEqualCircular,\n areObjectsEqual: areObjectsEqualCircular,\n areSetsEqual: areSetsEqualCircular,\n }),\n);\n\nconst isDeepEqual = createComparator(DEFAULT_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport function deepEqual<A, B>(a: A, b: B): boolean {\n return isDeepEqual(a, b, undefined);\n}\n\nconst isShallowEqual = createComparator(\n merge(DEFAULT_CONFIG, { createIsNestedEqual: () => sameValueZeroEqual }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport function shallowEqual<A, B>(a: A, b: B): boolean {\n return isShallowEqual(a, b, undefined);\n}\n\nconst isCircularDeepEqual = createComparator(DEFAULT_CIRCULAR_CONFIG);\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport function circularDeepEqual<A, B>(a: A, b: B): boolean {\n return isCircularDeepEqual(a, b, new WeakMap());\n}\n\nconst isCircularShallowEqual = createComparator(\n merge(DEFAULT_CIRCULAR_CONFIG, {\n createIsNestedEqual: () => sameValueZeroEqual,\n }),\n);\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport function circularShallowEqual<A, B>(a: A, b: B): boolean {\n return isCircularShallowEqual(a, b, new WeakMap());\n}\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta = undefined>(\n getComparatorOptions: GetComparatorOptions<Meta>,\n): EqualityComparator<Meta> {\n return createComparator<Meta>(\n merge(DEFAULT_CONFIG, getComparatorOptions(DEFAULT_CONFIG)),\n );\n}\n\n/**\n * Create a custom equality comparison method that handles circular references. This is very\n * similar to `createCustomEqual`, with the only difference being that `meta` expects to be\n * populated with a `WeakMap`-like contract.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `WeakMap` out of the box.\n */\nexport function createCustomCircularEqual<\n Meta extends BaseCircularMeta = WeakMap<any, any>,\n>(getComparatorOptions: GetComparatorOptions<Meta>): EqualityComparator<Meta> {\n const comparator = createComparator<Meta>(\n merge(\n DEFAULT_CIRCULAR_CONFIG,\n getComparatorOptions(DEFAULT_CIRCULAR_CONFIG as any),\n ),\n );\n\n return ((a: any, b: any, meta: any = new WeakMap()) =>\n comparator(a, b, meta)) as EqualityComparator<Meta>;\n}\n"],"names":[],"mappings":"AA2BA;;;AAGG;AACG,SAAU,0BAA0B,CACxC,UAAoC,EAAA;AAEpC,IAAA,OAAO,SAAS,OAAO,CACrB,CAAI,EACJ,CAAI,EACJ,WAAgB,EAChB,WAAgB,EAChB,OAAY,EACZ,OAAY,EACZ,IAAU,EAAA;QAEV,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAChC,KAAC,CAAC;AACJ,CAAC;AAED;;;;AAIG;AACG,SAAU,gBAAgB,CAE9B,aAA4B,EAAA;IAC5B,OAAO,SAAS,UAAU,CACxB,CAAM,EACN,CAAM,EACN,OAAsD,EACtD,KAAwB,EAAA;AAExB,QAAA,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YAC9D,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,SAAA;QAED,IAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CA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ChD,OAAO,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,IAAM,sBAAsB,GAAG,gBAAgB,CAC7C,KAAK,CAAC,uBAAuB,EAAE;AAC7B,IAAA,mBAAmB,EAAE,YAAA,EAAM,OAAA,kBAAkB,GAAA;AAC9C,CAAA,CAAC,CACH,CAAC;AAEF;;AAEG;AACa,SAAA,oBAAoB,CAAO,CAAI,EAAE,CAAI,EAAA;IACnD,OAAO,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAC/B,oBAAgD,EAAA;AAEhD,IAAA,OAAO,gBAAgB,CACrB,KAAK,CAAC,cAAc,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED;;;;;;;;;AASG;AACG,SAAU,yBAAyB,CAEvC,oBAAgD,EAAA;AAChD,IAAA,IAAM,UAAU,GAAG,gBAAgB,CACjC,KAAK,CACH,uBAAuB,EACvB,oBAAoB,CAAC,uBAA8B,CAAC,CACrD,CACF,CAAC;AAEF,IAAA,QAAQ,UAAC,CAAM,EAAE,CAAM,EAAE,IAAyB,EAAA;QAAzB,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAgB,GAAA,IAAA,OAAO,EAAE,CAAA,EAAA;AAChD,QAAA,OAAA,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;AAAtB,KAAsB,EAA8B;AACxD;;;;"}
@@ -414,7 +414,11 @@
414
414
  * `WeakMap` out of the box.
415
415
  */
416
416
  function createCustomCircularEqual(getComparatorOptions) {
417
- return createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
417
+ var comparator = createComparator(merge(DEFAULT_CIRCULAR_CONFIG, getComparatorOptions(DEFAULT_CIRCULAR_CONFIG)));
418
+ return (function (a, b, meta) {
419
+ if (meta === void 0) { meta = new WeakMap(); }
420
+ return comparator(a, b, meta);
421
+ });
418
422
  }
419
423
 
420
424
  exports.circularDeepEqual = circularDeepEqual;