fast-equals 5.3.3-beta.1 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +128 -77
  3. package/dist/cjs/comparator.d.cts +58 -0
  4. package/dist/cjs/index.cjs +133 -156
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/{types/index.d.cts → index.d.cts} +21 -2
  7. package/{src/internalTypes.ts → dist/cjs/internalTypes.d.cts} +7 -43
  8. package/dist/cjs/{types/utils.d.cts → utils.d.cts} +7 -2
  9. package/dist/es/comparator.d.mts +58 -0
  10. package/dist/{esm/types → es}/index.d.mts +21 -2
  11. package/dist/{esm → es}/index.mjs +133 -156
  12. package/dist/es/index.mjs.map +1 -0
  13. package/dist/es/internalTypes.d.mts +174 -0
  14. package/dist/{esm/types → es}/utils.d.mts +7 -2
  15. package/dist/{min/types → umd}/comparator.d.ts +2 -2
  16. package/dist/{min/types → umd}/equals.d.ts +1 -1
  17. package/dist/umd/{types/index.d.ts → index.d.ts} +2 -2
  18. package/dist/umd/index.js +133 -156
  19. package/dist/umd/index.js.map +1 -1
  20. package/dist/umd/{types/utils.d.ts → utils.d.ts} +1 -1
  21. package/index.d.ts +62 -68
  22. package/package.json +46 -54
  23. package/CHANGELOG.md +0 -364
  24. package/dist/cjs/types/comparator.d.cts +0 -26
  25. package/dist/cjs/types/internalTypes.d.cts +0 -157
  26. package/dist/esm/index.mjs.map +0 -1
  27. package/dist/esm/types/comparator.d.mts +0 -26
  28. package/dist/esm/types/internalTypes.d.mts +0 -157
  29. package/dist/min/index.js +0 -1
  30. package/dist/min/types/index.d.ts +0 -47
  31. package/dist/min/types/utils.d.ts +0 -28
  32. package/dist/umd/types/comparator.d.ts +0 -26
  33. package/dist/umd/types/equals.d.ts +0 -54
  34. package/dist/umd/types/internalTypes.d.ts +0 -157
  35. package/src/comparator.ts +0 -376
  36. package/src/equals.ts +0 -355
  37. package/src/index.ts +0 -112
  38. package/src/utils.ts +0 -96
  39. package/dist/cjs/{types/equals.d.cts → equals.d.cts} +1 -1
  40. package/dist/{esm/types → es}/equals.d.mts +1 -1
  41. /package/dist/{min/types → umd}/internalTypes.d.ts +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Tony Quetano
3
+ Copyright (c) 2025 Tony Quetano
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,7 +4,9 @@
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, while also maintaining a high degree of flexibility for various implementation use-cases. It has no dependencies, and is ~2kB when minified and gzipped.
7
+ Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed, while also
8
+ maintaining a high degree of flexibility for various implementation use-cases. It has no dependencies, and is ~2kB when
9
+ minified and gzipped.
8
10
 
9
11
  The following types are handled out-of-the-box:
10
12
 
@@ -18,7 +20,9 @@ The following types are handled out-of-the-box:
18
20
  - Primitive wrappers (`new Boolean()` / `new Number()` / `new String()`)
19
21
  - Custom class instances, including subclasses of native classes
20
22
 
21
- Methods are available for deep, shallow, or referential equality comparison. In addition, you can opt into support for circular objects, or performing a "strict" comparison with unconventional property definition, or both. You can also customize any specific type comparison based on your application's use-cases.
23
+ Methods are available for deep, shallow, or referential equality comparison. In addition, you can opt into support for
24
+ circular objects, or performing a "strict" comparison with unconventional property definition, or both. You can also
25
+ customize any specific type comparison based on your application's use-cases.
22
26
 
23
27
  ## Table of contents
24
28
 
@@ -53,20 +57,23 @@ console.log(deepEqual({ foo: 'bar' }, { foo: 'bar' })); // true
53
57
 
