fast-equals 1.6.3 → 2.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/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/code/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/semanticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/cb395dc6899b78eb42b4fab9df67376a0a00bf80 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/syntacticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_3c5f4e5db6faf852c13e3cd5e0db7a72d0e60a69/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/code/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/semanticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/0ab301188498506f5c998a00679f29b8929634e4 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/1d20cee756560ed06433a2e7dba9165f54487f2a +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/syntacticDiagnostics/cache/d800d7a0e39da81c91ab9c5059068c29ebc83792 +1 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/6982fa2ac1e62f4aebb1debc73977393caa0d5a4 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_6a9ad0d85cd0ed74f9b918d742c78fdbe81d2201/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/code/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/semanticDiagnostics/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/82edcf6c99dc3d5802a5a8d3dbfc69f1048b520f +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/eb02971c7d2972b89cd15754372a7b9a0b328a30 +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/syntacticDiagnostics/cache/f6056671db45d89ddf3a27b7cf6d454993cec47b +1 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/c0f16c9111806a91c6ae4b5d0b138e4841adf7c9 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/c9f40676a1b140ebc96dde967251686b673a9961 +0 -0
- package/.rpt2_cache/rpt2_cbc4c616fc0ab8863b2f9b3be2cc7ae6306d679d/types/cache/e578d3be8d82631bd5cd8272d6aa5a54ba064304 +0 -0
- package/BUILD.md +37 -0
- package/CHANGELOG.md +23 -0
- package/README.md +65 -84
- package/dist/fast-equals.cjs.js +415 -446
- package/dist/fast-equals.cjs.js.map +1 -1
- package/dist/fast-equals.esm.js +415 -446
- package/dist/fast-equals.esm.js.map +1 -1
- package/dist/fast-equals.js +415 -446
- package/dist/fast-equals.js.map +1 -1
- package/dist/fast-equals.min.js +1 -1
- package/dist/fast-equals.mjs +418 -0
- package/dist/fast-equals.mjs.map +1 -0
- package/index.d.ts +15 -14
- package/package.json +31 -47
- package/es/comparator.js +0 -86
- package/es/constants.js +0 -14
- package/es/index.js +0 -19
- package/es/utils.js +0 -333
- package/es-to-mjs.js +0 -14
- package/lib/comparator.js +0 -94
- package/lib/constants.js +0 -22
- package/lib/index.js +0 -36
- package/lib/utils.js +0 -386
- package/mjs/comparator.mjs +0 -86
- package/mjs/constants.mjs +0 -14
- package/mjs/index.mjs +0 -19
- package/mjs/utils.mjs +0 -333
- package/rollup.config.js +0 -55
- package/yarn-error.log +0 -8175
package/dist/fast-equals.esm.js
CHANGED
|
@@ -1,449 +1,418 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
|
|
1
|
+
var HAS_WEAKSET_SUPPORT = typeof WeakSet === 'function';
|
|
2
|
+
var keys = Object.keys;
|
|
3
|
+
/**
|
|
4
|
+
* @function addToCache
|
|
5
|
+
*
|
|
6
|
+
* add object to cache if an object
|
|
7
|
+
*
|
|
8
|
+
* @param value the value to potentially add to cache
|
|
9
|
+
* @param cache the cache to add to
|
|
10
|
+
*/
|
|
11
|
+
function addToCache(value, cache) {
|
|
12
|
+
if (value && typeof value === 'object') {
|
|
13
|
+
cache.add(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @function hasPair
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* does the `pairToMatch` exist in the list of `pairs` provided based on the
|
|
21
|
+
* `isEqual` check
|
|
22
|
+
*
|
|
23
|
+
* @param pairs the pairs to compare against
|
|
24
|
+
* @param pairToMatch the pair to match
|
|
25
|
+
* @param isEqual the equality comparator used
|
|
26
|
+
* @param meta the meta provided
|
|
27
|
+
* @returns does the pair exist in the pairs provided
|
|
28
|
+
*/
|
|
29
|
+
function hasPair(pairs, pairToMatch, isEqual, meta) {
|
|
30
|
+
var length = pairs.length;
|
|
31
|
+
var pair;
|
|
32
|
+
for (var index = 0; index < length; index++) {
|
|
33
|
+
pair = pairs[index];
|
|
34
|
+
if (isEqual(pair[0], pairToMatch[0], meta) &&
|
|
35
|
+
isEqual(pair[1], pairToMatch[1], meta)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @function hasValue
|
|
43
|
+
*
|
|
44
|
+
* @description
|
|
45
|
+
* does the `valueToMatch` exist in the list of `values` provided based on the
|
|
46
|
+
* `isEqual` check
|
|
47
|
+
*
|
|
48
|
+
* @param values the values to compare against
|
|
49
|
+
* @param valueToMatch the value to match
|
|
50
|
+
* @param isEqual the equality comparator used
|
|
51
|
+
* @param meta the meta provided
|
|
52
|
+
* @returns does the value exist in the values provided
|
|
53
|
+
*/
|
|
54
|
+
function hasValue(values, valueToMatch, isEqual, meta) {
|
|
55
|
+
var length = values.length;
|
|
56
|
+
for (var index = 0; index < length; index++) {
|
|
57
|
+
if (isEqual(values[index], valueToMatch, meta)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @function sameValueZeroEqual
|
|
65
|
+
*
|
|
66
|
+
* @description
|
|
67
|
+
* are the values passed strictly equal or both NaN
|
|
68
|
+
*
|
|
69
|
+
* @param a the value to compare against
|
|
70
|
+
* @param b the value to test
|
|
71
|
+
* @returns are the values equal by the SameValueZero principle
|
|
72
|
+
*/
|
|
73
|
+
function sameValueZeroEqual(a, b) {
|
|
74
|
+
return a === b || (a !== a && b !== b);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @function isPlainObject
|
|
78
|
+
*
|
|
79
|
+
* @description
|
|
80
|
+
* is the value a plain object
|
|
81
|
+
*
|
|
82
|
+
* @param value the value to test
|
|
83
|
+
* @returns is the value a plain object
|
|
84
|
+
*/
|
|
85
|
+
function isPlainObject(value) {
|
|
86
|
+
return value.constructor === Object || value.constructor == null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @function isPromiseLike
|
|
90
|
+
*
|
|
91
|
+
* @description
|
|
92
|
+
* is the value promise-like (meaning it is thenable)
|
|
93
|
+
*
|
|
94
|
+
* @param value the value to test
|
|
95
|
+
* @returns is the value promise-like
|
|
96
|
+
*/
|
|
97
|
+
function isPromiseLike(value) {
|
|
98
|
+
return !!value && typeof value.then === 'function';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @function isReactElement
|
|
102
|
+
*
|
|
103
|
+
* @description
|
|
104
|
+
* is the value passed a react element
|
|
105
|
+
*
|
|
106
|
+
* @param value the value to test
|
|
107
|
+
* @returns is the value a react element
|
|
108
|
+
*/
|
|
109
|
+
function isReactElement(value) {
|
|
110
|
+
return !!(value && value.$$typeof);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @function getNewCacheFallback
|
|
114
|
+
*
|
|
115
|
+
* @description
|
|
116
|
+
* in cases where WeakSet is not supported, creates a new custom
|
|
117
|
+
* object that mimics the necessary API aspects for cache purposes
|
|
118
|
+
*
|
|
119
|
+
* @returns the new cache object
|
|
120
|
+
*/
|
|
121
|
+
function getNewCacheFallback() {
|
|
122
|
+
return Object.create({
|
|
123
|
+
_values: [],
|
|
124
|
+
add: function (value) {
|
|
125
|
+
this._values.push(value);
|
|
126
|
+
},
|
|
127
|
+
has: function (value) {
|
|
128
|
+
return this._values.indexOf(value) !== -1;
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @function getNewCache
|
|
134
|
+
*
|
|
135
|
+
* @description
|
|
136
|
+
* get a new cache object to prevent circular references
|
|
137
|
+
*
|
|
138
|
+
* @returns the new cache object
|
|
139
|
+
*/
|
|
140
|
+
var getNewCache = (function (canUseWeakMap) {
|
|
141
|
+
if (canUseWeakMap) {
|
|
142
|
+
return function _getNewCache() {
|
|
143
|
+
return new WeakSet();
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return getNewCacheFallback;
|
|
147
|
+
})(HAS_WEAKSET_SUPPORT);
|
|
148
|
+
/**
|
|
149
|
+
* @function createCircularEqualCreator
|
|
150
|
+
*
|
|
151
|
+
* @description
|
|
152
|
+
* create a custom isEqual handler specific to circular objects
|
|
153
|
+
*
|
|
154
|
+
* @param [isEqual] the isEqual comparator to use instead of isDeepEqual
|
|
155
|
+
* @returns the method to create the `isEqual` function
|
|
156
|
+
*/
|
|
157
|
+
function createCircularEqualCreator(isEqual) {
|
|
158
|
+
return function createCircularEqual(comparator) {
|
|
159
|
+
var _comparator = isEqual || comparator;
|
|
160
|
+
return function circularEqual(a, b, cache) {
|
|
161
|
+
if (cache === void 0) { cache = getNewCache(); }
|
|
162
|
+
var hasA = cache.has(a);
|
|
163
|
+
var hasB = cache.has(b);
|
|
164
|
+
if (hasA || hasB) {
|
|
165
|
+
return hasA && hasB;
|
|
166
|
+
}
|
|
167
|
+
addToCache(a, cache);
|
|
168
|
+
addToCache(b, cache);
|
|
169
|
+
return _comparator(a, b, cache);
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @function toPairs
|
|
175
|
+
*
|
|
176
|
+
* @description
|
|
177
|
+
* convert the map passed into pairs (meaning an array of [key, value] tuples)
|
|
178
|
+
*
|
|
179
|
+
* @param map the map to convert to [key, value] pairs (entries)
|
|
180
|
+
* @returns the [key, value] pairs
|
|
181
|
+
*/
|
|
182
|
+
function toPairs(map) {
|
|
183
|
+
var pairs = new Array(map.size);
|
|
184
|
+
var index = 0;
|
|
185
|
+
map.forEach(function (value, key) {
|
|
186
|
+
pairs[index++] = [key, value];
|
|
187
|
+
});
|
|
188
|
+
return pairs;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @function toValues
|
|
192
|
+
*
|
|
193
|
+
* @description
|
|
194
|
+
* convert the set passed into values
|
|
195
|
+
*
|
|
196
|
+
* @param set the set to convert to values
|
|
197
|
+
* @returns the values
|
|
198
|
+
*/
|
|
199
|
+
function toValues(set) {
|
|
200
|
+
var values = new Array(set.size);
|
|
201
|
+
var index = 0;
|
|
202
|
+
set.forEach(function (value) {
|
|
203
|
+
values[index++] = value;
|
|
204
|
+
});
|
|
205
|
+
return values;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @function areArraysEqual
|
|
209
|
+
*
|
|
210
|
+
* @description
|
|
211
|
+
* are the arrays equal in value
|
|
212
|
+
*
|
|
213
|
+
* @param a the array to test
|
|
214
|
+
* @param b the array to test against
|
|
215
|
+
* @param isEqual the comparator to determine equality
|
|
216
|
+
* @param meta the meta object to pass through
|
|
217
|
+
* @returns are the arrays equal
|
|
218
|
+
*/
|
|
219
|
+
function areArraysEqual(a, b, isEqual, meta) {
|
|
220
|
+
var length = a.length;
|
|
221
|
+
if (b.length !== length) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
for (var index = 0; index < length; index++) {
|
|
225
|
+
if (!isEqual(a[index], b[index], meta)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @function areMapsEqual
|
|
233
|
+
*
|
|
234
|
+
* @description
|
|
235
|
+
* are the maps equal in value
|
|
236
|
+
*
|
|
237
|
+
* @param a the map to test
|
|
238
|
+
* @param b the map to test against
|
|
239
|
+
* @param isEqual the comparator to determine equality
|
|
240
|
+
* @param meta the meta map to pass through
|
|
241
|
+
* @returns are the maps equal
|
|
242
|
+
*/
|
|
243
|
+
function areMapsEqual(a, b, isEqual, meta) {
|
|
244
|
+
if (a.size !== b.size) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
var pairsA = toPairs(a);
|
|
248
|
+
var pairsB = toPairs(b);
|
|
249
|
+
var length = pairsA.length;
|
|
250
|
+
for (var index = 0; index < length; index++) {
|
|
251
|
+
if (!hasPair(pairsB, pairsA[index], isEqual, meta) ||
|
|
252
|
+
!hasPair(pairsA, pairsB[index], isEqual, meta)) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
var OWNER = '_owner';
|
|
259
|
+
var hasOwnProperty = Function.prototype.bind.call(Function.prototype.call, Object.prototype.hasOwnProperty);
|
|
260
|
+
/**
|
|
261
|
+
* @function areObjectsEqual
|
|
262
|
+
*
|
|
263
|
+
* @description
|
|
264
|
+
* are the objects equal in value
|
|
265
|
+
*
|
|
266
|
+
* @param a the object to test
|
|
267
|
+
* @param b the object to test against
|
|
268
|
+
* @param isEqual the comparator to determine equality
|
|
269
|
+
* @param meta the meta object to pass through
|
|
270
|
+
* @returns are the objects equal
|
|
271
|
+
*/
|
|
272
|
+
function areObjectsEqual(a, b, isEqual, meta) {
|
|
273
|
+
var keysA = keys(a);
|
|
274
|
+
var length = keysA.length;
|
|
275
|
+
if (keys(b).length !== length) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
var key;
|
|
279
|
+
for (var index = 0; index < length; index++) {
|
|
280
|
+
key = keysA[index];
|
|
281
|
+
if (!hasOwnProperty(b, key)) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
if (key === OWNER && isReactElement(a)) {
|
|
285
|
+
if (!isReactElement(b)) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (!isEqual(a[key], b[key], meta)) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @function areRegExpsEqual
|
|
297
|
+
*
|
|
298
|
+
* @description
|
|
299
|
+
* are the regExps equal in value
|
|
300
|
+
*
|
|
301
|
+
* @param a the regExp to test
|
|
302
|
+
* @param b the regExp to test agains
|
|
303
|
+
* @returns are the regExps equal
|
|
304
|
+
*/
|
|
305
|
+
function areRegExpsEqual(a, b) {
|
|
306
|
+
return (a.source === b.source &&
|
|
307
|
+
a.global === b.global &&
|
|
308
|
+
a.ignoreCase === b.ignoreCase &&
|
|
309
|
+
a.multiline === b.multiline &&
|
|
310
|
+
a.unicode === b.unicode &&
|
|
311
|
+
a.sticky === b.sticky &&
|
|
312
|
+
a.lastIndex === b.lastIndex);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* @function areSetsEqual
|
|
316
|
+
*
|
|
317
|
+
* @description
|
|
318
|
+
* are the sets equal in value
|
|
319
|
+
*
|
|
320
|
+
* @param a the set to test
|
|
321
|
+
* @param b the set to test against
|
|
322
|
+
* @param isEqual the comparator to determine equality
|
|
323
|
+
* @param meta the meta set to pass through
|
|
324
|
+
* @returns are the sets equal
|
|
325
|
+
*/
|
|
326
|
+
function areSetsEqual(a, b, isEqual, meta) {
|
|
327
|
+
if (a.size !== b.size) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
var valuesA = toValues(a);
|
|
331
|
+
var valuesB = toValues(b);
|
|
332
|
+
var length = valuesA.length;
|
|
333
|
+
for (var index = 0; index < length; index++) {
|
|
334
|
+
if (!hasValue(valuesB, valuesA[index], isEqual, meta) ||
|
|
335
|
+
!hasValue(valuesA, valuesB[index], isEqual, meta)) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var isArray = Array.isArray;
|
|
343
|
+
var HAS_MAP_SUPPORT = typeof Map === 'function';
|
|
344
|
+
var HAS_SET_SUPPORT = typeof Set === 'function';
|
|
345
|
+
var OBJECT_TYPEOF = 'object';
|
|
346
|
+
function createComparator(createIsEqual) {
|
|
347
|
+
var isEqual =
|
|
348
|
+
/* eslint-disable no-use-before-define */
|
|
349
|
+
typeof createIsEqual === 'function'
|
|
350
|
+
? createIsEqual(comparator)
|
|
351
|
+
: comparator;
|
|
352
|
+
/* eslint-enable */
|
|
353
|
+
/**
|
|
354
|
+
* @function comparator
|
|
355
|
+
*
|
|
356
|
+
* @description
|
|
357
|
+
* compare the value of the two objects and return true if they are equivalent in values
|
|
358
|
+
*
|
|
359
|
+
* @param a the value to test against
|
|
360
|
+
* @param b the value to test
|
|
361
|
+
* @param [meta] an optional meta object that is passed through to all equality test calls
|
|
362
|
+
* @returns are a and b equivalent in value
|
|
363
|
+
*/
|
|
364
|
+
function comparator(a, b, meta) {
|
|
365
|
+
if (sameValueZeroEqual(a, b)) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
if (a && b && typeof a === OBJECT_TYPEOF && typeof b === OBJECT_TYPEOF) {
|
|
369
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
370
|
+
return areObjectsEqual(a, b, isEqual, meta);
|
|
371
|
+
}
|
|
372
|
+
var arrayA = isArray(a);
|
|
373
|
+
var arrayB = isArray(b);
|
|
374
|
+
if (arrayA || arrayB) {
|
|
375
|
+
return arrayA === arrayB && areArraysEqual(a, b, isEqual, meta);
|
|
376
|
+
}
|
|
377
|
+
var aDate = a instanceof Date;
|
|
378
|
+
var bDate = b instanceof Date;
|
|
379
|
+
if (aDate || bDate) {
|
|
380
|
+
return aDate === bDate && sameValueZeroEqual(a.getTime(), b.getTime());
|
|
381
|
+
}
|
|
382
|
+
var aRegExp = a instanceof RegExp;
|
|
383
|
+
var bRegExp = b instanceof RegExp;
|
|
384
|
+
if (aRegExp || bRegExp) {
|
|
385
|
+
return aRegExp === bRegExp && areRegExpsEqual(a, b);
|
|
386
|
+
}
|
|
387
|
+
if (isPromiseLike(a) || isPromiseLike(b)) {
|
|
388
|
+
return a === b;
|
|
389
|
+
}
|
|
390
|
+
if (HAS_MAP_SUPPORT) {
|
|
391
|
+
var aMap = a instanceof Map;
|
|
392
|
+
var bMap = b instanceof Map;
|
|
393
|
+
if (aMap || bMap) {
|
|
394
|
+
return aMap === bMap && areMapsEqual(a, b, isEqual, meta);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (HAS_SET_SUPPORT) {
|
|
398
|
+
var aSet = a instanceof Set;
|
|
399
|
+
var bSet = b instanceof Set;
|
|
400
|
+
if (aSet || bSet) {
|
|
401
|
+
return aSet === bSet && areSetsEqual(a, b, isEqual, meta);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return areObjectsEqual(a, b, isEqual, meta);
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
return comparator;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// comparator
|
|
412
|
+
var deepEqual = createComparator();
|
|
413
|
+
var shallowEqual = createComparator(function () { return sameValueZeroEqual; });
|
|
414
|
+
var circularDeepEqual = createComparator(createCircularEqualCreator());
|
|
415
|
+
var circularShallowEqual = createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
|
8
416
|
|
|
9
|
-
var HAS_SET_SUPPORT = typeof Set === 'function';
|
|
10
|
-
/**
|
|
11
|
-
* @constant {boolean} HAS_WEAKSET_SUPPORT
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
var HAS_WEAKSET_SUPPORT = typeof WeakSet === 'function';
|
|
15
|
-
|
|
16
|
-
// constants
|
|
17
|
-
var keys = Object.keys;
|
|
18
|
-
/**
|
|
19
|
-
* @function addObjectToCache
|
|
20
|
-
*
|
|
21
|
-
* @description
|
|
22
|
-
* add object to cache if it is indeed an object
|
|
23
|
-
*
|
|
24
|
-
* @param {any} object the object to potentially add to the cache
|
|
25
|
-
* @param {Object|WeakSet} cache the cache to add to
|
|
26
|
-
* @returns {void}
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var addObjectToCache = function addObjectToCache(object, cache) {
|
|
30
|
-
return object && typeof object === 'object' && cache.add(object);
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param {Array<Array<any>>} pairs the pairs to check in
|
|
35
|
-
* @param {Array<any>} pairToMatch the pair to check if exists
|
|
36
|
-
* @param {function} isEqual the equality comparator
|
|
37
|
-
* @param {any} meta the meta item to pass through
|
|
38
|
-
* @returns {boolean} does the pair exist in the pairs
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
var hasPair = function hasPair(pairs, pairToMatch, isEqual, meta) {
|
|
42
|
-
var pair;
|
|
43
|
-
|
|
44
|
-
for (var index = 0; index < pairs.length; index++) {
|
|
45
|
-
pair = pairs[index];
|
|
46
|
-
|
|
47
|
-
if (isEqual(pair[0], pairToMatch[0], meta) && isEqual(pair[1], pairToMatch[1], meta)) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return false;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* @function hasValue
|
|
56
|
-
*
|
|
57
|
-
* @description
|
|
58
|
-
* does the values include the vakye passed
|
|
59
|
-
*
|
|
60
|
-
* @param {Array<any>} values the values to check in
|
|
61
|
-
* @param {any} item the value to locate
|
|
62
|
-
* @param {function} isEqual the equality comparator
|
|
63
|
-
* @param {any} meta the meta item to pass through
|
|
64
|
-
* @returns {boolean} does the value exist in the values
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
var hasValue = function hasValue(values, item, isEqual, meta) {
|
|
68
|
-
for (var index = 0; index < values.length; index++) {
|
|
69
|
-
if (isEqual(values[index], item, meta)) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return false;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* @function sameValueZeroEqual
|
|
78
|
-
*
|
|
79
|
-
* @description
|
|
80
|
-
* are the objects passed strictly equal or both NaN
|
|
81
|
-
*
|
|
82
|
-
* @param {any} objectA the object to compare against
|
|
83
|
-
* @param {any} objectB the object to test
|
|
84
|
-
* @returns {boolean} are the objects equal by the SameValueZero principle
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
var sameValueZeroEqual = function sameValueZeroEqual(objectA, objectB) {
|
|
88
|
-
return objectA === objectB || objectA !== objectA && objectB !== objectB;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* @function isPlainObject
|
|
92
|
-
*
|
|
93
|
-
* @description
|
|
94
|
-
* is the object a plain object
|
|
95
|
-
*
|
|
96
|
-
* @param {any} object the object to test
|
|
97
|
-
* @returns {boolean} is the object a plain object
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
var isPlainObject = function isPlainObject(object) {
|
|
101
|
-
return object.constructor === Object;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* @function isPromiseLike
|
|
105
|
-
*
|
|
106
|
-
* @description
|
|
107
|
-
* is the object promise-like (thenable)
|
|
108
|
-
*
|
|
109
|
-
* @param {any} object the object to test
|
|
110
|
-
* @returns {boolean} is the object promise-like
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
var isPromiseLike = function isPromiseLike(object) {
|
|
114
|
-
return typeof object.then === 'function';
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* @function isReactElement
|
|
118
|
-
*
|
|
119
|
-
* @description
|
|
120
|
-
* is the object passed a react element
|
|
121
|
-
*
|
|
122
|
-
* @param {any} object the object to test
|
|
123
|
-
* @returns {boolean} is the object a react element
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
var isReactElement = function isReactElement(object) {
|
|
127
|
-
return !!(object.$$typeof && object._store);
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* @function getNewCache
|
|
131
|
-
*
|
|
132
|
-
* @description
|
|
133
|
-
* get a new cache object to prevent circular references
|
|
134
|
-
*
|
|
135
|
-
* @returns {Object|Weakset} the new cache object
|
|
136
|
-
*/
|
|
137
|
-
|
|
138
|
-
var getNewCache = function getNewCache() {
|
|
139
|
-
return HAS_WEAKSET_SUPPORT ? new WeakSet() : Object.create({
|
|
140
|
-
_values: [],
|
|
141
|
-
add: function add(value) {
|
|
142
|
-
this._values.push(value);
|
|
143
|
-
},
|
|
144
|
-
has: function has(value) {
|
|
145
|
-
return !!~this._values.indexOf(value);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* @function createCircularEqual
|
|
151
|
-
*
|
|
152
|
-
* @description
|
|
153
|
-
* create a custom isEqual handler specific to circular objects
|
|
154
|
-
*
|
|
155
|
-
* @param {funtion} [isEqual] the isEqual comparator to use instead of isDeepEqual
|
|
156
|
-
* @returns {function(any, any): boolean}
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
var createCircularEqual = function createCircularEqual(isEqual) {
|
|
160
|
-
return function (isDeepEqual) {
|
|
161
|
-
var comparator = isEqual || isDeepEqual;
|
|
162
|
-
return function (objectA, objectB, cache) {
|
|
163
|
-
if (cache === void 0) {
|
|
164
|
-
cache = getNewCache();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
var cacheHasA = cache.has(objectA);
|
|
168
|
-
var cacheHasB = cache.has(objectB);
|
|
169
|
-
|
|
170
|
-
if (cacheHasA || cacheHasB) {
|
|
171
|
-
return cacheHasA && cacheHasB;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
addObjectToCache(objectA, cache);
|
|
175
|
-
addObjectToCache(objectB, cache);
|
|
176
|
-
return comparator(objectA, objectB, cache);
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* @function toPairs
|
|
182
|
-
*
|
|
183
|
-
* @param {Map} map the map to convert to [key, value] pairs (entries)
|
|
184
|
-
* @returns {Array<Array<*>>} the [key, value] pairs
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
var toPairs = function toPairs(map) {
|
|
188
|
-
var pairs = [];
|
|
189
|
-
map.forEach(function (value, key) {
|
|
190
|
-
return pairs.push([key, value]);
|
|
191
|
-
});
|
|
192
|
-
return pairs;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* @function toValues
|
|
196
|
-
*
|
|
197
|
-
* @param {Set} set the set to convert to values
|
|
198
|
-
* @returns {Array<*>} the values
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
var toValues = function toValues(set) {
|
|
202
|
-
var values = [];
|
|
203
|
-
set.forEach(function (value) {
|
|
204
|
-
return values.push(value);
|
|
205
|
-
});
|
|
206
|
-
return values;
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* @function areArraysEqual
|
|
210
|
-
*
|
|
211
|
-
* @description
|
|
212
|
-
* are the arrays equal in value
|
|
213
|
-
*
|
|
214
|
-
* @param {Array<any>} arrayA the array to test
|
|
215
|
-
* @param {Array<any>} arrayB the array to test against
|
|
216
|
-
* @param {function} isEqual the comparator to determine equality
|
|
217
|
-
* @param {any} meta the meta object to pass through
|
|
218
|
-
* @returns {boolean} are the arrays equal
|
|
219
|
-
*/
|
|
220
|
-
|
|
221
|
-
var areArraysEqual = function areArraysEqual(arrayA, arrayB, isEqual, meta) {
|
|
222
|
-
if (arrayA.length !== arrayB.length) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
for (var index = 0; index < arrayA.length; index++) {
|
|
227
|
-
if (!isEqual(arrayA[index], arrayB[index], meta)) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return true;
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* @function areMapsEqual
|
|
236
|
-
*
|
|
237
|
-
* @description
|
|
238
|
-
* are the maps equal in value
|
|
239
|
-
*
|
|
240
|
-
* @param {Map} mapA the map to test
|
|
241
|
-
* @param {Map} mapB the map to test against
|
|
242
|
-
* @param {function} isEqual the comparator to determine equality
|
|
243
|
-
* @param {any} meta the meta map to pass through
|
|
244
|
-
* @returns {boolean} are the maps equal
|
|
245
|
-
*/
|
|
246
|
-
|
|
247
|
-
var areMapsEqual = function areMapsEqual(mapA, mapB, isEqual, meta) {
|
|
248
|
-
if (mapA.size !== mapB.size) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
var pairsA = toPairs(mapA);
|
|
253
|
-
var pairsB = toPairs(mapB);
|
|
254
|
-
|
|
255
|
-
for (var index = 0; index < pairsA.length; index++) {
|
|
256
|
-
if (!hasPair(pairsB, pairsA[index], isEqual, meta) || !hasPair(pairsA, pairsB[index], isEqual, meta)) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return true;
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* @function areObjectsEqual
|
|
265
|
-
*
|
|
266
|
-
* @description
|
|
267
|
-
* are the objects equal in value
|
|
268
|
-
*
|
|
269
|
-
* @param {Object} objectA the object to test
|
|
270
|
-
* @param {Object} objectB the object to test against
|
|
271
|
-
* @param {function} isEqual the comparator to determine equality
|
|
272
|
-
* @param {any} meta the meta object to pass through
|
|
273
|
-
* @returns {boolean} are the objects equal
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
var areObjectsEqual = function areObjectsEqual(objectA, objectB, isEqual, meta) {
|
|
277
|
-
var keysA = keys(objectA);
|
|
278
|
-
var keysB = keys(objectB);
|
|
279
|
-
|
|
280
|
-
if (keysA.length !== keysB.length) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
var key;
|
|
285
|
-
|
|
286
|
-
for (var index = 0; index < keysA.length; index++) {
|
|
287
|
-
key = keysA[index];
|
|
288
|
-
|
|
289
|
-
if (!hasValue(keysB, key, sameValueZeroEqual)) {
|
|
290
|
-
return false;
|
|
291
|
-
} // if a react element, ignore the "_owner" key because its not necessary for equality comparisons
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (key === '_owner' && isReactElement(objectA) && isReactElement(objectB)) {
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (!isEqual(objectA[key], objectB[key], meta)) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
return true;
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* @function areRegExpsEqual
|
|
307
|
-
*
|
|
308
|
-
* @description
|
|
309
|
-
* are the regExps equal in value
|
|
310
|
-
*
|
|
311
|
-
* @param {RegExp} regExpA the regExp to test
|
|
312
|
-
* @param {RegExp} regExpB the regExp to test agains
|
|
313
|
-
* @returns {boolean} are the regExps equal
|
|
314
|
-
*/
|
|
315
|
-
|
|
316
|
-
var areRegExpsEqual = function areRegExpsEqual(regExpA, regExpB) {
|
|
317
|
-
return regExpA.source === regExpB.source && regExpA.global === regExpB.global && regExpA.ignoreCase === regExpB.ignoreCase && regExpA.multiline === regExpB.multiline && regExpA.unicode === regExpB.unicode && regExpA.sticky === regExpB.sticky && regExpA.lastIndex === regExpB.lastIndex;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* @function areSetsEqual
|
|
321
|
-
*
|
|
322
|
-
* @description
|
|
323
|
-
* are the sets equal in value
|
|
324
|
-
*
|
|
325
|
-
* @param {Set} setA the set to test
|
|
326
|
-
* @param {Set} setB the set to test against
|
|
327
|
-
* @param {function} isEqual the comparator to determine equality
|
|
328
|
-
* @param {any} meta the meta set to pass through
|
|
329
|
-
* @returns {boolean} are the sets equal
|
|
330
|
-
*/
|
|
331
|
-
|
|
332
|
-
var areSetsEqual = function areSetsEqual(setA, setB, isEqual, meta) {
|
|
333
|
-
if (setA.size !== setB.size) {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
var valuesA = toValues(setA);
|
|
338
|
-
var valuesB = toValues(setB);
|
|
339
|
-
|
|
340
|
-
for (var index = 0; index < valuesA.length; index++) {
|
|
341
|
-
if (!hasValue(valuesB, valuesA[index], isEqual, meta) || !hasValue(valuesA, valuesB[index], isEqual, meta)) {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return true;
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
// constants
|
|
350
|
-
var isArray = Array.isArray;
|
|
351
|
-
|
|
352
|
-
var createComparator = function createComparator(createIsEqual) {
|
|
353
|
-
// eslint-disable-next-line no-use-before-define
|
|
354
|
-
var isEqual = typeof createIsEqual === 'function' ? createIsEqual(comparator) : comparator;
|
|
355
|
-
/**
|
|
356
|
-
* @function comparator
|
|
357
|
-
*
|
|
358
|
-
* @description
|
|
359
|
-
* compare the value of the two objects and return true if they are equivalent in values
|
|
360
|
-
*
|
|
361
|
-
* @param {any} objectA the object to test against
|
|
362
|
-
* @param {any} objectB the object to test
|
|
363
|
-
* @param {any} [meta] an optional meta object that is passed through to all equality test calls
|
|
364
|
-
* @returns {boolean} are objectA and objectB equivalent in value
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
function comparator(objectA, objectB, meta) {
|
|
368
|
-
if (sameValueZeroEqual(objectA, objectB)) {
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
var typeOfA = typeof objectA;
|
|
373
|
-
|
|
374
|
-
if (typeOfA !== typeof objectB || typeOfA !== 'object' || !objectA || !objectB) {
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
if (isPlainObject(objectA) && isPlainObject(objectB)) {
|
|
379
|
-
return areObjectsEqual(objectA, objectB, isEqual, meta);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
var arrayA = isArray(objectA);
|
|
383
|
-
var arrayB = isArray(objectB);
|
|
384
|
-
|
|
385
|
-
if (arrayA || arrayB) {
|
|
386
|
-
return arrayA === arrayB && areArraysEqual(objectA, objectB, isEqual, meta);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
var dateA = objectA instanceof Date;
|
|
390
|
-
var dateB = objectB instanceof Date;
|
|
391
|
-
|
|
392
|
-
if (dateA || dateB) {
|
|
393
|
-
return dateA === dateB && sameValueZeroEqual(objectA.getTime(), objectB.getTime());
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
var regexpA = objectA instanceof RegExp;
|
|
397
|
-
var regexpB = objectB instanceof RegExp;
|
|
398
|
-
|
|
399
|
-
if (regexpA || regexpB) {
|
|
400
|
-
return regexpA === regexpB && areRegExpsEqual(objectA, objectB);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
if (isPromiseLike(objectA) || isPromiseLike(objectB)) {
|
|
404
|
-
return objectA === objectB;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
if (HAS_MAP_SUPPORT) {
|
|
408
|
-
var mapA = objectA instanceof Map;
|
|
409
|
-
var mapB = objectB instanceof Map;
|
|
410
|
-
|
|
411
|
-
if (mapA || mapB) {
|
|
412
|
-
return mapA === mapB && areMapsEqual(objectA, objectB, isEqual, meta);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (HAS_SET_SUPPORT) {
|
|
417
|
-
var setA = objectA instanceof Set;
|
|
418
|
-
var setB = objectB instanceof Set;
|
|
419
|
-
|
|
420
|
-
if (setA || setB) {
|
|
421
|
-
return setA === setB && areSetsEqual(objectA, objectB, isEqual, meta);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return areObjectsEqual(objectA, objectB, isEqual, meta);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
return comparator;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
// comparator
|
|
432
|
-
var circularDeepEqual = createComparator(createCircularEqual());
|
|
433
|
-
var circularShallowEqual = createComparator(createCircularEqual(sameValueZeroEqual));
|
|
434
|
-
var deepEqual = createComparator();
|
|
435
|
-
var shallowEqual = createComparator(function () {
|
|
436
|
-
return sameValueZeroEqual;
|
|
437
|
-
});
|
|
438
|
-
var index = {
|
|
439
|
-
circularDeep: circularDeepEqual,
|
|
440
|
-
circularShallow: circularShallowEqual,
|
|
441
|
-
createCustom: createComparator,
|
|
442
|
-
deep: deepEqual,
|
|
443
|
-
sameValueZero: sameValueZeroEqual,
|
|
444
|
-
shallow: shallowEqual
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
export default index;
|
|
448
417
|
export { circularDeepEqual, circularShallowEqual, createComparator as createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual };
|
|
449
418
|
//# sourceMappingURL=fast-equals.esm.js.map
|