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/mjs/utils.mjs
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
// constants
|
|
2
|
-
import { HAS_WEAKSET_SUPPORT } from './constants';
|
|
3
|
-
var keys = Object.keys;
|
|
4
|
-
/**
|
|
5
|
-
* @function addObjectToCache
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* add object to cache if it is indeed an object
|
|
9
|
-
*
|
|
10
|
-
* @param {any} object the object to potentially add to the cache
|
|
11
|
-
* @param {Object|WeakSet} cache the cache to add to
|
|
12
|
-
* @returns {void}
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export var addObjectToCache = function addObjectToCache(object, cache) {
|
|
16
|
-
return object && typeof object === 'object' && cache.add(object);
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {Array<Array<any>>} pairs the pairs to check in
|
|
21
|
-
* @param {Array<any>} pairToMatch the pair to check if exists
|
|
22
|
-
* @param {function} isEqual the equality comparator
|
|
23
|
-
* @param {any} meta the meta item to pass through
|
|
24
|
-
* @returns {boolean} does the pair exist in the pairs
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
export var hasPair = function hasPair(pairs, pairToMatch, isEqual, meta) {
|
|
28
|
-
var pair;
|
|
29
|
-
|
|
30
|
-
for (var index = 0; index < pairs.length; index++) {
|
|
31
|
-
pair = pairs[index];
|
|
32
|
-
|
|
33
|
-
if (isEqual(pair[0], pairToMatch[0], meta) && isEqual(pair[1], pairToMatch[1], meta)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return false;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* @function hasValue
|
|
42
|
-
*
|
|
43
|
-
* @description
|
|
44
|
-
* does the values include the vakye passed
|
|
45
|
-
*
|
|
46
|
-
* @param {Array<any>} values the values to check in
|
|
47
|
-
* @param {any} item the value to locate
|
|
48
|
-
* @param {function} isEqual the equality comparator
|
|
49
|
-
* @param {any} meta the meta item to pass through
|
|
50
|
-
* @returns {boolean} does the value exist in the values
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export var hasValue = function hasValue(values, item, isEqual, meta) {
|
|
54
|
-
for (var index = 0; index < values.length; index++) {
|
|
55
|
-
if (isEqual(values[index], item, meta)) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return false;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* @function sameValueZeroEqual
|
|
64
|
-
*
|
|
65
|
-
* @description
|
|
66
|
-
* are the objects passed strictly equal or both NaN
|
|
67
|
-
*
|
|
68
|
-
* @param {any} objectA the object to compare against
|
|
69
|
-
* @param {any} objectB the object to test
|
|
70
|
-
* @returns {boolean} are the objects equal by the SameValueZero principle
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
export var sameValueZeroEqual = function sameValueZeroEqual(objectA, objectB) {
|
|
74
|
-
return objectA === objectB || objectA !== objectA && objectB !== objectB;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* @function isPlainObject
|
|
78
|
-
*
|
|
79
|
-
* @description
|
|
80
|
-
* is the object a plain object
|
|
81
|
-
*
|
|
82
|
-
* @param {any} object the object to test
|
|
83
|
-
* @returns {boolean} is the object a plain object
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
export var isPlainObject = function isPlainObject(object) {
|
|
87
|
-
return object.constructor === Object;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* @function isPromiseLike
|
|
91
|
-
*
|
|
92
|
-
* @description
|
|
93
|
-
* is the object promise-like (thenable)
|
|
94
|
-
*
|
|
95
|
-
* @param {any} object the object to test
|
|
96
|
-
* @returns {boolean} is the object promise-like
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
export var isPromiseLike = function isPromiseLike(object) {
|
|
100
|
-
return typeof object.then === 'function';
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* @function isReactElement
|
|
104
|
-
*
|
|
105
|
-
* @description
|
|
106
|
-
* is the object passed a react element
|
|
107
|
-
*
|
|
108
|
-
* @param {any} object the object to test
|
|
109
|
-
* @returns {boolean} is the object a react element
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
export var isReactElement = function isReactElement(object) {
|
|
113
|
-
return !!(object.$$typeof && object._store);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* @function getNewCache
|
|
117
|
-
*
|
|
118
|
-
* @description
|
|
119
|
-
* get a new cache object to prevent circular references
|
|
120
|
-
*
|
|
121
|
-
* @returns {Object|Weakset} the new cache object
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
export var getNewCache = function getNewCache() {
|
|
125
|
-
return HAS_WEAKSET_SUPPORT ? new WeakSet() : Object.create({
|
|
126
|
-
_values: [],
|
|
127
|
-
add: function add(value) {
|
|
128
|
-
this._values.push(value);
|
|
129
|
-
},
|
|
130
|
-
has: function has(value) {
|
|
131
|
-
return !!~this._values.indexOf(value);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* @function createCircularEqual
|
|
137
|
-
*
|
|
138
|
-
* @description
|
|
139
|
-
* create a custom isEqual handler specific to circular objects
|
|
140
|
-
*
|
|
141
|
-
* @param {funtion} [isEqual] the isEqual comparator to use instead of isDeepEqual
|
|
142
|
-
* @returns {function(any, any): boolean}
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
export var createCircularEqual = function createCircularEqual(isEqual) {
|
|
146
|
-
return function (isDeepEqual) {
|
|
147
|
-
var comparator = isEqual || isDeepEqual;
|
|
148
|
-
return function (objectA, objectB, cache) {
|
|
149
|
-
if (cache === void 0) {
|
|
150
|
-
cache = getNewCache();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
var cacheHasA = cache.has(objectA);
|
|
154
|
-
var cacheHasB = cache.has(objectB);
|
|
155
|
-
|
|
156
|
-
if (cacheHasA || cacheHasB) {
|
|
157
|
-
return cacheHasA && cacheHasB;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
addObjectToCache(objectA, cache);
|
|
161
|
-
addObjectToCache(objectB, cache);
|
|
162
|
-
return comparator(objectA, objectB, cache);
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* @function toPairs
|
|
168
|
-
*
|
|
169
|
-
* @param {Map} map the map to convert to [key, value] pairs (entries)
|
|
170
|
-
* @returns {Array<Array<*>>} the [key, value] pairs
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
export var toPairs = function toPairs(map) {
|
|
174
|
-
var pairs = [];
|
|
175
|
-
map.forEach(function (value, key) {
|
|
176
|
-
return pairs.push([key, value]);
|
|
177
|
-
});
|
|
178
|
-
return pairs;
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* @function toValues
|
|
182
|
-
*
|
|
183
|
-
* @param {Set} set the set to convert to values
|
|
184
|
-
* @returns {Array<*>} the values
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
export var toValues = function toValues(set) {
|
|
188
|
-
var values = [];
|
|
189
|
-
set.forEach(function (value) {
|
|
190
|
-
return values.push(value);
|
|
191
|
-
});
|
|
192
|
-
return values;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* @function areArraysEqual
|
|
196
|
-
*
|
|
197
|
-
* @description
|
|
198
|
-
* are the arrays equal in value
|
|
199
|
-
*
|
|
200
|
-
* @param {Array<any>} arrayA the array to test
|
|
201
|
-
* @param {Array<any>} arrayB the array to test against
|
|
202
|
-
* @param {function} isEqual the comparator to determine equality
|
|
203
|
-
* @param {any} meta the meta object to pass through
|
|
204
|
-
* @returns {boolean} are the arrays equal
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
export var areArraysEqual = function areArraysEqual(arrayA, arrayB, isEqual, meta) {
|
|
208
|
-
if (arrayA.length !== arrayB.length) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
for (var index = 0; index < arrayA.length; index++) {
|
|
213
|
-
if (!isEqual(arrayA[index], arrayB[index], meta)) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return true;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* @function areMapsEqual
|
|
222
|
-
*
|
|
223
|
-
* @description
|
|
224
|
-
* are the maps equal in value
|
|
225
|
-
*
|
|
226
|
-
* @param {Map} mapA the map to test
|
|
227
|
-
* @param {Map} mapB the map to test against
|
|
228
|
-
* @param {function} isEqual the comparator to determine equality
|
|
229
|
-
* @param {any} meta the meta map to pass through
|
|
230
|
-
* @returns {boolean} are the maps equal
|
|
231
|
-
*/
|
|
232
|
-
|
|
233
|
-
export var areMapsEqual = function areMapsEqual(mapA, mapB, isEqual, meta) {
|
|
234
|
-
if (mapA.size !== mapB.size) {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
var pairsA = toPairs(mapA);
|
|
239
|
-
var pairsB = toPairs(mapB);
|
|
240
|
-
|
|
241
|
-
for (var index = 0; index < pairsA.length; index++) {
|
|
242
|
-
if (!hasPair(pairsB, pairsA[index], isEqual, meta) || !hasPair(pairsA, pairsB[index], isEqual, meta)) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return true;
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* @function areObjectsEqual
|
|
251
|
-
*
|
|
252
|
-
* @description
|
|
253
|
-
* are the objects equal in value
|
|
254
|
-
*
|
|
255
|
-
* @param {Object} objectA the object to test
|
|
256
|
-
* @param {Object} objectB the object to test against
|
|
257
|
-
* @param {function} isEqual the comparator to determine equality
|
|
258
|
-
* @param {any} meta the meta object to pass through
|
|
259
|
-
* @returns {boolean} are the objects equal
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
|
-
export var areObjectsEqual = function areObjectsEqual(objectA, objectB, isEqual, meta) {
|
|
263
|
-
var keysA = keys(objectA);
|
|
264
|
-
var keysB = keys(objectB);
|
|
265
|
-
|
|
266
|
-
if (keysA.length !== keysB.length) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
var key;
|
|
271
|
-
|
|
272
|
-
for (var index = 0; index < keysA.length; index++) {
|
|
273
|
-
key = keysA[index];
|
|
274
|
-
|
|
275
|
-
if (!hasValue(keysB, key, sameValueZeroEqual)) {
|
|
276
|
-
return false;
|
|
277
|
-
} // if a react element, ignore the "_owner" key because its not necessary for equality comparisons
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (key === '_owner' && isReactElement(objectA) && isReactElement(objectB)) {
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (!isEqual(objectA[key], objectB[key], meta)) {
|
|
285
|
-
return false;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return true;
|
|
290
|
-
};
|
|
291
|
-
/**
|
|
292
|
-
* @function areRegExpsEqual
|
|
293
|
-
*
|
|
294
|
-
* @description
|
|
295
|
-
* are the regExps equal in value
|
|
296
|
-
*
|
|
297
|
-
* @param {RegExp} regExpA the regExp to test
|
|
298
|
-
* @param {RegExp} regExpB the regExp to test agains
|
|
299
|
-
* @returns {boolean} are the regExps equal
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
export var areRegExpsEqual = function areRegExpsEqual(regExpA, regExpB) {
|
|
303
|
-
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;
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* @function areSetsEqual
|
|
307
|
-
*
|
|
308
|
-
* @description
|
|
309
|
-
* are the sets equal in value
|
|
310
|
-
*
|
|
311
|
-
* @param {Set} setA the set to test
|
|
312
|
-
* @param {Set} setB the set to test against
|
|
313
|
-
* @param {function} isEqual the comparator to determine equality
|
|
314
|
-
* @param {any} meta the meta set to pass through
|
|
315
|
-
* @returns {boolean} are the sets equal
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
export var areSetsEqual = function areSetsEqual(setA, setB, isEqual, meta) {
|
|
319
|
-
if (setA.size !== setB.size) {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
var valuesA = toValues(setA);
|
|
324
|
-
var valuesB = toValues(setB);
|
|
325
|
-
|
|
326
|
-
for (var index = 0; index < valuesA.length; index++) {
|
|
327
|
-
if (!hasValue(valuesB, valuesA[index], isEqual, meta) || !hasValue(valuesA, valuesB[index], isEqual, meta)) {
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
return true;
|
|
333
|
-
};
|
package/rollup.config.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import babel from 'rollup-plugin-babel';
|
|
2
|
-
import resolve from 'rollup-plugin-node-resolve';
|
|
3
|
-
import {terser} from 'rollup-plugin-terser';
|
|
4
|
-
|
|
5
|
-
import pkg from './package.json';
|
|
6
|
-
|
|
7
|
-
const UMD_CONFIG = {
|
|
8
|
-
input: 'src/index.js',
|
|
9
|
-
output: {
|
|
10
|
-
exports: 'named',
|
|
11
|
-
file: pkg.browser,
|
|
12
|
-
format: 'umd',
|
|
13
|
-
name: pkg.name,
|
|
14
|
-
sourcemap: true,
|
|
15
|
-
},
|
|
16
|
-
plugins: [
|
|
17
|
-
resolve({
|
|
18
|
-
main: true,
|
|
19
|
-
module: true,
|
|
20
|
-
}),
|
|
21
|
-
babel({
|
|
22
|
-
exclude: 'node_modules/**',
|
|
23
|
-
}),
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const FORMATTED_CONFIG = {
|
|
28
|
-
...UMD_CONFIG,
|
|
29
|
-
output: [
|
|
30
|
-
{
|
|
31
|
-
...UMD_CONFIG.output,
|
|
32
|
-
file: pkg.main,
|
|
33
|
-
format: 'cjs',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
...UMD_CONFIG.output,
|
|
37
|
-
file: pkg.module,
|
|
38
|
-
format: 'es',
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default [
|
|
44
|
-
UMD_CONFIG,
|
|
45
|
-
FORMATTED_CONFIG,
|
|
46
|
-
{
|
|
47
|
-
...UMD_CONFIG,
|
|
48
|
-
output: {
|
|
49
|
-
...UMD_CONFIG.output,
|
|
50
|
-
file: pkg.browser.replace('.js', '.min.js'),
|
|
51
|
-
sourcemap: false,
|
|
52
|
-
},
|
|
53
|
-
plugins: [...UMD_CONFIG.plugins, terser()],
|
|
54
|
-
},
|
|
55
|
-
];
|