54
58
  ### Specific builds
55
59
 
56
- By default, npm should resolve the correct build of the package based on your consumption (ESM vs CommonJS). However, if you want to force use of a specific build, they can be located here:
60
+ By default, npm should resolve the correct build of the package based on your consumption (ESM vs CommonJS). However, if
61
+ you want to force use of a specific build, they can be located here:
57
62
 
58
63
  - ESM => `fast-equals/dist/esm/index.mjs`
59
64
  - CommonJS => `fast-equals/dist/cjs/index.cjs`
60
65
  - UMD => `fast-equals/dist/umd/index.js`
61
66
  - Minified UMD => `fast-equals/dist/min/index.js`
62
67
 
63
- If you are having issues loading a specific build type, [please file an issue](https://github.com/planttheidea/fast-equals/issues).
68
+ If you are having issues loading a specific build type,
69
+ [please file an issue](https://github.com/planttheidea/fast-equals/issues).
64
70
 
65
71
  ## Available methods
66
72
 
67
73
  ### deepEqual
68
74
 
69
- Performs a deep equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
75
+ Performs a deep equality comparison on the two objects passed and returns a boolean representing the value equivalency
76
+ of the objects.
70
77
 
71
78
  ```ts
72
79
  import { deepEqual } from 'fast-equals';
@@ -80,7 +87,9 @@ console.log(deepEqual(objectA, objectB)); // true
80
87
 
81
88
  #### Comparing `Map`s
82
89
 
83
- `Map` objects support complex keys (objects, Arrays, etc.), however [the spec for key lookups in `Map` are based on `SameZeroValue`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#key_equality). If the spec were followed for comparison, the following would always be `false`:
90
+ `Map` objects support complex keys (objects, Arrays, etc.), however
91
+ [the spec for key lookups in `Map` are based on `SameZeroValue`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#key_equality).
92
+ If the spec were followed for comparison, the following would always be `false`:
84
93
 
85
94
  ```ts
86
95
  const mapA = new Map([[{ foo: 'bar' }, { baz: 'quz' }]]);
@@ -89,11 +98,13 @@ const mapB = new Map([[{ foo: 'bar' }, { baz: 'quz' }]]);
89
98
  deepEqual(mapA, mapB);
90
99
  ```
91
100
 
92
- To support true deep equality of all contents, `fast-equals` will perform a deep equality comparison for key and value parirs. Therefore, the above would be `true`.
101
+ To support true deep equality of all contents, `fast-equals` will perform a deep equality comparison for key and value
102
+ parirs. Therefore, the above would be `true`.
93
103
 
94
104
  ### shallowEqual
95
105
 
96
- Performs a shallow equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
106
+ Performs a shallow equality comparison on the two objects passed and returns a boolean representing the value
107
+ equivalency of the objects.
97
108
 
98
109
  ```ts
99
110
  import { shallowEqual } from 'fast-equals';
@@ -111,7 +122,9 @@ console.log(shallowEqual(objectA, objectC)); // false
111
122
 
112
123
  ### sameValueZeroEqual
113
124
 
114
- Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) comparison on the two objects passed and returns a boolean representing the value equivalency of the objects. In simple terms, this means either strictly equal or both `NaN`.
125
+ Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) comparison on the two
126
+ objects passed and returns a boolean representing the value equivalency of the objects. In simple terms, this means
127
+ either strictly equal or both `NaN`.
115
128
 
116
129
  ```ts
117
130
  import { sameValueZeroEqual } from 'fast-equals';
@@ -129,7 +142,8 @@ console.log(sameValueZeroEqual(mainObject, objectC)); // false
129
142
 
130
143
  ### circularDeepEqual
131
144
 
132
- Performs the same comparison as `deepEqual` but supports circular objects. It is slower than `deepEqual`, so only use if you know circular objects are present.
145
+ Performs the same comparison as `deepEqual` but supports circular objects. It is slower than `deepEqual`, so only use if
146
+ you know circular objects are present.
133
147
 
134
148
  ```ts
