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.
- package/LICENSE +1 -1
- package/README.md +128 -77
- package/dist/cjs/comparator.d.cts +60 -0
- package/dist/cjs/{types/equals.d.cts → equals.d.cts} +8 -0
- package/dist/cjs/index.cjs +171 -162
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/{types/index.d.cts → index.d.cts} +21 -2
- package/{src/internalTypes.ts → dist/cjs/internalTypes.d.cts} +18 -50
- package/dist/cjs/{types/utils.d.cts → utils.d.cts} +7 -2
- package/dist/es/comparator.d.mts +60 -0
- package/dist/{esm/types → es}/equals.d.mts +8 -0
- package/dist/{esm/types → es}/index.d.mts +21 -2
- package/dist/{esm → es}/index.mjs +171 -162
- package/dist/es/index.mjs.map +1 -0
- package/dist/es/internalTypes.d.mts +178 -0
- package/dist/{esm/types → es}/utils.d.mts +7 -2
- package/dist/{min/types → umd}/comparator.d.ts +2 -2
- package/dist/{min/types → umd}/equals.d.ts +8 -0
- package/dist/umd/index.js +171 -162
- package/dist/umd/index.js.map +1 -1
- package/dist/{min/types → umd}/internalTypes.d.ts +10 -8
- package/index.d.ts +73 -75
- package/package.json +45 -48
- package/CHANGELOG.md +0 -364
- package/dist/cjs/types/comparator.d.cts +0 -26
- package/dist/cjs/types/internalTypes.d.cts +0 -157
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/types/comparator.d.mts +0 -26
- package/dist/esm/types/internalTypes.d.mts +0 -157
- package/dist/min/index.js +0 -1
- package/dist/umd/types/comparator.d.ts +0 -26
- package/dist/umd/types/equals.d.ts +0 -54
- package/dist/umd/types/index.d.ts +0 -47
- package/dist/umd/types/internalTypes.d.ts +0 -157
- package/dist/umd/types/utils.d.ts +0 -28
- package/src/comparator.ts +0 -376
- package/src/equals.ts +0 -355
- package/src/index.ts +0 -112
- package/src/utils.ts +0 -96
- /package/dist/{min/types → umd}/index.d.ts +0 -0
- /package/dist/{min/types → umd}/utils.d.ts +0 -0
package/package.json
CHANGED
|
@@ -6,43 +6,40 @@
|
|
|
6
6
|
},
|
|
7
7
|
"description": "A blazing fast equality comparison, either shallow or deep",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
11
|
-
"@
|
|
12
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
13
|
-
"@rollup/plugin-typescript": "^12.3.0",
|
|
14
|
-
"@types/lodash": "^4.17.20",
|
|
15
|
-
"@types/node": "^24.10.1",
|
|
9
|
+
"@planttheidea/build-tools": "^1.2.3",
|
|
10
|
+
"@types/lodash": "^4.17.21",
|
|
11
|
+
"@types/node": "^24.10.3",
|
|
16
12
|
"@types/ramda": "^0.31.1",
|
|
17
|
-
"@types/react": "^19.2.
|
|
13
|
+
"@types/react": "^19.2.7",
|
|
18
14
|
"@types/react-dom": "^19.2.3",
|
|
19
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
20
|
-
"@typescript-eslint/parser": "^8.
|
|
21
|
-
"@vitest/coverage-v8": "4.0.
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
16
|
+
"@typescript-eslint/parser": "^8.49.0",
|
|
17
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
18
|
+
"cli-table3": "^0.6.5",
|
|
22
19
|
"decircularize": "^1.0.0",
|
|
23
20
|
"deep-eql": "^5.0.2",
|
|
24
21
|
"deep-equal": "^2.2.3",
|
|
25
22
|
"dequal": "^2.0.3",
|
|
26
|
-
"eslint": "^9.39.
|
|
23
|
+
"eslint": "^9.39.2",
|
|
27
24
|
"eslint-friendly-formatter": "^4.0.1",
|
|
28
25
|
"eslint-plugin-import": "^2.32.0",
|
|
29
26
|
"fast-deep-equal": "^3.1.3",
|
|
30
27
|
"fast-glob": "^3.3.3",
|
|
31
28
|
"lodash": "^4.17.21",
|
|
32
29
|
"nano-equal": "^2.0.2",
|
|
33
|
-
"prettier": "^3.
|
|
34
|
-
"react": "^19.2.
|
|
35
|
-
"react-dom": "^19.2.
|
|
30
|
+
"prettier": "^3.7.4",
|
|
31
|
+
"react": "^19.2.3",
|
|
32
|
+
"react-dom": "^19.2.3",
|
|
36
33
|
"react-fast-compare": "^3.2.2",
|
|
37
|
-
"release-it": "^19.0
|
|
38
|
-
"rollup": "^4.53.
|
|
34
|
+
"release-it": "^19.1.0",
|
|
35
|
+
"rollup": "^4.53.3",
|
|
39
36
|
"shallow-equal-fuzzy": "^0.0.2",
|
|
40
|
-
"tinybench": "^
|
|
37
|
+
"tinybench": "^6.0.0",
|
|
41
38
|
"typescript": "^5.9.3",
|
|
42
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"typescript-eslint": "^8.49.0",
|
|
43
40
|
"underscore": "^1.13.7",
|
|
44
|
-
"vite": "^7.2.
|
|
45
|
-
"vitest": "^4.0.
|
|
41
|
+
"vite": "^7.2.7",
|
|
42
|
+
"vitest": "^4.0.15"
|
|
46
43
|
},
|
|
47
44
|
"engines": {
|
|
48
45
|
"node": ">=6.0.0"
|
|
@@ -50,27 +47,25 @@
|
|
|
50
47
|
"exports": {
|
|
51
48
|
".": {
|
|
52
49
|
"import": {
|
|
53
|
-
"types": "./dist/
|
|
54
|
-
"default": "./dist/
|
|
50
|
+
"types": "./dist/es/index.d.mts",
|
|
51
|
+
"default": "./dist/es/index.mjs"
|
|
55
52
|
},
|
|
56
53
|
"require": {
|
|
57
|
-
"types": "./dist/cjs/
|
|
54
|
+
"types": "./dist/cjs/index.d.cts",
|
|
58
55
|
"default": "./dist/cjs/index.cjs"
|
|
59
56
|
},
|
|
60
57
|
"default": {
|
|
61
|
-
"types": "./dist/umd/
|
|
58
|
+
"types": "./dist/umd/index.d.ts",
|
|
62
59
|
"default": "./dist/umd/index.js"
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
},
|
|
66
63
|
"files": [
|
|
67
64
|
"dist",
|
|
68
|
-
"src",
|
|
69
|
-
"CHANGELOG.md",
|
|
70
|
-
"index.d.ts",
|
|
71
65
|
"LICENSE",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
66
|
+
"README.md",
|
|
67
|
+
"index.d.ts",
|
|
68
|
+
"package.json"
|
|
74
69
|
],
|
|
75
70
|
"homepage": "https://github.com/planttheidea/fast-equals#readme",
|
|
76
71
|
"keywords": [
|
|
@@ -82,35 +77,37 @@
|
|
|
82
77
|
],
|
|
83
78
|
"license": "MIT",
|
|
84
79
|
"main": "dist/cjs/index.cjs",
|
|
85
|
-
"module": "dist/
|
|
80
|
+
"module": "dist/es/index.mjs",
|
|
86
81
|
"name": "fast-equals",
|
|
87
82
|
"repository": {
|
|
88
83
|
"type": "git",
|
|
89
84
|
"url": "git+https://github.com/planttheidea/fast-equals.git"
|
|
90
85
|
},
|
|
91
86
|
"scripts": {
|
|
92
|
-
"benchmark": "npm run build
|
|
93
|
-
"build": "npm run
|
|
94
|
-
"build:
|
|
95
|
-
"build:
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
87
|
+
"benchmark": "npm run build && node benchmark/index.js",
|
|
88
|
+
"build": "npm run clean && npm run build:dist && npm run build:types",
|
|
89
|
+
"build:dist": "NODE_ENV=production rollup -c config/rollup.config.js",
|
|
90
|
+
"build:types": "pti fix-types -l dist",
|
|
91
|
+
"clean": "rm -rf dist",
|
|
92
|
+
"clean:cjs": "rm -rf dist/cjs",
|
|
93
|
+
"clean:es": "rm -rf dist/es",
|
|
94
|
+
"clean:umd": "rm -rf dist/umd",
|
|
95
|
+
"dev": "vite --config=config/vite.config.ts",
|
|
96
|
+
"format": "prettier . --log-level=warn --write",
|
|
97
|
+
"format:check": "prettier . --log-level=warn --check",
|
|
98
|
+
"lint": "eslint --max-warnings=0",
|
|
102
99
|
"lint:fix": "npm run lint -- --fix",
|
|
100
|
+
"release:alpha": "release-it --config=config/release-it/alpha.json",
|
|
101
|
+
"release:beta": "release-it --config=config/release-it/beta.json",
|
|
102
|
+
"release:rc": "release-it --config=config/release-it/rc.json",
|
|
103
|
+
"release:scripts": "npm run format:check && npm run typecheck && npm run lint && npm run test && npm run build",
|
|
104
|
+
"release:stable": "release-it --config=config/release-it/stable.json",
|
|
103
105
|
"start": "npm run dev",
|
|
104
|
-
"
|
|
105
|
-
"release:beta": "release-it --config=.release-it.beta.json",
|
|
106
|
-
"release:scripts": "npm run typecheck && npm run lint && npm run test:coverage && npm run build",
|
|
107
|
-
"test": "vitest run",
|
|
108
|
-
"test:coverage": "rm -rf coverage && vitest run --coverage",
|
|
109
|
-
"test:watch": "vitest",
|
|
106
|
+
"test": "vitest run --config=config/vitest.config.ts",
|
|
110
107
|
"typecheck": "tsc --noEmit"
|
|
111
108
|
},
|
|
112
109
|
"sideEffects": false,
|
|
113
110
|
"type": "module",
|
|
114
111
|
"types": "./index.d.ts",
|
|
115
|
-
"version": "5.
|
|
112
|
+
"version": "5.4.0"
|
|
116
113
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
# fast-equals CHANGELOG
|
|
2
|
-
|
|
3
|
-
## 5.3.3
|
|
4
|
-
|
|
5
|
-
- [#147](https://github.com/planttheidea/fast-equals/pull/147) - Fix type resolution when using `Node16` as `moduleResolution` in TypeScript (fixes [#145](https://github.com/planttheidea/fast-equals/issues/145))
|
|
6
|
-
|
|
7
|
-
## 5.3.2
|
|
8
|
-
|
|
9
|
-
- [#154](https://github.com/planttheidea/fast-equals/pull/154) - Use include with `"files"` instead of exclude with `.npmignore` (Thanks [@43081j](https://github.com/43081j))
|
|
10
|
-
- [#155](https://github.com/planttheidea/fast-equals/pull/155) - Upgrade build dependencies to resolve security vulnerabilities
|
|
11
|
-
|
|
12
|
-
## 5.3.1
|
|
13
|
-
|
|
14
|
-
- [#153](https://github.com/planttheidea/fast-equals/pull/153) - Avoid publishing `.yarn` folder
|
|
15
|
-
|
|
16
|
-
## 5.3.0
|
|
17
|
-
|
|
18
|
-
- [#150](https://github.com/planttheidea/fast-equals/pull/150/files) - Add support for `unknownTagComparators` in custom configuration (thanks to @mrcljx for the idea)
|
|
19
|
-
|
|
20
|
-
## 5.2.2
|
|
21
|
-
|
|
22
|
-
- [#139](https://github.com/planttheidea/fast-equals/pull/139/files) - Add file extensions to type definition files to allow it to work in projects with `NodeNext` module resolution
|
|
23
|
-
|
|
24
|
-
## 5.2.1
|
|
25
|
-
|
|
26
|
-
### Bugfixes
|
|
27
|
-
|
|
28
|
-
- [#138](https://github.com/planttheidea/fast-equals/pull/138) - Actually fix reference to `src` code in `index.d.ts` by flattening types in file
|
|
29
|
-
|
|
30
|
-
## 5.2.0
|
|
31
|
-
|
|
32
|
-
### Enhancements
|
|
33
|
-
|
|
34
|
-
- Support Preact objects in equality comparison
|
|
35
|
-
|
|
36
|
-
### Bugfixes
|
|
37
|
-
|
|
38
|
-
- [#137](https://github.com/planttheidea/fast-equals/pull/137) - Fix circular React references in object comparisons
|
|
39
|
-
|
|
40
|
-
## 5.1.3
|
|
41
|
-
|
|
42
|
-
### Enhancements
|
|
43
|
-
|
|
44
|
-
- [#136](https://github.com/planttheidea/fast-equals/pull/136) - More than double speed of iterables (`Map` / `Set`) equality comparisons
|
|
45
|
-
|
|
46
|
-
### Maintenance
|
|
47
|
-
|
|
48
|
-
- [#135](https://github.com/planttheidea/fast-equals/pull/135) - Include `dequal` and `dequal/lite` in benchmark comparisons
|
|
49
|
-
|
|
50
|
-
## 5.1.2
|
|
51
|
-
|
|
52
|
-
### Maintenance
|
|
53
|
-
|
|
54
|
-
Re-release of `5.1.0` with correct pre-release setup.
|
|
55
|
-
|
|
56
|
-
## 5.1.1
|
|
57
|
-
|
|
58
|
-
**DO NOT USE**
|
|
59
|
-
|
|
60
|
-
This was an accidental pre-release when cleaning up release setup.
|
|
61
|
-
|
|
62
|
-
## 5.1.0
|
|
63
|
-
|
|
64
|
-
### Enhancements
|
|
65
|
-
|
|
66
|
-
- [#127](https://github.com/planttheidea/fast-equals/pull/127) - Add support for custom `Function` instance comparisons (resolves [#118](https://github.com/planttheidea/fast-equals/issues/118))
|
|
67
|
-
- [#128](https://github.com/planttheidea/fast-equals/pull/128) - Add support for `URL` instance comparisons (resolves [#121](https://github.com/planttheidea/fast-equals/issues/121))
|
|
68
|
-
- [#129](https://github.com/planttheidea/fast-equals/pull/129) - Add support for `Error` instance comparisons (resolves [#123](https://github.com/planttheidea/fast-equals/issues/123))
|
|
69
|
-
- [#130](https://github.com/planttheidea/fast-equals/pull/130) - Add support for custom `Number` instance comparisons (resolves [#112](https://github.com/planttheidea/fast-equals/issues/112))
|
|
70
|
-
|
|
71
|
-
### Bugfixes
|
|
72
|
-
|
|
73
|
-
- [#132](https://github.com/planttheidea/fast-equals/pull/126) - Fix `assert.deepEqual` check in benchmark (resolves [#125](https://github.com/planttheidea/fast-equals/issues/125))
|
|
74
|
-
- [#126](https://github.com/planttheidea/fast-equals/pull/132) - Export explicit types via `export type` (attempts to resolve [#114](https://github.com/planttheidea/fast-equals/issues/114))
|
|
75
|
-
|
|
76
|
-
## 5.0.1
|
|
77
|
-
|
|
78
|
-
### Bugfixes
|
|
79
|
-
|
|
80
|
-
- Fix reference to `metaOverride` in typings and documentation (holdover from temporary API in v5 beta)
|
|
81
|
-
|
|
82
|
-
## 5.0.0
|
|
83
|
-
|
|
84
|
-
### Breaking changes
|
|
85
|
-
|
|
86
|
-
#### `constructor` equality now required
|
|
87
|
-
|
|
88
|
-
To align with other implementations common in the community, but also to be more functionally correct, the two objects being compared now must have equal `constructor`s.
|
|
89
|
-
|
|
90
|
-
#### `Map` / `Set` comparisons no longer support IE11
|
|
91
|
-
|
|
92
|
-
In previous verisons, `.forEach()` was used to ensure that support for `Symbol` was not required, as IE11 did not have `Symbol` and therefore both `Map` and `Set` did not have iterator-based methods such as `.values()` or `.entries()`. Since IE11 is no longer a supported browser, and support for those methods is present in all browsers and Node for quite a while, the comparison has moved to use these methods. This results in a ~20% performance increase.
|
|
93
|
-
|
|
94
|
-
#### `createCustomEqual` contract has changed
|
|
95
|
-
|
|
96
|
-
To better facilitate strict comparisons, but also to allow for `meta` use separate from caching, the contract for `createCustomEqual` has changed. See the [README documentation](./README.md#createcustomequal) for more details, but froma high-level:
|
|
97
|
-
|
|
98
|
-
- `meta` is no longer passed through to equality comparators, but rather a general `state` object which contains `meta`
|
|
99
|
-
- `cache` now also lives on the `state` object, which allows for use of the `meta` property separate from but in parallel with the circular cache
|
|
100
|
-
- `equals` is now on `state`, which prevents the need to pass through the separate `isEqual` method for the equality comparator
|
|
101
|
-
|
|
102
|
-
#### `createCustomCircularEqual` has been removed
|
|
103
|
-
|
|
104
|
-
You can create a custom circular equality comparator through `createCustomEqual` now by providing `circular: true` to the options.
|
|
105
|
-
|
|
106
|
-
#### Custom `meta` values are no longer passed at callsite
|
|
107
|
-
|
|
108
|
-
To use `meta` properties for comparisons, they must be returned in a `createState` method.
|
|
109
|
-
|
|
110
|
-
#### Deep links have changed
|
|
111
|
-
|
|
112
|
-
If you were deep-linking into a specific asset type (ESM / CJS / UMD), they have changed location.
|
|
113
|
-
|
|
114
|
-
**NOTE**: You may no longer need to deep-link, as [the build resolution has improved](#better-build-system-resolution).
|
|
115
|
-
|
|
116
|
-
### Enhancements
|
|
117
|
-
|
|
118
|
-
#### New "strict" comparators available
|
|
119
|
-
|
|
120
|
-
The following new comparators are available:
|
|
121
|
-
|
|
122
|
-
- `strictDeepEqual`
|
|
123
|
-
- `strictShallowEqual`
|
|
124
|
-
- `strictCircularDeepEqual`
|
|
125
|
-
- `strictCircularShallowEqual`
|
|
126
|
-
|
|
127
|
-
This will perform the same comparisons as their non-strict counterparts, but will verify additional properties (non-enumerable properties on objects, keyed objects on `Array` / `Map` / `Set`) and that the descriptors for the properties align.
|
|
128
|
-
|
|
129
|
-
#### `TypedArray` support
|
|
130
|
-
|
|
131
|
-
Support for comparing all typed array values is now supported, and you can provide a custom comparator via the new `areTypedArraysEqual` option in the `createCustomEqual` configuration.
|
|
132
|
-
|
|
133
|
-
#### Better build system resolution
|
|
134
|
-
|
|
135
|
-
The library now leverages the `exports` property in the `package.json` to provide builds specific to your method of consumption (ESM / CommonJS / UMD). There is still a minified UMD version available if you want to use it instead.
|
|
136
|
-
|
|
137
|
-
#### `arePrimitiveWrappersEqual` option added to `createCustomEqual` configuration
|
|
138
|
-
|
|
139
|
-
If you want a custom comparator for primitive wrappers (`new Boolean()` / `new Number()` / `new String()`) it is now available.
|
|
140
|
-
|
|
141
|
-
## 4.0.3
|
|
142
|
-
|
|
143
|
-
- Remove unnecessary second strict equality check for objects in edge-case scenarios
|
|
144
|
-
|
|
145
|
-
## 4.0.2
|
|
146
|
-
|
|
147
|
-
- [#85](https://github.com/planttheidea/fast-equals/issues/85) - `createCustomCircularEqual` typing is incorrect
|
|
148
|
-
|
|
149
|
-
## 4.0.1
|
|
150
|
-
|
|
151
|
-
- [#81](https://github.com/planttheidea/fast-equals/issues/81) - Fix typing issues related to importing in `index.d.ts` file
|
|
152
|
-
|
|
153
|
-
## 4.0.0
|
|
154
|
-
|
|
155
|
-
### Breaking Changes
|
|
156
|
-
|
|
157
|
-
#### Certain ES2015 features are now required
|
|
158
|
-
|
|
159
|
-
In previous versions, there were automatic fallbacks for certain ES2015 features if they did not exist:
|
|
160
|
-
|
|
161
|
-
- [`RegExp.prototype.flags`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags)
|
|
162
|
-
- [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
|
|
163
|
-
|
|
164
|
-
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.
|
|
165
|
-
|
|
166
|
-
#### `createCustomEqual` contract has changed
|
|
167
|
-
|
|
168
|
-
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.
|
|
169
|
-
|
|
170
|
-
### Enhancements
|
|
171
|
-
|
|
172
|
-
#### `createCustomCircularEqual` added
|
|
173
|
-
|
|
174
|
-
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.
|
|
175
|
-
|
|
176
|
-
#### Cross-realm comparisons are now supported
|
|
177
|
-
|
|
178
|
-
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.
|
|
179
|
-
|
|
180
|
-
#### TypeScript typings improved
|
|
181
|
-
|
|
182
|
-
For better typing in edge-case scenarios like custom comparators with `meta` values, typings have been refactored for accuracy and better narrow flow-through.
|
|
183
|
-
|
|
184
|
-
## 3.0.3
|
|
185
|
-
|
|
186
|
-
- Fix [#77](https://github.com/planttheidea/fast-equals/issues/73) - better circular object validation
|
|
187
|
-
|
|
188
|
-
## 3.0.2
|
|
189
|
-
|
|
190
|
-
- Fix [#73](https://github.com/planttheidea/fast-equals/issues/73) - support comparison of primitive wrappers
|
|
191
|
-
- [#76](https://github.com/planttheidea/fast-equals/pull/76) - improve speed and accuracy of `RegExp` comparison in modern environments
|
|
192
|
-
|
|
193
|
-
## 3.0.1
|
|
194
|
-
|
|
195
|
-
- Fix [#71](https://github.com/planttheidea/fast-equals/pull/71) - use generic types for better type flow-through
|
|
196
|
-
|
|
197
|
-
## 3.0.0
|
|
198
|
-
|
|
199
|
-
### Breaking changes
|
|
200
|
-
|
|
201
|
-
When creating a custom equality comparator via `createCustomEqual`, the equality method has an expanded contract:
|
|
202
|
-
|
|
203
|
-
```ts
|
|
204
|
-
// Before
|
|
205
|
-
type EqualityComparator = (objectA: any, objectB: any, meta: any) => boolean;
|
|
206
|
-
|
|
207
|
-
// After
|
|
208
|
-
type InternalEqualityComparator = (
|
|
209
|
-
objectA: any,
|
|
210
|
-
objectB: any,
|
|
211
|
-
indexOrKeyA: any,
|
|
212
|
-
indexOrKeyB: any,
|
|
213
|
-
parentA: any,
|
|
214
|
-
parentB: any,
|
|
215
|
-
meta: any,
|
|
216
|
-
) => boolean;
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
If you have a custom equality comparator, you can ignore the differences by just passing additional `undefined` parameters, or you can use the parameters to further improve / clarify the logic.
|
|
220
|
-
|
|
221
|
-
- Add [#57](https://github.com/planttheidea/fast-equals/pull/57) - support additional metadata for custom equality comparators
|
|
222
|
-
|
|
223
|
-
## 2.0.4
|
|
224
|
-
|
|
225
|
-
- Fix [#58](https://github.com/planttheidea/fast-equals/issues/58) - duplicate entries in `Map` / `Set` can create false equality success
|
|
226
|
-
- [#60](https://github.com/planttheidea/fast-equals/issues/60) - Add documentation for key equality of `Map` being a part of `deepEqual`
|
|
227
|
-
|
|
228
|
-
## 2.0.3
|
|
229
|
-
|
|
230
|
-
- Fix [#50](https://github.com/planttheidea/fast-equals/pull/50) - copy-pasta in cacheable check
|
|
231
|
-
|
|
232
|
-
## 2.0.2
|
|
233
|
-
|
|
234
|
-
- Optimize iterables comparisons to not double-iterate
|
|
235
|
-
- Optimize loop-based comparisons for speed
|
|
236
|
-
- Improve cache handling in circular handlers
|
|
237
|
-
- Improve stability of memory by reducing variable instantiation
|
|
238
|
-
|
|
239
|
-
## 2.0.1
|
|
240
|
-
|
|
241
|
-
- Fix [#41](https://github.com/planttheidea/fast-equals/pull/41) - prevent `.rpt2_cache` directory from being published for better CI environment support (thanks [@herberttn](https://github.com/herberttn))
|
|
242
|
-
|
|
243
|
-
## 2.0.0
|
|
244
|
-
|
|
245
|
-
### Breaking changes
|
|
246
|
-
|
|
247
|
-
- There are longer `fast-equals/es`, `fast-equals/lib`, `fast-equals/mjs` locations
|
|
248
|
-
- Instead, there are 3 builds in `dist` for different consumption types:
|
|
249
|
-
- `fast-equals.js` (UMD / `browser`)
|
|
250
|
-
- `fast-equals.esm.js` (ESM / `module`)
|
|
251
|
-
- `fast-equals.cjs.js` (CommonJS / `main`)
|
|
252
|
-
- There is no default export anymore, only the previously-existing named exports
|
|
253
|
-
- To get all into a namespace, use `import * as fe from 'fast-equals`
|
|
254
|
-
|
|
255
|
-
### Updates
|
|
256
|
-
|
|
257
|
-
- Rewritten completely in TypeScript
|
|
258
|
-
- Improve speed of `Map` / `Set` comparisons
|
|
259
|
-
- Improve speed of React element comparisons
|
|
260
|
-
|
|
261
|
-
### Fixes
|
|
262
|
-
|
|
263
|
-
- Consider pure objects (`Object.create(null)`) to be plain objects
|
|
264
|
-
- Fix typings for `createCustomEqual`
|
|
265
|
-
|
|
266
|
-
## 1.6.3
|
|
267
|
-
|
|
268
|
-
- Check the size of the iterable before converting to arrays
|
|
269
|
-
|
|
270
|
-
## 1.6.2
|
|
271
|
-
|
|
272
|
-
- Fix [#23](https://github.com/planttheidea/fast-equals/issues/23) - false positives for map
|
|
273
|
-
- Replace `uglify` with `terser`
|
|
274
|
-
- Use `rollup` to build all the distributables (`main`, `module`, and `browser`)
|
|
275
|
-
- Maintain `lib` and `es` transpilations in case consumers were deep-linking
|
|
276
|
-
|
|
277
|
-
## 1.6.1
|
|
278
|
-
|
|
279
|
-
- Upgrade to `babel@7`
|
|
280
|
-
- Add `"sideEffects": false` to `package.json` for better tree-shaking in `webpack`
|
|
281
|
-
|
|
282
|
-
## 1.6.0
|
|
283
|
-
|
|
284
|
-
- Add ESM support for NodeJS with separate [`.mjs` extension](https://nodejs.org/api/esm.html) exports
|
|
285
|
-
|
|
286
|
-
## 1.5.3
|
|
287
|
-
|
|
288
|
-
- Fix `Map` / `Set` comparison to not require order to match to be equal
|
|
289
|
-
|
|
290
|
-
## 1.5.2
|
|
291
|
-
|
|
292
|
-
- Improve speed of object comparison through custom `hasKey` method
|
|
293
|
-
|
|
294
|
-
## 1.5.1
|
|
295
|
-
|
|
296
|
-
- Fix lack of support for `unicode` and `sticky` RegExp flag checks
|
|
297
|
-
|
|
298
|
-
## 1.5.0
|
|
299
|
-
|
|
300
|
-
- Add [`circularDeepEqual`](README.md#circulardeepequal) and [`circularShallowEqual`](README.md#circularshallowequal) methods
|
|
301
|
-
- Add `meta` third parameter to `comparator` calls, for use with `createCustomEqual` method
|
|
302
|
-
|
|
303
|
-
## 1.4.1
|
|
304
|
-
|
|
305
|
-
- Fix issue where `lastIndex` was not being tested on `RegExp` objects
|
|
306
|
-
|
|
307
|
-
## 1.4.0
|
|
308
|
-
|
|
309
|
-
- Add support for comparing promise-like objects (strict equality only)
|
|
310
|
-
|
|
311
|
-
## 1.3.1
|
|
312
|
-
|
|
313
|
-
- Make `react` comparison more accurate, and a touch faster
|
|
314
|
-
|
|
315
|
-
## 1.3.0
|
|
316
|
-
|
|
317
|
-
- Add support for deep-equal comparisons between `react` elements
|
|
318
|
-
- Add comparison with `react-fast-compare`
|
|
319
|
-
- Use `rollup` for `dist` file builds
|
|
320
|
-
|
|
321
|
-
## 1.2.1
|
|
322
|
-
|
|
323
|
-
- Fix errors from TypeScript typings in strict mode (thanks [@HitoriSensei](https://github.com/HitoriSensei))
|
|
324
|
-
|
|
325
|
-
## 1.2.0
|
|
326
|
-
|
|
327
|
-
- Surface `isSameValueZero` as [`sameValueZeroEqual`](#samevaluezeroequal) option
|
|
328
|
-
|
|
329
|
-
## 1.1.0
|
|
330
|
-
|
|
331
|
-
- Add TypeScript typings (thanks [@josh-sachs](https://github.com/josh-sachs))
|
|
332
|
-
|
|
333
|
-
## 1.0.6
|
|
334
|
-
|
|
335
|
-
- Support invalid date equality via `isSameValueZero`
|
|
336
|
-
|
|
337
|
-
## 1.0.5
|
|
338
|
-
|
|
339
|
-
- Replace `isStrictlyEqual` with `isSameValueZero` to ensure that `shallowEqual` accounts for `NaN` equality
|
|
340
|
-
|
|
341
|
-
## 1.0.4
|
|
342
|
-
|
|
343
|
-
- Only check values when comparing `Set` objects (improves performance of `Set` check by ~12%)
|
|
344
|
-
|
|
345
|
-
## 1.0.3
|
|
346
|
-
|
|
347
|
-
- Make `Map` and `Set` comparisons more explicit
|
|
348
|
-
|
|
349
|
-
## 1.0.2
|
|
350
|
-
|
|
351
|
-
- Fix symmetrical comparison of iterables
|
|
352
|
-
- Reduce footprint
|
|
353
|
-
|
|
354
|
-
## 1.0.1
|
|
355
|
-
|
|
356
|
-
- Prevent babel transpilation of `typeof` into helper for faster runtime
|
|
357
|
-
|
|
358
|
-
## 1.0.0
|
|
359
|
-
|
|
360
|
-
- Initial release
|
|
361
|
-
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
```
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ComparatorConfig, CreateState, CustomEqualCreatorOptions, EqualityComparator, InternalEqualityComparator } from './internalTypes.d.cts';
|
|
2
|
-
interface CreateIsEqualOptions<Meta> {
|
|
3
|
-
circular: boolean;
|
|
4
|
-
comparator: EqualityComparator<Meta>;
|
|
5
|
-
createState: CreateState<Meta> | undefined;
|
|
6
|
-
equals: InternalEqualityComparator<Meta>;
|
|
7
|
-
strict: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Create a comparator method based on the type-specific equality comparators passed.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createEqualityComparator<Meta>({ areArraysEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, unknownTagComparators, }: ComparatorConfig<Meta>): EqualityComparator<Meta>;
|
|
13
|
-
/**
|
|
14
|
-
* Create the configuration object used for building comparators.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createEqualityComparatorConfig<Meta>({ circular, createCustomConfig, strict, }: CustomEqualCreatorOptions<Meta>): ComparatorConfig<Meta>;
|
|
17
|
-
/**
|
|
18
|
-
* Default equality comparator pass-through, used as the standard `isEqual` creator for
|
|
19
|
-
* use inside the built comparator.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createInternalEqualityComparator<Meta>(compare: EqualityComparator<Meta>): InternalEqualityComparator<Meta>;
|
|
22
|
-
/**
|
|
23
|
-
* Create the `isEqual` function used by the consuming application.
|
|
24
|
-
*/
|
|
25
|
-
export declare function createIsEqual<Meta>({ circular, comparator, createState, equals, strict, }: CreateIsEqualOptions<Meta>): <A, B>(a: A, b: B) => boolean;
|
|
26
|
-
export {};
|