fast-equals 5.3.3 → 5.4.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.
Files changed (41) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +128 -77
  3. package/dist/cjs/comparator.d.cts +60 -0
  4. package/dist/cjs/{types/equals.d.cts → equals.d.cts} +8 -0
  5. package/dist/cjs/index.cjs +171 -162
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/{types/index.d.cts → index.d.cts} +21 -2
  8. package/{src/internalTypes.ts → dist/cjs/internalTypes.d.cts} +18 -50
  9. package/dist/cjs/{types/utils.d.cts → utils.d.cts} +7 -2
  10. package/dist/es/comparator.d.mts +60 -0
  11. package/dist/{esm/types → es}/equals.d.mts +8 -0
  12. package/dist/{esm/types → es}/index.d.mts +21 -2
  13. package/dist/{esm → es}/index.mjs +171 -162
  14. package/dist/es/index.mjs.map +1 -0
  15. package/dist/es/internalTypes.d.mts +178 -0
  16. package/dist/{esm/types → es}/utils.d.mts +7 -2
  17. package/dist/{min/types → umd}/comparator.d.ts +2 -2
  18. package/dist/{min/types → umd}/equals.d.ts +8 -0
  19. package/dist/umd/index.js +171 -162
  20. package/dist/umd/index.js.map +1 -1
  21. package/dist/{min/types → umd}/internalTypes.d.ts +10 -8
  22. package/index.d.ts +73 -75
  23. package/package.json +45 -48
  24. package/CHANGELOG.md +0 -364
  25. package/dist/cjs/types/comparator.d.cts +0 -26
  26. package/dist/cjs/types/internalTypes.d.cts +0 -157
  27. package/dist/esm/index.mjs.map +0 -1
  28. package/dist/esm/types/comparator.d.mts +0 -26
  29. package/dist/esm/types/internalTypes.d.mts +0 -157
  30. package/dist/min/index.js +0 -1
  31. package/dist/umd/types/comparator.d.ts +0 -26
  32. package/dist/umd/types/equals.d.ts +0 -54
  33. package/dist/umd/types/index.d.ts +0 -47
  34. package/dist/umd/types/internalTypes.d.ts +0 -157
  35. package/dist/umd/types/utils.d.ts +0 -28
  36. package/src/comparator.ts +0 -376
  37. package/src/equals.ts +0 -355
  38. package/src/index.ts +0 -112
  39. package/src/utils.ts +0 -96
  40. /package/dist/{min/types → umd}/index.d.ts +0 -0
  41. /package/dist/{min/types → umd}/utils.d.ts +0 -0