135
149
  function Circular(value) {
@@ -151,7 +165,8 @@ Just as with `deepEqual`, [both keys and values are compared for deep equality](
151
165
 
152
166
  ### circularShallowEqual
153
167
 
154
- Performs the same comparison as `shallowequal` but supports circular objects. It is slower than `shallowEqual`, so only use if you know circular objects are present.
168
+ Performs the same comparison as `shallowequal` but supports circular objects. It is slower than `shallowEqual`, so only
169
+ use if you know circular objects are present.
155
170
 
156
171
  ```ts
157
172
  const array = ['foo'];
@@ -245,7 +260,8 @@ console.log(circularDeepEqual(first, new Circular('foo'))); // false
245
260
 
246
261
  ### strictCircularShallowEqual
247
262
 
248
- Performs the same comparison as `circularShallowEqual` but performs a strict comparison of the objects. In this includes:
263
+ Performs the same comparison as `circularShallowEqual` but performs a strict comparison of the objects. In this
264
+ includes:
249
265
 
250
266
  - Checking non-enumerable properties in object comparisons
251
267
  - Checking full descriptor of properties on the object to match
@@ -268,7 +284,9 @@ console.log(circularShallowEqual(array, ['foo', array])); // false
268
284
 
269
285
  ### createCustomEqual
270
286
 
271
- Creates a custom equality comparator that will be used on nested values in the object. Unlike `deepEqual` and `shallowEqual`, this is a factory method that receives the default options used internally, and allows you to override the defaults as needed. This is generally for extreme edge-cases, or supporting legacy environments.
287
+ Creates a custom equality comparator that will be used on nested values in the object. Unlike `deepEqual` and
288
+ `shallowEqual`, this is a factory method that receives the default options used internally, and allows you to override
289
+ the defaults as needed. This is generally for extreme edge-cases, or supporting legacy environments.
272
290
 
273
291
  The signature is as follows:
274
292
 
@@ -286,10 +304,7 @@ interface ComparatorConfig<Meta> {
286
304
  areFunctionsEqual: TypeEqualityComparator<(...args: any[]) => any, Meta>;
287
305
  areMapsEqual: TypeEqualityComparator<Map<any, any>, Meta>;
288
306
  areObjectsEqual: TypeEqualityComparator<Record<string, any>, Meta>;
289
- arePrimitiveWrappersEqual: TypeEqualityComparator<
290
- boolean | string | number,
291
- Meta
292
- >;
307
+ arePrimitiveWrappersEqual: TypeEqualityComparator<boolean | string | number, Meta>;
293
308
  areRegExpsEqual: TypeEqualityComparator<RegExp, Meta>;
294
309
  areSetsEqual: TypeEqualityComparator<Set<any>, Meta>;
295
310
  areTypedArraysEqual: TypeEqualityComparator<TypedArray, Meta>;
@@ -299,36 +314,33 @@ interface ComparatorConfig<Meta> {
299
314
 
300
315
  function createCustomEqual<Meta>(options: {
301
316
  circular?: boolean;
302
- createCustomConfig?: (
303
- defaultConfig: ComparatorConfig<Meta>,
304
- ) => Partial<ComparatorConfig<Meta>>;
317
+ createCustomConfig?: (defaultConfig: ComparatorConfig<Meta>) => Partial<ComparatorConfig<Meta>>;
305
318
  createInternalComparator?: (
306
319
  compare: <A, B>(a: A, b: B, state: State<Meta>) => boolean,
307
- ) => (
308
- a: any,
309
- b: any,
310
- indexOrKeyA: any,
311
- indexOrKeyB: any,
312
- parentA: any,
313
- parentB: any,
314
- state: State<Meta>,
315
- ) => boolean;
320
+ ) => (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, state: State<Meta>) => boolean;
316
321
  createState?: () => { cache?: Cache; meta?: Meta };
317
322
  strict?: boolean;
318
323
  }): <A, B>(a: A, b: B) => boolean;
319
324
  ```
320
325
 
321
- Create a custom equality comparator. This allows complete control over building a bespoke equality method, in case your use-case requires a higher degree of performance, legacy environment support, or any other non-standard usage. The [recipes](#recipes) provide examples of use in different use-cases, but if you have a specific goal in mind and would like assistance feel free to [file an issue](https://github.com/planttheidea/fast-equals/issues).
326
+ Create a custom equality comparator. This allows complete control over building a bespoke equality method, in case your
327
+ use-case requires a higher degree of performance, legacy environment support, or any other non-standard usage. The
328
+ [recipes](#recipes) provide examples of use in different use-cases, but if you have a specific goal in mind and would
329
+ like assistance feel free to [file an issue](https://github.com/planttheidea/fast-equals/issues).
322
330
 
323
- _**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._
331
+ _**NOTE**: `Map` implementations compare equality for both keys and value. When using a custom comparator and comparing
332
+ equality of the keys, the iteration index is provided as both `indexOrKeyA` and `indexOrKeyB` to help use-cases where
333
+ ordering of keys matters to equality._
324
334
 
325
335
  #### unknownTagComparators
326
336
 
327
- If you want to compare objects that have a custom `@@toStringTag`, you can provide a map of the custom tags you want to support via the `unknownTagComparators` option. See [this recipe]('./recipes/special-objects.md) for an example.
337
+ If you want to compare objects that have a custom `@@toStringTag`, you can provide a map of the custom tags you want to
338
+ support via the `unknownTagComparators` option. See [this recipe]('./recipes/special-objects.md) for an example.
328
339
 
329
340
  #### Recipes
330
341
 
331
- 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.
342
+ Some recipes have been created to provide examples of use-cases for `createCustomEqual`. Even if not directly applicable
343
+ to the problem you are solving, they can offer guidance of how to structure your solution.
332
344
 
333
345
  - [Legacy environment support for `RegExp` comparators](./recipes/legacy-regexp-support.md)
334
346
  - [Explicit property check](./recipes/explicit-property-check.md)
@@ -340,7 +352,8 @@ Some recipes have been created to provide examples of use-cases for `createCusto
340
352
 
341
353
  ## Benchmarks
342
354
 
343
- All benchmarks were performed on an i9-11900H Ubuntu Linux 24.04 laptop with 64GB of memory using NodeJS version `20.17.0`, and are based on averages of running comparisons based deep equality on the following object types:
355
+ All benchmarks were performed on an i9-11900H Ubuntu Linux 24.04 laptop with 64GB of memory using NodeJS version
356
+ `20.17.0`, and are based on averages of running comparisons based deep equality on the following object types:
344
357
 
345
358
  - Primitives (`String`, `Number`, `null`, `undefined`)
346
359
  - `Function`
@@ -353,60 +366,98 @@ All benchmarks were performed on an i9-11900H Ubuntu Linux 24.04 laptop with 64G
353
366
 
354
367
  ```bash
355
368
  Testing mixed objects equal...
356
- ┌─────────┬─────────────────────────────────┬────────────────┐
357
- (index) Package │ Ops/sec
358
- ├─────────┼─────────────────────────────────┼────────────────┤
359
- 0 │ 'fast-equals'1256867.529926
360
- │ 1 │ 'fast-deep-equal' │ 1207041.997437 │
361
- 2 │ 'shallow-equal-fuzzy' 1142536.391324
362
- │ 3 │ 'react-fast-compare' │ 1140373.249605 │
363
- 4 │ 'dequal/lite' 708240.354044
364
- │ 5 │ 'dequal' │ 704655.931143 │
365
- 6 │ 'fast-equals (circular)' 595853.718756
366
- │ 7 │ 'underscore.isEqual' │ 433596.570863 │
367
- 8 │ 'assert.deepStrictEqual' 310595.198662
368
- │ 9 │ 'lodash.isEqual' │ 232192.454526 │
369
- 10 │ 'fast-equals (strict)' 175941.250843
370
- │ 11 │ 'fast-equals (strict circular)' │ 154606.328398 │
371
- 12 │ 'deep-eql' 136052.484375
372
- │ 13 │ 'deep-equal' │ 854.061311 │
373
- └─────────┴─────────────────────────────────┴────────────────┘
369
+ ┌────────────────────────────────────────┬────────────────┐
370
+ Name Ops / sec
371
+ ├────────────────────────────────────────┼────────────────┤
372
+ │ fast-equals (passed)1407749.173253
373
+ ├────────────────────────────────────────┼────────────────┤
374
+ fast-deep-equal (passed) 1280048.665876
375
+ ├────────────────────────────────────────┼────────────────┤
376
+ react-fast-compare (passed) 1246487.311854
377
+ ├────────────────────────────────────────┼────────────────┤
378
+ shallow-equal-fuzzy (passed) 1214706.618885
379
+ ├────────────────────────────────────────┼────────────────┤
380
+ nano-equal (failed) 940867.156604
381
+ ├────────────────────────────────────────┼────────────────┤
382
+ dequal/lite (passed) 761363.455047
383
+ ├────────────────────────────────────────┼────────────────┤
384
+ dequal (passed) 750171.073217
385
+ ├────────────────────────────────────────┼────────────────┤
386
+ │ fast-equals (circular) (passed) │ 737965.55573 │
387
+ ├────────────────────────────────────────┼────────────────┤
388
+ │ underscore.isEqual (passed) │ 483891.274261 │
389
+ ├────────────────────────────────────────┼────────────────┤
390
+ │ assert.deepStrictEqual (passed) │ 453773.568213 │
391
+ ├────────────────────────────────────────┼────────────────┤
392
+ │ lodash.isEqual (passed) │ 286143.874795 │
393
+ ├────────────────────────────────────────┼────────────────┤
394
+ │ fast-equals (strict) (passed) │ 210515.955319 │
395
+ ├────────────────────────────────────────┼────────────────┤
396
+ │ fast-equals (strict circular) (passed) │ 182784.610131 │
397
+ ├────────────────────────────────────────┼────────────────┤
398
+ │ deep-eql (passed) │ 158366.491816 │
399
+ ├────────────────────────────────────────┼────────────────┤
400
+ │ deep-equal (passed) │ 918.529727 │
401
+ └────────────────────────────────────────┴───────────────
374
402
 
375
403
  Testing mixed objects not equal...
376
- ┌─────────┬─────────────────────────────────┬────────────────┐
377
- (index) Package │ Ops/sec
378
- ├─────────┼─────────────────────────────────┼────────────────┤
379
- 0 │ 'fast-equals'3795307.779634
380
- │ 1 │ 'fast-deep-equal' │ 2987150.35694 │
381
- 2 │ 'react-fast-compare' 2733075.404272
382
- │ 3 │ 'fast-equals (circular)' │ 2311547.685659 │
383
- 4 │ 'dequal/lite' 1156909.54415
384
- │ 5 │ 'dequal' │ 1151209.161878 │
385
- 6 │ 'fast-equals (strict)' 1102248.247412
386
- │ 7 │ 'fast-equals (strict circular)' │ 1020639.089577 │
387
- 8 │ 'nano-equal' 1009557.685012
388
- │ 9 │ 'underscore.isEqual' │ 770286.698227 │
389
- 10 'lodash.isEqual' │ 296338.570457
390
- │ 11 │ 'deep-eql' │ 152741.182224 │
391
- 12 'assert.deepStrictEqual' │ 20163.203513
392
- │ 13 │ 'deep-equal' │ 3519.448516 │
393
- └─────────┴─────────────────────────────────┴────────────────┘
404
+ ┌────────────────────────────────────────┬────────────────┐
405
+ Name Ops / sec
406
+ ├────────────────────────────────────────┼────────────────┤
407
+ │ fast-equals (passed)4608308.851367
408
+ ├────────────────────────────────────────┼────────────────┤
409
+ │ fast-deep-equal (passed) 3407711.655124
410
+ ├────────────────────────────────────────┼────────────────┤
411
+ react-fast-compare (passed) 3272226.526599
412
+ ├────────────────────────────────────────┼────────────────┤
413
+ │ fast-equals (circular) (passed) 3259611.548677
414
+ ├────────────────────────────────────────┼────────────────┤
415
+ fast-equals (strict) (passed) 1642777.096261
416
+ ├────────────────────────────────────────┼────────────────┤
417
+ fast-equals (strict circular) (passed) 1416054.558291
418
+ ├────────────────────────────────────────┼────────────────┤
419
+ dequal/lite (passed) 1331215.970586
420
+ ├────────────────────────────────────────┼────────────────┤
421
+ │ dequal (passed) │ 1301010.914786 │
422
+ ├────────────────────────────────────────┼────────────────┤
423
+ │ shallow-equal-fuzzy (failed) │ 1205019.5157 │
424
+ ├────────────────────────────────────────┼────────────────┤
425
+ │ nano-equal (passed) │ 1057016.193582 │
426
+ ├────────────────────────────────────────┼────────────────┤
427
+ │ underscore.isEqual (passed) │ 917363.620713 │
428
+ ├────────────────────────────────────────┼────────────────┤
429
+ │ lodash.isEqual (passed) │ 381357.861375 │
430
+ ├────────────────────────────────────────┼────────────────┤
431
+ │ deep-eql (passed) │ 184651.960191 │
432
+ ├────────────────────────────────────────┼────────────────┤
433
+ │ assert.deepStrictEqual (passed) │ 20607.926681 │
434
+ ├────────────────────────────────────────┼────────────────┤
435
+ │ deep-equal (passed) │ 3687.588699 │
436
+ └────────────────────────────────────────┴────────────────┘
394
437
  ```
395
438
 
396
439
  Caveats that impact the benchmark (and accuracy of comparison):
397
440
 
398
- - `Map`s, `Promise`s, and `Set`s were excluded from the benchmark entirely because no library other than `deep-eql` fully supported their comparison
399
- - `fast-deep-equal`, `react-fast-compare` and `nano-equal` throw on objects with `null` as prototype (`Object.create(null)`)
441
+ - `Map`s, `Promise`s, and `Set`s were excluded from the benchmark entirely because no library other than `deep-eql`
442
+ fully supported their comparison
443
+ - `fast-deep-equal`, `react-fast-compare` and `nano-equal` throw on objects with `null` as prototype
444
+ (`Object.create(null)`)
400
445
  - `assert.deepStrictEqual` does not support `NaN` or `SameValueZero` equality for dates
401
446
  - `deep-eql` does not support `SameValueZero` equality for zero equality (positive and negative zero are not equal)
402
- - `deep-equal` does not support `NaN` and does not strictly compare object type, or date / regexp values, nor uses `SameValueZero` equality for dates
447
+ - `deep-equal` does not support `NaN` and does not strictly compare object type, or date / regexp values, nor uses
448
+ `SameValueZero` equality for dates
403
449
  - `fast-deep-equal` does not support `NaN` or `SameValueZero` equality for dates
404
- - `nano-equal` does not strictly compare object property structure, array length, or object type, nor `SameValueZero` equality for dates
405
- - `react-fast-compare` does not support `NaN` or `SameValueZero` equality for dates, and does not compare `function` equality
450
+ - `nano-equal` does not strictly compare object property structure, array length, or object type, nor `SameValueZero`
451
+ equality for dates
452
+ - `react-fast-compare` does not support `NaN` or `SameValueZero` equality for dates, and does not compare `function`
453
+ equality
406
454
  - `shallow-equal-fuzzy` does not strictly compare object type or regexp values, nor `SameValueZero` equality for dates
407
455
  - `underscore.isEqual` does not support `SameValueZero` equality for primitives or dates
408
456
 
409
- All of these have the potential of inflating the respective library's numbers in comparison to `fast-equals`, but it was the closest apples-to-apples comparison I could create of a reasonable sample size. It should be noted that `react` elements can be circular objects, however simple elements are not; I kept the `react` comparison very basic to allow it to be included.
457
+ All of these have the potential of inflating the respective library's numbers in comparison to `fast-equals`, but it was
458
+ the closest apples-to-apples comparison I could create of a reasonable sample size. It should be noted that `react`
459
+ elements can be circular objects, however simple elements are not; I kept the `react` comparison very basic to allow it
460
+ to be included.
410
461
 
411
462
  ## Development
412
463
 
@@ -415,7 +466,7 @@ Standard practice, clone the repo and `npm i` to get the dependencies. The follo
415
466
  - benchmark => run benchmark tests against other equality libraries
416
467
  - build => build `main`, `module`, and `browser` distributables with `rollup`
417
468
  - clean => run `rimraf` on the `dist` folder
418
- - dev => start webpack playground App
469
+ - dev => start `vite` playground App
419
470
  - dist => run `build`
420
471
  - lint => run ESLint on all files in `src` folder (also runs on `dev` script)
421
472
  - lint:fix => run `lint` script, but with auto-fixer
@@ -0,0 +1,58 @@
1
+ import type {
2
+ ComparatorConfig,
3
+ CreateState,
4
+ CustomEqualCreatorOptions,
5
+ EqualityComparator,
6
+ InternalEqualityComparator,
7
+ } from './internalTypes.d.cts';
8
+ interface CreateIsEqualOptions<Meta> {
9
+ circular: boolean;
10
+ comparator: EqualityComparator<Meta>;
11
+ createState: CreateState<Meta> | undefined;
12
+ equals: InternalEqualityComparator<Meta>;
13
+ strict: boolean;
14
+ }
15
+ /**
16
+ * Create a comparator method based on the type-specific equality comparators passed.
17
+ */
18
+ export declare function createEqualityComparator<Meta>({
19
+ areArraysEqual,
20
+ areDatesEqual,
21
+ areErrorsEqual,
22
+ areFunctionsEqual,
23
+ areMapsEqual,
24
+ areNumbersEqual,
25
+ areObjectsEqual,
26
+ arePrimitiveWrappersEqual,
27
+ areRegExpsEqual,
28
+ areSetsEqual,
29
+ areTypedArraysEqual,
30
+ areUrlsEqual,
31
+ unknownTagComparators,
32
+ }: ComparatorConfig<Meta>): EqualityComparator<Meta>;
33
+ /**
34
+ * Create the configuration object used for building comparators.
35
+ */
36
+ export declare function createEqualityComparatorConfig<Meta>({
37
+ circular,
38
+ createCustomConfig,
39
+ strict,
40
+ }: CustomEqualCreatorOptions<Meta>): ComparatorConfig<Meta>;
41
+ /**
42
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
43
+ * use inside the built comparator.
44
+ */
45
+ export declare function createInternalEqualityComparator<Meta>(
46
+ compare: EqualityComparator<Meta>,
47
+ ): InternalEqualityComparator<Meta>;
48
+ /**
49
+ * Create the `isEqual` function used by the consuming application.
50
+ */
51
+ export declare function createIsEqual<Meta>({
52
+ circular,
53
+ comparator,
54
+ createState,
55
+ equals,
56
+ strict,
57
+ }: CreateIsEqualOptions<Meta>): <A, B>(a: A, b: B) => boolean;
58
+ export {};