@@ -1,157 +0,0 @@
1
- /**
2
- * Cache used to store references to objects, used for circular
3
- * reference checks.
4
- */
5
- export interface Cache<Key extends object, Value> {
6
- delete(key: Key): boolean;
7
- get(key: Key): Value | undefined;
8
- set(key: Key, value: any): any;
9
- }
10
- export interface State<Meta> {
11
- /**
12
- * Cache used to identify circular references
13
- */
14
- readonly cache: Cache<any, any> | undefined;
15
- /**
16
- * Method used to determine equality of nested value.
17
- */
18
- readonly equals: InternalEqualityComparator<Meta>;
19
- /**
20
- * Additional value that can be used for comparisons.
21
- */
22
- meta: Meta;
23
- /**
24
- * Whether the equality comparison is strict, meaning it matches
25
- * all properties (including symbols and non-enumerable properties)
26
- * with equal shape of descriptors.
27
- */
28
- readonly strict: boolean;
29
- }
30
- export interface CircularState<Meta> extends State<Meta> {
31
- readonly cache: Cache<any, any>;
32
- }
33
- export interface DefaultState<Meta> extends State<Meta> {
34
- readonly cache: undefined;
35
- }
36
- export interface Dictionary<Value = any> {
37
- [key: string | symbol]: Value;
38
- $$typeof?: any;
39
- }
40
- export interface ComparatorConfig<Meta> {
41
- /**
42
- * Whether the arrays passed are equal in value. In strict mode, this includes
43
- * additional properties added to the array.
44
- */
45
- areArraysEqual: TypeEqualityComparator<any, Meta>;
46
- /**
47
- * Whether the dates passed are equal in value.
48
- */
49
- areDatesEqual: TypeEqualityComparator<any, Meta>;
50
- /**
51
- * Whether the errors passed are equal in value.
52
- */
53
- areErrorsEqual: TypeEqualityComparator<any, Meta>;
54
- /**
55
- * Whether the functions passed are equal in value.
56
- */
57
- areFunctionsEqual: TypeEqualityComparator<any, Meta>;
58
- /**
59
- * Whether the maps passed are equal in value. In strict mode, this includes
60
- * additional properties added to the map.
61
- */
62
- areMapsEqual: TypeEqualityComparator<any, Meta>;
63
- /**
64
- * Whether the numbers passed are equal in value.
65
- */
66
- areNumbersEqual: TypeEqualityComparator<any, Meta>;
67
- /**
68
- * Whether the objects passed are equal in value. In strict mode, this includes
69
- * non-enumerable properties added to the map, as well as symbol properties.
70
- */
71
- areObjectsEqual: TypeEqualityComparator<any, Meta>;
72
- /**
73
- * Whether the primitive wrappers passed are equal in value.
74
- */
75
- arePrimitiveWrappersEqual: TypeEqualityComparator<any, Meta>;
76
- /**
77
- * Whether the regexps passed are equal in value.
78
- */
79
- areRegExpsEqual: TypeEqualityComparator<any, Meta>;
80
- /**
81
- * Whether the sets passed are equal in value. In strict mode, this includes
82
- * additional properties added to the set.
83
- */
84
- areSetsEqual: TypeEqualityComparator<any, Meta>;
85
- /**
86
- * Whether the typed arrays passed are equal in value. In strict mode, this includes
87
- * additional properties added to the typed array.
88
- */
89
- areTypedArraysEqual: TypeEqualityComparator<any, Meta>;
90
- /**
91
- * Whether the URLs passed are equal in value.
92
- */
93
- areUrlsEqual: TypeEqualityComparator<any, Meta>;
94
- /**
95
- * Whether two values with unknown `@@toStringTag` are equal in value. This comparator is
96
- * called when no other comparator applies.
97
- *
98
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag
99
- */
100
- unknownTagComparators: Record<string, TypeEqualityComparator<any, Meta>> | undefined;
101
- }
102
- export type CreateCustomComparatorConfig<Meta> = (config: ComparatorConfig<Meta>) => Partial<ComparatorConfig<Meta>>;
103
- export type CreateState<Meta> = () => {
104
- cache?: Cache<any, any> | undefined;
105
- meta?: Meta;
106
- };
107
- export type EqualityComparator<Meta> = <A, B>(a: A, b: B, state: State<Meta>) => boolean;
108
- export type AnyEqualityComparator<Meta> = (a: any, b: any, state: State<Meta>) => boolean;
109
- export type EqualityComparatorCreator<Meta> = (fn: EqualityComparator<Meta>) => InternalEqualityComparator<Meta>;
110
- export type InternalEqualityComparator<Meta> = (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, state: State<Meta>) => boolean;
111
- export type PrimitiveWrapper = Boolean | Number | String;
112
- /**
113
- * Type which encompasses possible instances of TypedArray
114
- * classes.
115
- *
116
- * **NOTE**: This does not include `BigInt64Array` and
117
- * `BitUint64Array` because those are part of ES2020 and
118
- * not supported by certain TS configurations. If using
119
- * either in `areTypedArraysEqual`, you can cast the
120
- * instance as `TypedArray` and it will work as expected,
121
- * because runtime checks will still work for those classes.
122
- */
123
- export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint16Array | Uint32Array | Uint8Array | Uint8ClampedArray;
124
- export type TypeEqualityComparator<Type, Meta = undefined> = (a: Type, b: Type, state: State<Meta>) => boolean;
125
- export interface CustomEqualCreatorOptions<Meta> {
126
- /**
127
- * Whether circular references should be supported. It causes the
128
- * comparison to be slower, but for objects that have circular references
129
- * it is required to avoid stack overflows.
130
- */
131
- circular?: boolean;
132
- /**
133
- * Create a custom configuration of type-specific equality comparators.
134
- * This receives the default configuration, which allows either replacement
135
- * or supersetting of the default methods.
136
- */
137
- createCustomConfig?: CreateCustomComparatorConfig<Meta>;
138
- /**
139
- * Create a custom internal comparator, which is used as an override to the
140
- * default entry point for nested value equality comparisons. This is often
141
- * used for doing custom logic for specific types (such as handling a specific
142
- * class instance differently than other objects) or to incorporate `meta` in
143
- * the comparison. See the recipes for examples.
144
- */
145
- createInternalComparator?: (compare: EqualityComparator<Meta>) => InternalEqualityComparator<Meta>;
146
- /**
147
- * Create a custom `state` object passed between the methods. This allows for
148
- * custom `cache` and/or `meta` values to be used.
149
- */
150
- createState?: CreateState<Meta>;
151
- /**
152
- * Whether the equality comparison is strict, meaning it matches
153
- * all properties (including symbols and non-enumerable properties)
154
- * with equal shape of descriptors.
155
- */
156
- strict?: boolean;
157
- }
@@ -1,28 +0,0 @@
1
- import type { AnyEqualityComparator, Dictionary, State, TypeEqualityComparator } from './internalTypes.js';
2
- /**
3
- * Combine two comparators into a single comparators.
4
- */
5
- export declare function combineComparators<Meta>(comparatorA: AnyEqualityComparator<Meta>, comparatorB: AnyEqualityComparator<Meta>): <A, B>(a: A, b: B, state: State<Meta>) => boolean;
6
- /**
7
- * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
8
- * for circular references to be safely included in the comparison without creating
9
- * stack overflows.
10
- */
11
- export declare function createIsCircular<AreItemsEqual extends TypeEqualityComparator<any, any>>(areItemsEqual: AreItemsEqual): AreItemsEqual;
12
- /**
13
- * Get the `@@toStringTag` of the value, if it exists.
14
- */
15
- export declare function getShortTag(value: any): string | undefined;
16
- /**
17
- * Get the properties to strictly examine, which include both own properties that are
18
- * not enumerable and symbol properties.
19
- */
20
- export declare function getStrictProperties(object: Dictionary): Array<string | symbol>;
21
- /**
22
- * Whether the object contains the property passed as an own property.
23
- */
24
- export declare const hasOwn: (o: object, v: PropertyKey) => boolean;
25
- /**
26
- * Whether the values passed are strictly equal or both NaN.
27
- */
28
- export declare function sameValueZeroEqual(a: any, b: any): boolean;
package/src/comparator.ts DELETED
@@ -1,376 +0,0 @@
1
- import {
2
- areArraysEqual as areArraysEqualDefault,
3
- areDatesEqual as areDatesEqualDefault,
4
- areErrorsEqual as areErrorsEqualDefault,
5
- areFunctionsEqual as areFunctionsEqualDefault,
6
- areMapsEqual as areMapsEqualDefault,
7
- areNumbersEqual as areNumbersEqualDefault,
8
- areObjectsEqual as areObjectsEqualDefault,
9
- areObjectsEqualStrict as areObjectsEqualStrictDefault,
10
- arePrimitiveWrappersEqual as arePrimitiveWrappersEqualDefault,
11
- areRegExpsEqual as areRegExpsEqualDefault,
12
- areSetsEqual as areSetsEqualDefault,
13
- areTypedArraysEqual as areTypedArraysEqualDefault,
14
- areUrlsEqual as areUrlsEqualDefault,
15
- } from './equals.js';
16
- import type {
17
- ComparatorConfig,
18
- CreateState,
19
- CustomEqualCreatorOptions,
20
- EqualityComparator,
21
- InternalEqualityComparator,
22
- State,
23
- } from './internalTypes.js';
24
- import { combineComparators, createIsCircular, getShortTag } from './utils.js';
25
-
26
- const ARGUMENTS_TAG = '[object Arguments]';
27
- const BOOLEAN_TAG = '[object Boolean]';
28
- const DATE_TAG = '[object Date]';
29
- const ERROR_TAG = '[object Error]';
30
- const MAP_TAG = '[object Map]';
31
- const NUMBER_TAG = '[object Number]';
32
- const OBJECT_TAG = '[object Object]';
33
- const REG_EXP_TAG = '[object RegExp]';
34
- const SET_TAG = '[object Set]';
35
- const STRING_TAG = '[object String]';
36
- const URL_TAG = '[object URL]';
37
-
38
- const { isArray } = Array;
39
- const isTypedArray =
40
- typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function'
41
- ? ArrayBuffer.isView
42
- : null;
43
- const { assign } = Object;
44
- const getTag = Object.prototype.toString.call.bind(
45
- Object.prototype.toString,
46
- ) as (a: object) => string;
47
-
48
- interface CreateIsEqualOptions<Meta> {
49
- circular: boolean;
50
- comparator: EqualityComparator<Meta>;
51
- createState: CreateState<Meta> | undefined;
52
- equals: InternalEqualityComparator<Meta>;
53
- strict: boolean;
54
- }
55
-
56
- /**
57
- * Create a comparator method based on the type-specific equality comparators passed.
58
- */
59
- export function createEqualityComparator<Meta>({
60
- areArraysEqual,
61
- areDatesEqual,
62
- areErrorsEqual,
63
- areFunctionsEqual,
64
- areMapsEqual,
65
- areNumbersEqual,
66
- areObjectsEqual,
67
- arePrimitiveWrappersEqual,
68
- areRegExpsEqual,
69
- areSetsEqual,
70
- areTypedArraysEqual,
71
- areUrlsEqual,
72
- unknownTagComparators,
73
- }: ComparatorConfig<Meta>): EqualityComparator<Meta> {
74
- /**
75
- * compare the value of the two objects and return true if they are equivalent in values
76
- */
77
- return function comparator(a: any, b: any, state: State<Meta>): boolean {
78
- // If the items are strictly equal, no need to do a value comparison.
79
- if (a === b) {
80
- return true;
81
- }
82
-
83
- // If either of the items are nullish and fail the strictly equal check
84
- // above, then they must be unequal.
85
- if (a == null || b == null) {
86
- return false;
87
- }
88
-
89
- const type = typeof a;
90
-
91
- if (type !== typeof b) {
92
- return false;
93
- }
94
-
95
- if (type !== 'object') {
96
- if (type === 'number') {
97
- return areNumbersEqual(a, b, state);
98
- }
99
-
100
- if (type === 'function') {
101
- return areFunctionsEqual(a, b, state);
102
- }
103
-
104
- // If a primitive value that is not strictly equal, it must be unequal.
105
- return false;
106
- }
107
-
108
- const constructor = a.constructor;
109
-
110
- // Checks are listed in order of commonality of use-case:
111
- // 1. Common complex object types (plain object, array)
112
- // 2. Common data values (date, regexp)
113
- // 3. Less-common complex object types (map, set)
114
- // 4. Less-common data values (promise, primitive wrappers)
115
- // Inherently this is both subjective and assumptive, however
116
- // when reviewing comparable libraries in the wild this order
117
- // appears to be generally consistent.
118
-
119
- // Constructors should match, otherwise there is potential for false positives
120
- // between class and subclass or custom object and POJO.
121
- if (constructor !== b.constructor) {
122
- return false;
123
- }
124
-
125
- // `isPlainObject` only checks against the object's own realm. Cross-realm
126
- // comparisons are rare, and will be handled in the ultimate fallback, so
127
- // we can avoid capturing the string tag.
128
- if (constructor === Object) {
129
- return areObjectsEqual(a, b, state);
130
- }
131
-
132
- // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing
133
- // the string tag or doing an `instanceof` check.
134
- if (isArray(a)) {
135
- return areArraysEqual(a, b, state);
136
- }
137
-
138
- // `isTypedArray()` works on all possible TypedArray classes, so we can avoid
139
- // capturing the string tag or comparing against all possible constructors.
140
- if (isTypedArray != null && isTypedArray(a)) {
141
- return areTypedArraysEqual(a, b, state);
142
- }
143
-
144
- // Try to fast-path equality checks for other complex object types in the
145
- // same realm to avoid capturing the string tag. Strict equality is used
146
- // instead of `instanceof` because it is more performant for the common
147
- // use-case. If someone is subclassing a native class, it will be handled
148
- // with the string tag comparison.
149
-
150
- if (constructor === Date) {
151
- return areDatesEqual(a, b, state);
152
- }
153
-
154
- if (constructor === RegExp) {
155
- return areRegExpsEqual(a, b, state);
156
- }
157
-
158
- if (constructor === Map) {
159
- return areMapsEqual(a, b, state);
160
- }
161
-
162
- if (constructor === Set) {
163
- return areSetsEqual(a, b, state);
164
- }
165
-
166
- // Since this is a custom object, capture the string tag to determing its type.
167
- // This is reasonably performant in modern environments like v8 and SpiderMonkey.
168
- const tag = getTag(a as object);
169
-
170
- if (tag === DATE_TAG) {
171
- return areDatesEqual(a, b, state);
172
- }
173
-
174
- // For RegExp, the properties are not enumerable, and therefore will give false positives if
175
- // tested like a standard object.
176
- if (tag === REG_EXP_TAG) {
177
- return areRegExpsEqual(a, b, state);
178
- }
179
-
180
- if (tag === MAP_TAG) {
181
- return areMapsEqual(a, b, state);
182
- }
183
-
184
- if (tag === SET_TAG) {
185
- return areSetsEqual(a, b, state);
186
- }
187
-
188
- if (tag === OBJECT_TAG) {
189
- // The exception for value comparison is custom `Promise`-like class instances. These should
190
- // be treated the same as standard `Promise` objects, which means strict equality, and if
191
- // it reaches this point then that strict equality comparison has already failed.
192
- return (
193
- typeof a.then !== 'function' &&
194
- typeof b.then !== 'function' &&
195
- areObjectsEqual(a, b, state)
196
- );
197
- }
198
-
199
- // If a URL tag, it should be tested explicitly. Like RegExp, the properties are not
200
- // enumerable, and therefore will give false positives if tested like a standard object.
201
- if (tag === URL_TAG) {
202
- return areUrlsEqual(a, b, state);
203
- }
204
-
205
- // If an error tag, it should be tested explicitly. Like RegExp, the properties are not
206
- // enumerable, and therefore will give false positives if tested like a standard object.
207
- if (tag === ERROR_TAG) {
208
- return areErrorsEqual(a, b, state);
209
- }
210
-
211
- // If an arguments tag, it should be treated as a standard object.
212
- if (tag === ARGUMENTS_TAG) {
213
- return areObjectsEqual(a, b, state);
214
- }
215
-
216
- // As the penultimate fallback, check if the values passed are primitive wrappers. This
217
- // is very rare in modern JS, which is why it is deprioritized compared to all other object
218
- // types.
219
- if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
220
- return arePrimitiveWrappersEqual(a, b, state);
221
- }
222
-
223
- if (unknownTagComparators) {
224
- let unknownTagComparator = unknownTagComparators[tag];
225
-
226
- if (!unknownTagComparator) {
227
- const shortTag = getShortTag(a);
228
-
229
- if (shortTag) {
230
- unknownTagComparator = unknownTagComparators[shortTag];
231
- }
232
- }
233
-
234
- // If the custom config has an unknown tag comparator that matches the captured tag or the
235
- // @@toStringTag, it is the source of truth for whether the values are equal.
236
- if (unknownTagComparator) {
237
- return unknownTagComparator(a, b, state);
238
- }
239
- }
240
-
241
- // If not matching any tags that require a specific type of comparison, then we hard-code false because
242
- // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:
243
- // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
244
- // comparison that can be made.
245
- // - For types that can be introspected, but rarely have requirements to be compared
246
- // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common
247
- // use-cases (may be included in a future release, if requested enough).
248
- // - For types that can be introspected but do not have an objective definition of what
249
- // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
250
- // In all cases, these decisions should be reevaluated based on changes to the language and
251
- // common development practices.
252
- return false;
253
- };
254
- }
255
-
256
- /**
257
- * Create the configuration object used for building comparators.
258
- */
259
- export function createEqualityComparatorConfig<Meta>({
260
- circular,
261
- createCustomConfig,
262
- strict,
263
- }: CustomEqualCreatorOptions<Meta>): ComparatorConfig<Meta> {
264
- let config = {
265
- areArraysEqual: strict
266
- ? areObjectsEqualStrictDefault
267
- : areArraysEqualDefault,
268
- areDatesEqual: areDatesEqualDefault,
269
- areErrorsEqual: areErrorsEqualDefault,
270
- areFunctionsEqual: areFunctionsEqualDefault,
271
- areMapsEqual: strict
272
- ? combineComparators(areMapsEqualDefault, areObjectsEqualStrictDefault)
273
- : areMapsEqualDefault,
274
- areNumbersEqual: areNumbersEqualDefault,
275
- areObjectsEqual: strict
276
- ? areObjectsEqualStrictDefault
277
- : areObjectsEqualDefault,
278
- arePrimitiveWrappersEqual: arePrimitiveWrappersEqualDefault,
279
- areRegExpsEqual: areRegExpsEqualDefault,
280
- areSetsEqual: strict
281
- ? combineComparators(areSetsEqualDefault, areObjectsEqualStrictDefault)
282
- : areSetsEqualDefault,
283
- areTypedArraysEqual: strict
284
- ? areObjectsEqualStrictDefault
285
- : areTypedArraysEqualDefault,
286
- areUrlsEqual: areUrlsEqualDefault,
287
- unknownTagComparators: undefined,
288
- };
289
-
290
- if (createCustomConfig) {
291
- config = assign({}, config, createCustomConfig(config));
292
- }
293
-
294
- if (circular) {
295
- const areArraysEqual = createIsCircular(config.areArraysEqual);
296
- const areMapsEqual = createIsCircular(config.areMapsEqual);
297
- const areObjectsEqual = createIsCircular(config.areObjectsEqual);
298
- const areSetsEqual = createIsCircular(config.areSetsEqual);
299
-
300
- config = assign({}, config, {
301
- areArraysEqual,
302
- areMapsEqual,
303
- areObjectsEqual,
304
- areSetsEqual,
305
- });
306
- }
307
-
308
- return config;
309
- }
310
-
311
- /**
312
- * Default equality comparator pass-through, used as the standard `isEqual` creator for
313
- * use inside the built comparator.
314
- */
315
- export function createInternalEqualityComparator<Meta>(
316
- compare: EqualityComparator<Meta>,
317
- ): InternalEqualityComparator<Meta> {
318
- return function (
319
- a: any,
320
- b: any,
321
- _indexOrKeyA: any,
322
- _indexOrKeyB: any,
323
- _parentA: any,
324
- _parentB: any,
325
- state: State<Meta>,
326
- ) {
327
- return compare(a, b, state);
328
- };
329
- }
330
-
331
- /**
332
- * Create the `isEqual` function used by the consuming application.
333
- */
334
- export function createIsEqual<Meta>({
335
- circular,
336
- comparator,
337
- createState,
338
- equals,
339
- strict,
340
- }: CreateIsEqualOptions<Meta>) {
341
- if (createState) {
342
- return function isEqual<A, B>(a: A, b: B): boolean {
343
- const { cache = circular ? new WeakMap() : undefined, meta } =
344
- createState();
345
-
346
- return comparator(a, b, {
347
- cache,
348
- equals,
349
- meta,
350
- strict,
351
- } as State<Meta>);
352
- };
353
- }
354
-
355
- if (circular) {
356
- return function isEqual<A, B>(a: A, b: B): boolean {
357
- return comparator(a, b, {
358
- cache: new WeakMap(),
359
- equals,
360
- meta: undefined as Meta,
361
- strict,
362
- } as State<Meta>);
363
- };
364
- }
365
-
366
- const state = {
367
- cache: undefined,
368
- equals,
369
- meta: undefined,
370
- strict,
371
- } as State<Meta>;
372
-
373
- return function isEqual<A, B>(a: A, b: B): boolean {
374
- return comparator(a, b, state);
375
- };
376
- }