@kato-lee/utilities 1.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/LICENSE +21 -0
- package/README.md +9 -0
- package/_either.d.ts +12 -0
- package/_group-by-key.d.ts +6 -0
- package/_lodash.d.ts +71 -0
- package/_path.d.ts +1 -0
- package/esm2022/_either.mjs +49 -0
- package/esm2022/_group-by-key.mjs +19 -0
- package/esm2022/_lodash.mjs +91 -0
- package/esm2022/_path.mjs +17 -0
- package/esm2022/index.mjs +8 -0
- package/esm2022/js/_clone-deep.mjs +619 -0
- package/esm2022/js/_order-by.mjs +948 -0
- package/esm2022/kato-lee-utilities.mjs +5 -0
- package/fesm2022/kato-lee-utilities.mjs +1749 -0
- package/fesm2022/kato-lee-utilities.mjs.map +1 -0
- package/index.d.ts +4 -0
- package/js/_clone-deep.d.ts +2 -0
- package/js/_clone-deep.js +826 -0
- package/js/_order-by.d.ts +2 -0
- package/js/_order-by.js +1287 -0
- package/js/index.js +2 -0
- package/package.json +18 -0
|
@@ -0,0 +1,1749 @@
|
|
|
1
|
+
function groupByKey(data, columnWithKey, columnWithName) {
|
|
2
|
+
const newArray = [];
|
|
3
|
+
const dataFrezzed = Object.freeze(data);
|
|
4
|
+
dataFrezzed.forEach(el => {
|
|
5
|
+
const tempArray = newArray.filter(j => j.key === el[columnWithKey]);
|
|
6
|
+
if (tempArray.length > 0) {
|
|
7
|
+
newArray[newArray.indexOf(tempArray[0])].rows.push(el);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
newArray.push({
|
|
11
|
+
key: el[columnWithKey],
|
|
12
|
+
name: el[columnWithName || columnWithKey],
|
|
13
|
+
rows: [el],
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return newArray;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let LARGE_ARRAY_SIZE$1 = 200;
|
|
21
|
+
let HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
22
|
+
let MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
23
|
+
let argsTag$1 = '[object Arguments]', arrayTag$1 = '[object Array]', boolTag$1 = '[object Boolean]', dateTag$1 = '[object Date]', errorTag$1 = '[object Error]', funcTag$1 = '[object Function]', genTag$1 = '[object GeneratorFunction]', mapTag$1 = '[object Map]', numberTag$1 = '[object Number]', objectTag$1 = '[object Object]', promiseTag$1 = '[object Promise]', regexpTag$1 = '[object RegExp]', setTag$1 = '[object Set]', stringTag$1 = '[object String]', symbolTag$1 = '[object Symbol]', weakMapTag$1 = '[object WeakMap]';
|
|
24
|
+
let arrayBufferTag$1 = '[object ArrayBuffer]', dataViewTag$1 = '[object DataView]', float32Tag$1 = '[object Float32Array]', float64Tag$1 = '[object Float64Array]', int8Tag$1 = '[object Int8Array]', int16Tag$1 = '[object Int16Array]', int32Tag$1 = '[object Int32Array]', uint8Tag$1 = '[object Uint8Array]', uint8ClampedTag$1 = '[object Uint8ClampedArray]', uint16Tag$1 = '[object Uint16Array]', uint32Tag$1 = '[object Uint32Array]';
|
|
25
|
+
let reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
|
|
26
|
+
let reFlags = /\w*$/;
|
|
27
|
+
let reIsHostCtor$1 = /^\[object .+?Constructor\]$/;
|
|
28
|
+
let reIsUint$1 = /^(?:0|[1-9]\d*)$/;
|
|
29
|
+
let cloneableTags = {};
|
|
30
|
+
cloneableTags[argsTag$1] =
|
|
31
|
+
cloneableTags[arrayTag$1] =
|
|
32
|
+
cloneableTags[arrayBufferTag$1] =
|
|
33
|
+
cloneableTags[dataViewTag$1] =
|
|
34
|
+
cloneableTags[boolTag$1] =
|
|
35
|
+
cloneableTags[dateTag$1] =
|
|
36
|
+
cloneableTags[float32Tag$1] =
|
|
37
|
+
cloneableTags[float64Tag$1] =
|
|
38
|
+
cloneableTags[int8Tag$1] =
|
|
39
|
+
cloneableTags[int16Tag$1] =
|
|
40
|
+
cloneableTags[int32Tag$1] =
|
|
41
|
+
cloneableTags[mapTag$1] =
|
|
42
|
+
cloneableTags[numberTag$1] =
|
|
43
|
+
cloneableTags[objectTag$1] =
|
|
44
|
+
cloneableTags[regexpTag$1] =
|
|
45
|
+
cloneableTags[setTag$1] =
|
|
46
|
+
cloneableTags[stringTag$1] =
|
|
47
|
+
cloneableTags[symbolTag$1] =
|
|
48
|
+
cloneableTags[uint8Tag$1] =
|
|
49
|
+
cloneableTags[uint8ClampedTag$1] =
|
|
50
|
+
cloneableTags[uint16Tag$1] =
|
|
51
|
+
cloneableTags[uint32Tag$1] =
|
|
52
|
+
true;
|
|
53
|
+
cloneableTags[errorTag$1] = cloneableTags[funcTag$1] = cloneableTags[weakMapTag$1] = false;
|
|
54
|
+
let freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;
|
|
55
|
+
let freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
|
|
56
|
+
let root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
|
|
57
|
+
let freeExports$1 = typeof exports == 'object' && exports && !nodeType && exports;
|
|
58
|
+
let freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
59
|
+
let moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
60
|
+
function addMapEntry(map, pair) {
|
|
61
|
+
map.set(pair[0], pair[1]);
|
|
62
|
+
return map;
|
|
63
|
+
}
|
|
64
|
+
function addSetEntry(set, value) {
|
|
65
|
+
set.add(value);
|
|
66
|
+
return set;
|
|
67
|
+
}
|
|
68
|
+
function arrayEach(array, iteratee) {
|
|
69
|
+
let index = -1, length = array ? array.length : 0;
|
|
70
|
+
while (++index < length) {
|
|
71
|
+
if (iteratee(array[index], index, array) === false) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return array;
|
|
76
|
+
}
|
|
77
|
+
function arrayPush(array, values) {
|
|
78
|
+
let index = -1, length = values.length, offset = array.length;
|
|
79
|
+
while (++index < length) {
|
|
80
|
+
array[offset + index] = values[index];
|
|
81
|
+
}
|
|
82
|
+
return array;
|
|
83
|
+
}
|
|
84
|
+
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
85
|
+
let index = -1, length = array ? array.length : 0;
|
|
86
|
+
if (initAccum && length) {
|
|
87
|
+
accumulator = array[++index];
|
|
88
|
+
}
|
|
89
|
+
while (++index < length) {
|
|
90
|
+
accumulator = iteratee(accumulator, array[index], index, array);
|
|
91
|
+
}
|
|
92
|
+
return accumulator;
|
|
93
|
+
}
|
|
94
|
+
function baseTimes$1(n, iteratee) {
|
|
95
|
+
let index = -1, result = Array(n);
|
|
96
|
+
while (++index < n) {
|
|
97
|
+
result[index] = iteratee(index);
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
function getValue$1(object, key) {
|
|
102
|
+
return object == null ? undefined : object[key];
|
|
103
|
+
}
|
|
104
|
+
function isHostObject$1(value) {
|
|
105
|
+
let result = false;
|
|
106
|
+
if (value != null && typeof value.toString != 'function') {
|
|
107
|
+
try {
|
|
108
|
+
result = !!(value + '');
|
|
109
|
+
}
|
|
110
|
+
catch (e) { }
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
function mapToArray$1(map) {
|
|
115
|
+
let index = -1, result = Array(map.size);
|
|
116
|
+
map.forEach(function (value, key) {
|
|
117
|
+
result[++index] = [key, value];
|
|
118
|
+
});
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
function overArg$1(func, transform) {
|
|
122
|
+
return function (arg) {
|
|
123
|
+
return func(transform(arg));
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function setToArray$1(set) {
|
|
127
|
+
let index = -1, result = Array(set.size);
|
|
128
|
+
set.forEach(function (value) {
|
|
129
|
+
result[++index] = value;
|
|
130
|
+
});
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
let arrayProto$1 = Array.prototype, funcProto$1 = Function.prototype, objectProto$1 = Object.prototype;
|
|
134
|
+
let coreJsData$1 = root$1['__core-js_shared__'];
|
|
135
|
+
let maskSrcKey$1 = (function () {
|
|
136
|
+
let uid = /[^.]+$/.exec((coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO) || '');
|
|
137
|
+
return uid ? 'Symbol(src)_1.' + uid : '';
|
|
138
|
+
})();
|
|
139
|
+
let funcToString$1 = funcProto$1.toString;
|
|
140
|
+
let hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
141
|
+
let objectToString$1 = objectProto$1.toString;
|
|
142
|
+
let reIsNative$1 = RegExp('^' +
|
|
143
|
+
funcToString$1
|
|
144
|
+
.call(hasOwnProperty$1)
|
|
145
|
+
.replace(reRegExpChar$1, '\\$&')
|
|
146
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') +
|
|
147
|
+
'$');
|
|
148
|
+
let Buffer = moduleExports$1 ? root$1.Buffer : undefined, Symbol$1 = root$1.Symbol, Uint8Array$1 = root$1.Uint8Array, getPrototype = overArg$1(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable$1 = objectProto$1.propertyIsEnumerable, splice$1 = arrayProto$1.splice;
|
|
149
|
+
let nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeKeys$1 = overArg$1(Object.keys, Object);
|
|
150
|
+
let DataView$1 = getNative$1(root$1, 'DataView'), Map$1 = getNative$1(root$1, 'Map'), Promise$2 = getNative$1(root$1, 'Promise'), Set$1 = getNative$1(root$1, 'Set'), WeakMap$1 = getNative$1(root$1, 'WeakMap'), nativeCreate$1 = getNative$1(Object, 'create');
|
|
151
|
+
let dataViewCtorString$1 = toSource$1(DataView$1), mapCtorString$1 = toSource$1(Map$1), promiseCtorString$1 = toSource$1(Promise$2), setCtorString$1 = toSource$1(Set$1), weakMapCtorString$1 = toSource$1(WeakMap$1);
|
|
152
|
+
let symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
153
|
+
function Hash$1(entries) {
|
|
154
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
155
|
+
this.clear();
|
|
156
|
+
while (++index < length) {
|
|
157
|
+
let entry = entries[index];
|
|
158
|
+
this.set(entry[0], entry[1]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function hashClear$1() {
|
|
162
|
+
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
|
|
163
|
+
}
|
|
164
|
+
function hashDelete$1(key) {
|
|
165
|
+
return this.has(key) && delete this.__data__[key];
|
|
166
|
+
}
|
|
167
|
+
function hashGet$1(key) {
|
|
168
|
+
let data = this.__data__;
|
|
169
|
+
if (nativeCreate$1) {
|
|
170
|
+
let result = data[key];
|
|
171
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
172
|
+
}
|
|
173
|
+
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
174
|
+
}
|
|
175
|
+
function hashHas$1(key) {
|
|
176
|
+
let data = this.__data__;
|
|
177
|
+
return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$1.call(data, key);
|
|
178
|
+
}
|
|
179
|
+
function hashSet$1(key, value) {
|
|
180
|
+
let data = this.__data__;
|
|
181
|
+
data[key] = nativeCreate$1 && value === undefined ? HASH_UNDEFINED$1 : value;
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
Hash$1.prototype.clear = hashClear$1;
|
|
185
|
+
Hash$1.prototype['delete'] = hashDelete$1;
|
|
186
|
+
Hash$1.prototype.get = hashGet$1;
|
|
187
|
+
Hash$1.prototype.has = hashHas$1;
|
|
188
|
+
Hash$1.prototype.set = hashSet$1;
|
|
189
|
+
function ListCache$1(entries) {
|
|
190
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
191
|
+
this.clear();
|
|
192
|
+
while (++index < length) {
|
|
193
|
+
let entry = entries[index];
|
|
194
|
+
this.set(entry[0], entry[1]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function listCacheClear$1() {
|
|
198
|
+
this.__data__ = [];
|
|
199
|
+
}
|
|
200
|
+
function listCacheDelete$1(key) {
|
|
201
|
+
let data = this.__data__, index = assocIndexOf$1(data, key);
|
|
202
|
+
if (index < 0) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
let lastIndex = data.length - 1;
|
|
206
|
+
if (index == lastIndex) {
|
|
207
|
+
data.pop();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
splice$1.call(data, index, 1);
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
function listCacheGet$1(key) {
|
|
215
|
+
let data = this.__data__, index = assocIndexOf$1(data, key);
|
|
216
|
+
return index < 0 ? undefined : data[index][1];
|
|
217
|
+
}
|
|
218
|
+
function listCacheHas$1(key) {
|
|
219
|
+
return assocIndexOf$1(this.__data__, key) > -1;
|
|
220
|
+
}
|
|
221
|
+
function listCacheSet$1(key, value) {
|
|
222
|
+
let data = this.__data__, index = assocIndexOf$1(data, key);
|
|
223
|
+
if (index < 0) {
|
|
224
|
+
data.push([key, value]);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
data[index][1] = value;
|
|
228
|
+
}
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
ListCache$1.prototype.clear = listCacheClear$1;
|
|
232
|
+
ListCache$1.prototype['delete'] = listCacheDelete$1;
|
|
233
|
+
ListCache$1.prototype.get = listCacheGet$1;
|
|
234
|
+
ListCache$1.prototype.has = listCacheHas$1;
|
|
235
|
+
ListCache$1.prototype.set = listCacheSet$1;
|
|
236
|
+
function MapCache$1(entries) {
|
|
237
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
238
|
+
this.clear();
|
|
239
|
+
while (++index < length) {
|
|
240
|
+
let entry = entries[index];
|
|
241
|
+
this.set(entry[0], entry[1]);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function mapCacheClear$1() {
|
|
245
|
+
this.__data__ = {
|
|
246
|
+
hash: new Hash$1(),
|
|
247
|
+
map: new (Map$1 || ListCache$1)(),
|
|
248
|
+
string: new Hash$1(),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function mapCacheDelete$1(key) {
|
|
252
|
+
return getMapData$1(this, key)['delete'](key);
|
|
253
|
+
}
|
|
254
|
+
function mapCacheGet$1(key) {
|
|
255
|
+
return getMapData$1(this, key).get(key);
|
|
256
|
+
}
|
|
257
|
+
function mapCacheHas$1(key) {
|
|
258
|
+
return getMapData$1(this, key).has(key);
|
|
259
|
+
}
|
|
260
|
+
function mapCacheSet$1(key, value) {
|
|
261
|
+
getMapData$1(this, key).set(key, value);
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
MapCache$1.prototype.clear = mapCacheClear$1;
|
|
265
|
+
MapCache$1.prototype['delete'] = mapCacheDelete$1;
|
|
266
|
+
MapCache$1.prototype.get = mapCacheGet$1;
|
|
267
|
+
MapCache$1.prototype.has = mapCacheHas$1;
|
|
268
|
+
MapCache$1.prototype.set = mapCacheSet$1;
|
|
269
|
+
function Stack$1(entries) {
|
|
270
|
+
this.__data__ = new ListCache$1(entries);
|
|
271
|
+
}
|
|
272
|
+
function stackClear$1() {
|
|
273
|
+
this.__data__ = new ListCache$1();
|
|
274
|
+
}
|
|
275
|
+
function stackDelete$1(key) {
|
|
276
|
+
return this.__data__['delete'](key);
|
|
277
|
+
}
|
|
278
|
+
function stackGet$1(key) {
|
|
279
|
+
return this.__data__.get(key);
|
|
280
|
+
}
|
|
281
|
+
function stackHas$1(key) {
|
|
282
|
+
return this.__data__.has(key);
|
|
283
|
+
}
|
|
284
|
+
function stackSet$1(key, value) {
|
|
285
|
+
let cache = this.__data__;
|
|
286
|
+
if (cache instanceof ListCache$1) {
|
|
287
|
+
let pairs = cache.__data__;
|
|
288
|
+
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
|
|
289
|
+
pairs.push([key, value]);
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
cache = this.__data__ = new MapCache$1(pairs);
|
|
293
|
+
}
|
|
294
|
+
cache.set(key, value);
|
|
295
|
+
return this;
|
|
296
|
+
}
|
|
297
|
+
Stack$1.prototype.clear = stackClear$1;
|
|
298
|
+
Stack$1.prototype['delete'] = stackDelete$1;
|
|
299
|
+
Stack$1.prototype.get = stackGet$1;
|
|
300
|
+
Stack$1.prototype.has = stackHas$1;
|
|
301
|
+
Stack$1.prototype.set = stackSet$1;
|
|
302
|
+
function arrayLikeKeys$1(value, inherited) {
|
|
303
|
+
let result = isArray$1(value) || isArguments$1(value) ? baseTimes$1(value.length, String) : [];
|
|
304
|
+
let length = result.length, skipIndexes = !!length;
|
|
305
|
+
for (let key in value) {
|
|
306
|
+
if ((inherited || hasOwnProperty$1.call(value, key)) &&
|
|
307
|
+
!(skipIndexes && (key == 'length' || isIndex$1(key, length)))) {
|
|
308
|
+
result.push(key);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
function assignValue(object, key, value) {
|
|
314
|
+
let objValue = object[key];
|
|
315
|
+
if (!(hasOwnProperty$1.call(object, key) && eq$1(objValue, value)) ||
|
|
316
|
+
(value === undefined && !(key in object))) {
|
|
317
|
+
object[key] = value;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function assocIndexOf$1(array, key) {
|
|
321
|
+
let length = array.length;
|
|
322
|
+
while (length--) {
|
|
323
|
+
if (eq$1(array[length][0], key)) {
|
|
324
|
+
return length;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return -1;
|
|
328
|
+
}
|
|
329
|
+
function baseAssign(object, source) {
|
|
330
|
+
return object && copyObject(source, keys$1(source), object);
|
|
331
|
+
}
|
|
332
|
+
function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|
333
|
+
let result;
|
|
334
|
+
if (customizer) {
|
|
335
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
336
|
+
}
|
|
337
|
+
if (result !== undefined) {
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
if (!isObject$1(value)) {
|
|
341
|
+
return value;
|
|
342
|
+
}
|
|
343
|
+
let isArr = isArray$1(value);
|
|
344
|
+
if (isArr) {
|
|
345
|
+
result = initCloneArray(value);
|
|
346
|
+
if (!isDeep) {
|
|
347
|
+
return copyArray(value, result);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
let tag = getTag$1(value), isFunc = tag == funcTag$1 || tag == genTag$1;
|
|
352
|
+
if (isBuffer(value)) {
|
|
353
|
+
return cloneBuffer(value, isDeep);
|
|
354
|
+
}
|
|
355
|
+
if (tag == objectTag$1 || tag == argsTag$1 || (isFunc && !object)) {
|
|
356
|
+
if (isHostObject$1(value)) {
|
|
357
|
+
return object ? value : {};
|
|
358
|
+
}
|
|
359
|
+
result = initCloneObject(isFunc ? {} : value);
|
|
360
|
+
if (!isDeep) {
|
|
361
|
+
return copySymbols(value, baseAssign(result, value));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
if (!cloneableTags[tag]) {
|
|
366
|
+
return object ? value : {};
|
|
367
|
+
}
|
|
368
|
+
result = initCloneByTag(value, tag, baseClone, isDeep);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
stack || (stack = new Stack$1());
|
|
372
|
+
let stacked = stack.get(value);
|
|
373
|
+
if (stacked) {
|
|
374
|
+
return stacked;
|
|
375
|
+
}
|
|
376
|
+
stack.set(value, result);
|
|
377
|
+
if (!isArr) {
|
|
378
|
+
var cloneDeepProps = isFull ? getAllKeys(value) : keys$1(value);
|
|
379
|
+
}
|
|
380
|
+
arrayEach(cloneDeepProps || value, function (subValue, key) {
|
|
381
|
+
if (cloneDeepProps) {
|
|
382
|
+
key = subValue;
|
|
383
|
+
subValue = value[key];
|
|
384
|
+
}
|
|
385
|
+
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
|
386
|
+
});
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
389
|
+
function baseCreate(proto) {
|
|
390
|
+
return isObject$1(proto) ? objectCreate(proto) : {};
|
|
391
|
+
}
|
|
392
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
393
|
+
let result = keysFunc(object);
|
|
394
|
+
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
395
|
+
}
|
|
396
|
+
function baseGetTag$1(value) {
|
|
397
|
+
return objectToString$1.call(value);
|
|
398
|
+
}
|
|
399
|
+
function baseIsNative$1(value) {
|
|
400
|
+
if (!isObject$1(value) || isMasked$1(value)) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
let pattern = isFunction$1(value) || isHostObject$1(value) ? reIsNative$1 : reIsHostCtor$1;
|
|
404
|
+
return pattern.test(toSource$1(value));
|
|
405
|
+
}
|
|
406
|
+
function baseKeys$1(object) {
|
|
407
|
+
if (!isPrototype$1(object)) {
|
|
408
|
+
return nativeKeys$1(object);
|
|
409
|
+
}
|
|
410
|
+
let result = [];
|
|
411
|
+
for (let key in Object(object)) {
|
|
412
|
+
if (hasOwnProperty$1.call(object, key) && key != 'constructor') {
|
|
413
|
+
result.push(key);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
function cloneBuffer(buffer, isDeep) {
|
|
419
|
+
if (isDeep) {
|
|
420
|
+
return buffer.slice();
|
|
421
|
+
}
|
|
422
|
+
let result = new buffer.constructor(buffer.length);
|
|
423
|
+
buffer.copy(result);
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
427
|
+
let result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
428
|
+
new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
function cloneDataView(dataView, isDeep) {
|
|
432
|
+
let buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
433
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
434
|
+
}
|
|
435
|
+
function cloneMap(map, isDeep, cloneFunc) {
|
|
436
|
+
let array = isDeep ? cloneFunc(mapToArray$1(map), true) : mapToArray$1(map);
|
|
437
|
+
return arrayReduce(array, addMapEntry, new map.constructor());
|
|
438
|
+
}
|
|
439
|
+
function cloneRegExp(regexp) {
|
|
440
|
+
let result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
441
|
+
result.lastIndex = regexp.lastIndex;
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
function cloneSet(set, isDeep, cloneFunc) {
|
|
445
|
+
let array = isDeep ? cloneFunc(setToArray$1(set), true) : setToArray$1(set);
|
|
446
|
+
return arrayReduce(array, addSetEntry, new set.constructor());
|
|
447
|
+
}
|
|
448
|
+
function cloneSymbol(symbol) {
|
|
449
|
+
return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
|
|
450
|
+
}
|
|
451
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
452
|
+
let buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
453
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
454
|
+
}
|
|
455
|
+
function copyArray(source, array) {
|
|
456
|
+
let index = -1, length = source.length;
|
|
457
|
+
array || (array = Array(length));
|
|
458
|
+
while (++index < length) {
|
|
459
|
+
array[index] = source[index];
|
|
460
|
+
}
|
|
461
|
+
return array;
|
|
462
|
+
}
|
|
463
|
+
function copyObject(source, cloneDeepProps, object, customizer) {
|
|
464
|
+
object || (object = {});
|
|
465
|
+
let index = -1, length = cloneDeepProps.length;
|
|
466
|
+
while (++index < length) {
|
|
467
|
+
let key = cloneDeepProps[index];
|
|
468
|
+
let newValue = customizer
|
|
469
|
+
? customizer(object[key], source[key], key, object, source)
|
|
470
|
+
: undefined;
|
|
471
|
+
assignValue(object, key, newValue === undefined ? source[key] : newValue);
|
|
472
|
+
}
|
|
473
|
+
return object;
|
|
474
|
+
}
|
|
475
|
+
function copySymbols(source, object) {
|
|
476
|
+
return copyObject(source, getSymbols(source), object);
|
|
477
|
+
}
|
|
478
|
+
function getAllKeys(object) {
|
|
479
|
+
return baseGetAllKeys(object, keys$1, getSymbols);
|
|
480
|
+
}
|
|
481
|
+
function getMapData$1(map, key) {
|
|
482
|
+
let data = map.__data__;
|
|
483
|
+
return isKeyable$1(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
|
484
|
+
}
|
|
485
|
+
function getNative$1(object, key) {
|
|
486
|
+
let value = getValue$1(object, key);
|
|
487
|
+
return baseIsNative$1(value) ? value : undefined;
|
|
488
|
+
}
|
|
489
|
+
let getSymbols = nativeGetSymbols ? overArg$1(nativeGetSymbols, Object) : stubArray;
|
|
490
|
+
let getTag$1 = baseGetTag$1;
|
|
491
|
+
if ((DataView$1 && getTag$1(new DataView$1(new ArrayBuffer(1))) != dataViewTag$1) ||
|
|
492
|
+
(Map$1 && getTag$1(new Map$1()) != mapTag$1) ||
|
|
493
|
+
(Promise$2 && getTag$1(Promise$2.resolve()) != promiseTag$1) ||
|
|
494
|
+
(Set$1 && getTag$1(new Set$1()) != setTag$1) ||
|
|
495
|
+
(WeakMap$1 && getTag$1(new WeakMap$1()) != weakMapTag$1)) {
|
|
496
|
+
getTag$1 = function (value) {
|
|
497
|
+
let result = objectToString$1.call(value), Ctor = result == objectTag$1 ? value.constructor : undefined, ctorString = Ctor ? toSource$1(Ctor) : undefined;
|
|
498
|
+
if (ctorString) {
|
|
499
|
+
switch (ctorString) {
|
|
500
|
+
case dataViewCtorString$1:
|
|
501
|
+
return dataViewTag$1;
|
|
502
|
+
case mapCtorString$1:
|
|
503
|
+
return mapTag$1;
|
|
504
|
+
case promiseCtorString$1:
|
|
505
|
+
return promiseTag$1;
|
|
506
|
+
case setCtorString$1:
|
|
507
|
+
return setTag$1;
|
|
508
|
+
case weakMapCtorString$1:
|
|
509
|
+
return weakMapTag$1;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return result;
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function initCloneArray(array) {
|
|
516
|
+
let length = array.length, result = array.constructor(length);
|
|
517
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {
|
|
518
|
+
result.index = array.index;
|
|
519
|
+
result.input = array.input;
|
|
520
|
+
}
|
|
521
|
+
return result;
|
|
522
|
+
}
|
|
523
|
+
function initCloneObject(object) {
|
|
524
|
+
return typeof object.constructor == 'function' && !isPrototype$1(object)
|
|
525
|
+
? baseCreate(getPrototype(object))
|
|
526
|
+
: {};
|
|
527
|
+
}
|
|
528
|
+
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
|
529
|
+
let Ctor = object.constructor;
|
|
530
|
+
switch (tag) {
|
|
531
|
+
case arrayBufferTag$1:
|
|
532
|
+
return cloneArrayBuffer(object);
|
|
533
|
+
case boolTag$1:
|
|
534
|
+
case dateTag$1:
|
|
535
|
+
return new Ctor(+object);
|
|
536
|
+
case dataViewTag$1:
|
|
537
|
+
return cloneDataView(object, isDeep);
|
|
538
|
+
case float32Tag$1:
|
|
539
|
+
case float64Tag$1:
|
|
540
|
+
case int8Tag$1:
|
|
541
|
+
case int16Tag$1:
|
|
542
|
+
case int32Tag$1:
|
|
543
|
+
case uint8Tag$1:
|
|
544
|
+
case uint8ClampedTag$1:
|
|
545
|
+
case uint16Tag$1:
|
|
546
|
+
case uint32Tag$1:
|
|
547
|
+
return cloneTypedArray(object, isDeep);
|
|
548
|
+
case mapTag$1:
|
|
549
|
+
return cloneMap(object, isDeep, cloneFunc);
|
|
550
|
+
case numberTag$1:
|
|
551
|
+
case stringTag$1:
|
|
552
|
+
return new Ctor(object);
|
|
553
|
+
case regexpTag$1:
|
|
554
|
+
return cloneRegExp(object);
|
|
555
|
+
case setTag$1:
|
|
556
|
+
return cloneSet(object, isDeep, cloneFunc);
|
|
557
|
+
case symbolTag$1:
|
|
558
|
+
return cloneSymbol(object);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function isIndex$1(value, length) {
|
|
562
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
563
|
+
return (!!length &&
|
|
564
|
+
(typeof value == 'number' || reIsUint$1.test(value)) &&
|
|
565
|
+
value > -1 &&
|
|
566
|
+
value % 1 == 0 &&
|
|
567
|
+
value < length);
|
|
568
|
+
}
|
|
569
|
+
function isKeyable$1(value) {
|
|
570
|
+
let type = typeof value;
|
|
571
|
+
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean'
|
|
572
|
+
? value !== '__proto__'
|
|
573
|
+
: value === null;
|
|
574
|
+
}
|
|
575
|
+
function isMasked$1(func) {
|
|
576
|
+
return !!maskSrcKey$1 && maskSrcKey$1 in func;
|
|
577
|
+
}
|
|
578
|
+
function isPrototype$1(value) {
|
|
579
|
+
let Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$1;
|
|
580
|
+
return value === proto;
|
|
581
|
+
}
|
|
582
|
+
function toSource$1(func) {
|
|
583
|
+
if (func != null) {
|
|
584
|
+
try {
|
|
585
|
+
return funcToString$1.call(func);
|
|
586
|
+
}
|
|
587
|
+
catch (e) { }
|
|
588
|
+
try {
|
|
589
|
+
return func + '';
|
|
590
|
+
}
|
|
591
|
+
catch (e) { }
|
|
592
|
+
}
|
|
593
|
+
return '';
|
|
594
|
+
}
|
|
595
|
+
function zxhiddenCustomCloneDeepByJeremyAshkenas(value) {
|
|
596
|
+
return baseClone(value, true, true);
|
|
597
|
+
}
|
|
598
|
+
function eq$1(value, other) {
|
|
599
|
+
return value === other || (value !== value && other !== other);
|
|
600
|
+
}
|
|
601
|
+
function isArguments$1(value) {
|
|
602
|
+
return (isArrayLikeObject$1(value) &&
|
|
603
|
+
hasOwnProperty$1.call(value, 'callee') &&
|
|
604
|
+
(!propertyIsEnumerable$1.call(value, 'callee') || objectToString$1.call(value) == argsTag$1));
|
|
605
|
+
}
|
|
606
|
+
let isArray$1 = Array.isArray;
|
|
607
|
+
function isArrayLike$1(value) {
|
|
608
|
+
return value != null && isLength$1(value.length) && !isFunction$1(value);
|
|
609
|
+
}
|
|
610
|
+
function isArrayLikeObject$1(value) {
|
|
611
|
+
return isObjectLike$1(value) && isArrayLike$1(value);
|
|
612
|
+
}
|
|
613
|
+
let isBuffer = nativeIsBuffer || stubFalse;
|
|
614
|
+
function isFunction$1(value) {
|
|
615
|
+
let tag = isObject$1(value) ? objectToString$1.call(value) : '';
|
|
616
|
+
return tag == funcTag$1 || tag == genTag$1;
|
|
617
|
+
}
|
|
618
|
+
function isLength$1(value) {
|
|
619
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
|
|
620
|
+
}
|
|
621
|
+
function isObject$1(value) {
|
|
622
|
+
let type = typeof value;
|
|
623
|
+
return !!value && (type == 'object' || type == 'function');
|
|
624
|
+
}
|
|
625
|
+
function isObjectLike$1(value) {
|
|
626
|
+
return !!value && typeof value == 'object';
|
|
627
|
+
}
|
|
628
|
+
function keys$1(object) {
|
|
629
|
+
return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys$1(object);
|
|
630
|
+
}
|
|
631
|
+
function stubArray() {
|
|
632
|
+
return [];
|
|
633
|
+
}
|
|
634
|
+
function stubFalse() {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
let LARGE_ARRAY_SIZE = 200;
|
|
639
|
+
let FUNC_ERROR_TEXT = 'Expected a function';
|
|
640
|
+
let HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
641
|
+
let UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2;
|
|
642
|
+
let INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991;
|
|
643
|
+
let argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', promiseTag = '[object Promise]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]';
|
|
644
|
+
let arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]';
|
|
645
|
+
let reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
646
|
+
let reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
647
|
+
let reEscapeChar = /\\(\\)?/g;
|
|
648
|
+
let reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
649
|
+
let reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
650
|
+
let typedArrayTags = {};
|
|
651
|
+
typedArrayTags[float32Tag] =
|
|
652
|
+
typedArrayTags[float64Tag] =
|
|
653
|
+
typedArrayTags[int8Tag] =
|
|
654
|
+
typedArrayTags[int16Tag] =
|
|
655
|
+
typedArrayTags[int32Tag] =
|
|
656
|
+
typedArrayTags[uint8Tag] =
|
|
657
|
+
typedArrayTags[uint8ClampedTag] =
|
|
658
|
+
typedArrayTags[uint16Tag] =
|
|
659
|
+
typedArrayTags[uint32Tag] =
|
|
660
|
+
true;
|
|
661
|
+
typedArrayTags[argsTag] =
|
|
662
|
+
typedArrayTags[arrayTag] =
|
|
663
|
+
typedArrayTags[arrayBufferTag] =
|
|
664
|
+
typedArrayTags[boolTag] =
|
|
665
|
+
typedArrayTags[dataViewTag] =
|
|
666
|
+
typedArrayTags[dateTag] =
|
|
667
|
+
typedArrayTags[errorTag] =
|
|
668
|
+
typedArrayTags[funcTag] =
|
|
669
|
+
typedArrayTags[mapTag] =
|
|
670
|
+
typedArrayTags[numberTag] =
|
|
671
|
+
typedArrayTags[objectTag] =
|
|
672
|
+
typedArrayTags[regexpTag] =
|
|
673
|
+
typedArrayTags[setTag] =
|
|
674
|
+
typedArrayTags[stringTag] =
|
|
675
|
+
typedArrayTags[weakMapTag] =
|
|
676
|
+
false;
|
|
677
|
+
let freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
678
|
+
let freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
679
|
+
let root = freeGlobal || freeSelf || Function('return this')();
|
|
680
|
+
let freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
681
|
+
let freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
682
|
+
let moduleExports = freeModule && freeModule.exports === freeExports;
|
|
683
|
+
let freeProcess = moduleExports && freeGlobal.process;
|
|
684
|
+
let nodeUtil = (function () {
|
|
685
|
+
try {
|
|
686
|
+
return freeProcess && freeProcess.binding('util');
|
|
687
|
+
}
|
|
688
|
+
catch (e) { }
|
|
689
|
+
})();
|
|
690
|
+
let nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
691
|
+
function arrayMap(array, iteratee) {
|
|
692
|
+
let index = -1, length = array ? array.length : 0, result = Array(length);
|
|
693
|
+
while (++index < length) {
|
|
694
|
+
result[index] = iteratee(array[index], index, array);
|
|
695
|
+
}
|
|
696
|
+
return result;
|
|
697
|
+
}
|
|
698
|
+
function arraySome(array, predicate) {
|
|
699
|
+
let index = -1, length = array ? array.length : 0;
|
|
700
|
+
while (++index < length) {
|
|
701
|
+
if (predicate(array[index], index, array)) {
|
|
702
|
+
return true;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
function baseProperty(key) {
|
|
708
|
+
return function (object) {
|
|
709
|
+
return object == null ? undefined : object[key];
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function baseSortBy(array, comparer) {
|
|
713
|
+
let length = array.length;
|
|
714
|
+
array.sort(comparer);
|
|
715
|
+
while (length--) {
|
|
716
|
+
array[length] = array[length].value;
|
|
717
|
+
}
|
|
718
|
+
return array;
|
|
719
|
+
}
|
|
720
|
+
function baseTimes(n, iteratee) {
|
|
721
|
+
let index = -1, result = Array(n);
|
|
722
|
+
while (++index < n) {
|
|
723
|
+
result[index] = iteratee(index);
|
|
724
|
+
}
|
|
725
|
+
return result;
|
|
726
|
+
}
|
|
727
|
+
function baseUnary(func) {
|
|
728
|
+
return function (value) {
|
|
729
|
+
return func(value);
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
function getValue(object, key) {
|
|
733
|
+
return object == null ? undefined : object[key];
|
|
734
|
+
}
|
|
735
|
+
function isHostObject(value) {
|
|
736
|
+
let result = false;
|
|
737
|
+
if (value != null && typeof value.toString != 'function') {
|
|
738
|
+
try {
|
|
739
|
+
result = !!(value + '');
|
|
740
|
+
}
|
|
741
|
+
catch (e) { }
|
|
742
|
+
}
|
|
743
|
+
return result;
|
|
744
|
+
}
|
|
745
|
+
function mapToArray(map) {
|
|
746
|
+
let index = -1, result = Array(map.size);
|
|
747
|
+
map.forEach(function (value, key) {
|
|
748
|
+
result[++index] = [key, value];
|
|
749
|
+
});
|
|
750
|
+
return result;
|
|
751
|
+
}
|
|
752
|
+
function overArg(func, transform) {
|
|
753
|
+
return function (arg) {
|
|
754
|
+
return func(transform(arg));
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function setToArray(set) {
|
|
758
|
+
let index = -1, result = Array(set.size);
|
|
759
|
+
set.forEach(function (value) {
|
|
760
|
+
result[++index] = value;
|
|
761
|
+
});
|
|
762
|
+
return result;
|
|
763
|
+
}
|
|
764
|
+
let arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
|
|
765
|
+
let coreJsData = root['__core-js_shared__'];
|
|
766
|
+
let maskSrcKey = (function () {
|
|
767
|
+
let uid = /[^.]+$/.exec((coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO) || '');
|
|
768
|
+
return uid ? 'Symbol(src)_1.' + uid : '';
|
|
769
|
+
})();
|
|
770
|
+
let funcToString = funcProto.toString;
|
|
771
|
+
let hasOwnProperty = objectProto.hasOwnProperty;
|
|
772
|
+
let objectToString = objectProto.toString;
|
|
773
|
+
let reIsNative = RegExp('^' +
|
|
774
|
+
funcToString
|
|
775
|
+
.call(hasOwnProperty)
|
|
776
|
+
.replace(reRegExpChar, '\\$&')
|
|
777
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') +
|
|
778
|
+
'$');
|
|
779
|
+
let Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
|
|
780
|
+
let nativeKeys = overArg(Object.keys, Object);
|
|
781
|
+
let DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise$1 = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'), nativeCreate = getNative(Object, 'create');
|
|
782
|
+
let dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
|
|
783
|
+
let symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
784
|
+
function Hash(entries) {
|
|
785
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
786
|
+
this.clear();
|
|
787
|
+
while (++index < length) {
|
|
788
|
+
let entry = entries[index];
|
|
789
|
+
this.set(entry[0], entry[1]);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
function hashClear() {
|
|
793
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
794
|
+
}
|
|
795
|
+
function hashDelete(key) {
|
|
796
|
+
return this.has(key) && delete this.__data__[key];
|
|
797
|
+
}
|
|
798
|
+
function hashGet(key) {
|
|
799
|
+
let data = this.__data__;
|
|
800
|
+
if (nativeCreate) {
|
|
801
|
+
let result = data[key];
|
|
802
|
+
return result === HASH_UNDEFINED ? undefined : result;
|
|
803
|
+
}
|
|
804
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
805
|
+
}
|
|
806
|
+
function hashHas(key) {
|
|
807
|
+
let data = this.__data__;
|
|
808
|
+
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
809
|
+
}
|
|
810
|
+
function hashSet(key, value) {
|
|
811
|
+
let data = this.__data__;
|
|
812
|
+
data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
|
|
813
|
+
return this;
|
|
814
|
+
}
|
|
815
|
+
Hash.prototype.clear = hashClear;
|
|
816
|
+
Hash.prototype['delete'] = hashDelete;
|
|
817
|
+
Hash.prototype.get = hashGet;
|
|
818
|
+
Hash.prototype.has = hashHas;
|
|
819
|
+
Hash.prototype.set = hashSet;
|
|
820
|
+
function ListCache(entries) {
|
|
821
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
822
|
+
this.clear();
|
|
823
|
+
while (++index < length) {
|
|
824
|
+
let entry = entries[index];
|
|
825
|
+
this.set(entry[0], entry[1]);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
function listCacheClear() {
|
|
829
|
+
this.__data__ = [];
|
|
830
|
+
}
|
|
831
|
+
function listCacheDelete(key) {
|
|
832
|
+
let data = this.__data__, index = assocIndexOf(data, key);
|
|
833
|
+
if (index < 0) {
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
let lastIndex = data.length - 1;
|
|
837
|
+
if (index == lastIndex) {
|
|
838
|
+
data.pop();
|
|
839
|
+
}
|
|
840
|
+
else {
|
|
841
|
+
splice.call(data, index, 1);
|
|
842
|
+
}
|
|
843
|
+
return true;
|
|
844
|
+
}
|
|
845
|
+
function listCacheGet(key) {
|
|
846
|
+
let data = this.__data__, index = assocIndexOf(data, key);
|
|
847
|
+
return index < 0 ? undefined : data[index][1];
|
|
848
|
+
}
|
|
849
|
+
function listCacheHas(key) {
|
|
850
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
851
|
+
}
|
|
852
|
+
function listCacheSet(key, value) {
|
|
853
|
+
let data = this.__data__, index = assocIndexOf(data, key);
|
|
854
|
+
if (index < 0) {
|
|
855
|
+
data.push([key, value]);
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
data[index][1] = value;
|
|
859
|
+
}
|
|
860
|
+
return this;
|
|
861
|
+
}
|
|
862
|
+
ListCache.prototype.clear = listCacheClear;
|
|
863
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
864
|
+
ListCache.prototype.get = listCacheGet;
|
|
865
|
+
ListCache.prototype.has = listCacheHas;
|
|
866
|
+
ListCache.prototype.set = listCacheSet;
|
|
867
|
+
function MapCache(entries) {
|
|
868
|
+
let index = -1, length = entries ? entries.length : 0;
|
|
869
|
+
this.clear();
|
|
870
|
+
while (++index < length) {
|
|
871
|
+
let entry = entries[index];
|
|
872
|
+
this.set(entry[0], entry[1]);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function mapCacheClear() {
|
|
876
|
+
this.__data__ = {
|
|
877
|
+
hash: new Hash(),
|
|
878
|
+
map: new (Map || ListCache)(),
|
|
879
|
+
string: new Hash(),
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
function mapCacheDelete(key) {
|
|
883
|
+
return getMapData(this, key)['delete'](key);
|
|
884
|
+
}
|
|
885
|
+
function mapCacheGet(key) {
|
|
886
|
+
return getMapData(this, key).get(key);
|
|
887
|
+
}
|
|
888
|
+
function mapCacheHas(key) {
|
|
889
|
+
return getMapData(this, key).has(key);
|
|
890
|
+
}
|
|
891
|
+
function mapCacheSet(key, value) {
|
|
892
|
+
getMapData(this, key).set(key, value);
|
|
893
|
+
return this;
|
|
894
|
+
}
|
|
895
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
896
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
897
|
+
MapCache.prototype.get = mapCacheGet;
|
|
898
|
+
MapCache.prototype.has = mapCacheHas;
|
|
899
|
+
MapCache.prototype.set = mapCacheSet;
|
|
900
|
+
function SetCache(values) {
|
|
901
|
+
let index = -1, length = values ? values.length : 0;
|
|
902
|
+
this.__data__ = new MapCache();
|
|
903
|
+
while (++index < length) {
|
|
904
|
+
this.add(values[index]);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function setCacheAdd(value) {
|
|
908
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
909
|
+
return this;
|
|
910
|
+
}
|
|
911
|
+
function setCacheHas(value) {
|
|
912
|
+
return this.__data__.has(value);
|
|
913
|
+
}
|
|
914
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
915
|
+
SetCache.prototype.has = setCacheHas;
|
|
916
|
+
function Stack(entries) {
|
|
917
|
+
this.__data__ = new ListCache(entries);
|
|
918
|
+
}
|
|
919
|
+
function stackClear() {
|
|
920
|
+
this.__data__ = new ListCache();
|
|
921
|
+
}
|
|
922
|
+
function stackDelete(key) {
|
|
923
|
+
return this.__data__['delete'](key);
|
|
924
|
+
}
|
|
925
|
+
function stackGet(key) {
|
|
926
|
+
return this.__data__.get(key);
|
|
927
|
+
}
|
|
928
|
+
function stackHas(key) {
|
|
929
|
+
return this.__data__.has(key);
|
|
930
|
+
}
|
|
931
|
+
function stackSet(key, value) {
|
|
932
|
+
let cache = this.__data__;
|
|
933
|
+
if (cache instanceof ListCache) {
|
|
934
|
+
let pairs = cache.__data__;
|
|
935
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
936
|
+
pairs.push([key, value]);
|
|
937
|
+
return this;
|
|
938
|
+
}
|
|
939
|
+
cache = this.__data__ = new MapCache(pairs);
|
|
940
|
+
}
|
|
941
|
+
cache.set(key, value);
|
|
942
|
+
return this;
|
|
943
|
+
}
|
|
944
|
+
Stack.prototype.clear = stackClear;
|
|
945
|
+
Stack.prototype['delete'] = stackDelete;
|
|
946
|
+
Stack.prototype.get = stackGet;
|
|
947
|
+
Stack.prototype.has = stackHas;
|
|
948
|
+
Stack.prototype.set = stackSet;
|
|
949
|
+
function arrayLikeKeys(value, inherited) {
|
|
950
|
+
let result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
|
|
951
|
+
let length = result.length, skipIndexes = !!length;
|
|
952
|
+
for (let key in value) {
|
|
953
|
+
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
954
|
+
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
|
955
|
+
result.push(key);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
return result;
|
|
959
|
+
}
|
|
960
|
+
function assocIndexOf(array, key) {
|
|
961
|
+
let length = array.length;
|
|
962
|
+
while (length--) {
|
|
963
|
+
if (eq(array[length][0], key)) {
|
|
964
|
+
return length;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return -1;
|
|
968
|
+
}
|
|
969
|
+
let baseEach = createBaseEach(baseForOwn);
|
|
970
|
+
let baseFor = createBaseFor();
|
|
971
|
+
function baseForOwn(object, iteratee) {
|
|
972
|
+
return object && baseFor(object, iteratee, keys);
|
|
973
|
+
}
|
|
974
|
+
function baseGet(object, path) {
|
|
975
|
+
path = isKey(path, object) ? [path] : castPath(path);
|
|
976
|
+
let index = 0, length = path.length;
|
|
977
|
+
while (object != null && index < length) {
|
|
978
|
+
object = object[toKey(path[index++])];
|
|
979
|
+
}
|
|
980
|
+
return index && index == length ? object : undefined;
|
|
981
|
+
}
|
|
982
|
+
function baseGetTag(value) {
|
|
983
|
+
return objectToString.call(value);
|
|
984
|
+
}
|
|
985
|
+
function baseHasIn(object, key) {
|
|
986
|
+
return object != null && key in Object(object);
|
|
987
|
+
}
|
|
988
|
+
function baseIsEqual(value, other, customizer, bitmask, stack) {
|
|
989
|
+
if (value === other) {
|
|
990
|
+
return true;
|
|
991
|
+
}
|
|
992
|
+
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
|
993
|
+
return value !== value && other !== other;
|
|
994
|
+
}
|
|
995
|
+
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
|
|
996
|
+
}
|
|
997
|
+
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|
998
|
+
let objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag;
|
|
999
|
+
if (!objIsArr) {
|
|
1000
|
+
objTag = getTag(object);
|
|
1001
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1002
|
+
}
|
|
1003
|
+
if (!othIsArr) {
|
|
1004
|
+
othTag = getTag(other);
|
|
1005
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1006
|
+
}
|
|
1007
|
+
let objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
|
|
1008
|
+
if (isSameTag && !objIsObj) {
|
|
1009
|
+
stack || (stack = new Stack());
|
|
1010
|
+
return objIsArr || isTypedArray(object)
|
|
1011
|
+
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
|
|
1012
|
+
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
|
|
1013
|
+
}
|
|
1014
|
+
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
|
|
1015
|
+
let objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
1016
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1017
|
+
let objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1018
|
+
stack || (stack = new Stack());
|
|
1019
|
+
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
if (!isSameTag) {
|
|
1023
|
+
return false;
|
|
1024
|
+
}
|
|
1025
|
+
stack || (stack = new Stack());
|
|
1026
|
+
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
|
|
1027
|
+
}
|
|
1028
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
1029
|
+
let index = matchData.length, length = index, noCustomizer = !customizer;
|
|
1030
|
+
if (object == null) {
|
|
1031
|
+
return !length;
|
|
1032
|
+
}
|
|
1033
|
+
object = Object(object);
|
|
1034
|
+
while (index--) {
|
|
1035
|
+
let data = matchData[index];
|
|
1036
|
+
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
|
|
1037
|
+
return false;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
while (++index < length) {
|
|
1041
|
+
data = matchData[index];
|
|
1042
|
+
let key = data[0], objValue = object[key], srcValue = data[1];
|
|
1043
|
+
if (noCustomizer && data[2]) {
|
|
1044
|
+
if (objValue === undefined && !(key in object)) {
|
|
1045
|
+
return false;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
else {
|
|
1049
|
+
let stack = new Stack();
|
|
1050
|
+
if (customizer) {
|
|
1051
|
+
let result = customizer(objValue, srcValue, key, object, source, stack);
|
|
1052
|
+
}
|
|
1053
|
+
if (!(result === undefined
|
|
1054
|
+
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
|
|
1055
|
+
: result)) {
|
|
1056
|
+
return false;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
return true;
|
|
1061
|
+
}
|
|
1062
|
+
function baseIsNative(value) {
|
|
1063
|
+
if (!isObject(value) || isMasked(value)) {
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1066
|
+
let pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
|
|
1067
|
+
return pattern.test(toSource(value));
|
|
1068
|
+
}
|
|
1069
|
+
function baseIsTypedArray(value) {
|
|
1070
|
+
return (isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]);
|
|
1071
|
+
}
|
|
1072
|
+
function baseIteratee(value) {
|
|
1073
|
+
if (typeof value == 'function') {
|
|
1074
|
+
return value;
|
|
1075
|
+
}
|
|
1076
|
+
if (value == null) {
|
|
1077
|
+
return identity;
|
|
1078
|
+
}
|
|
1079
|
+
if (typeof value == 'object') {
|
|
1080
|
+
return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
1081
|
+
}
|
|
1082
|
+
return property(value);
|
|
1083
|
+
}
|
|
1084
|
+
function baseKeys(object) {
|
|
1085
|
+
if (!isPrototype(object)) {
|
|
1086
|
+
return nativeKeys(object);
|
|
1087
|
+
}
|
|
1088
|
+
let result = [];
|
|
1089
|
+
for (let key in Object(object)) {
|
|
1090
|
+
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
|
1091
|
+
result.push(key);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return result;
|
|
1095
|
+
}
|
|
1096
|
+
function baseMap(collection, iteratee) {
|
|
1097
|
+
let index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
1098
|
+
baseEach(collection, function (value, key, collection) {
|
|
1099
|
+
result[++index] = iteratee(value, key, collection);
|
|
1100
|
+
});
|
|
1101
|
+
return result;
|
|
1102
|
+
}
|
|
1103
|
+
function baseMatches(source) {
|
|
1104
|
+
let matchData = getMatchData(source);
|
|
1105
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
1106
|
+
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
1107
|
+
}
|
|
1108
|
+
return function (object) {
|
|
1109
|
+
return object === source || baseIsMatch(object, source, matchData);
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
function baseMatchesProperty(path, srcValue) {
|
|
1113
|
+
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
1114
|
+
return matchesStrictComparable(toKey(path), srcValue);
|
|
1115
|
+
}
|
|
1116
|
+
return function (object) {
|
|
1117
|
+
let objValue = get(object, path);
|
|
1118
|
+
return objValue === undefined && objValue === srcValue
|
|
1119
|
+
? hasIn(object, path)
|
|
1120
|
+
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
1124
|
+
let index = -1;
|
|
1125
|
+
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
|
|
1126
|
+
let result = baseMap(collection, function (value, key, collection) {
|
|
1127
|
+
let criteria = arrayMap(iteratees, function (iteratee) {
|
|
1128
|
+
return iteratee(value);
|
|
1129
|
+
});
|
|
1130
|
+
return { criteria: criteria, index: ++index, value: value };
|
|
1131
|
+
});
|
|
1132
|
+
return baseSortBy(result, function (object, other) {
|
|
1133
|
+
return compareMultiple(object, other, orders);
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
function basePropertyDeep(path) {
|
|
1137
|
+
return function (object) {
|
|
1138
|
+
return baseGet(object, path);
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
function baseToString(value) {
|
|
1142
|
+
if (typeof value == 'string') {
|
|
1143
|
+
return value;
|
|
1144
|
+
}
|
|
1145
|
+
if (isSymbol(value)) {
|
|
1146
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
1147
|
+
}
|
|
1148
|
+
let result = value + '';
|
|
1149
|
+
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
|
1150
|
+
}
|
|
1151
|
+
function castPath(value) {
|
|
1152
|
+
return isArray(value) ? value : stringToPath(value);
|
|
1153
|
+
}
|
|
1154
|
+
function compareAscending(value, other) {
|
|
1155
|
+
if (value !== other) {
|
|
1156
|
+
let valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
|
|
1157
|
+
let othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
|
|
1158
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
1159
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
1160
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
1161
|
+
(!valIsDefined && othIsReflexive) ||
|
|
1162
|
+
!valIsReflexive) {
|
|
1163
|
+
return 1;
|
|
1164
|
+
}
|
|
1165
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
1166
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
1167
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
1168
|
+
(!othIsDefined && valIsReflexive) ||
|
|
1169
|
+
!othIsReflexive) {
|
|
1170
|
+
return -1;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return 0;
|
|
1174
|
+
}
|
|
1175
|
+
function compareMultiple(object, other, orders) {
|
|
1176
|
+
let index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
|
|
1177
|
+
while (++index < length) {
|
|
1178
|
+
let result = compareAscending(objCriteria[index], othCriteria[index]);
|
|
1179
|
+
if (result) {
|
|
1180
|
+
if (index >= ordersLength) {
|
|
1181
|
+
return result;
|
|
1182
|
+
}
|
|
1183
|
+
let order = orders[index];
|
|
1184
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
return object.index - other.index;
|
|
1188
|
+
}
|
|
1189
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
1190
|
+
return function (collection, iteratee) {
|
|
1191
|
+
if (collection == null) {
|
|
1192
|
+
return collection;
|
|
1193
|
+
}
|
|
1194
|
+
if (!isArrayLike(collection)) {
|
|
1195
|
+
return eachFunc(collection, iteratee);
|
|
1196
|
+
}
|
|
1197
|
+
let length = collection.length;
|
|
1198
|
+
let index = fromRight ? length : -1;
|
|
1199
|
+
let iterable = Object(collection);
|
|
1200
|
+
while (fromRight ? index-- : ++index < length) {
|
|
1201
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return collection;
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function createBaseFor(fromRight) {
|
|
1209
|
+
return function (object, iteratee, keysFunc) {
|
|
1210
|
+
let index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
|
|
1211
|
+
while (length--) {
|
|
1212
|
+
let key = props[fromRight ? length : ++index];
|
|
1213
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return object;
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
1221
|
+
let isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
|
|
1222
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1223
|
+
return false;
|
|
1224
|
+
}
|
|
1225
|
+
let stacked = stack.get(array);
|
|
1226
|
+
if (stacked && stack.get(other)) {
|
|
1227
|
+
return stacked == other;
|
|
1228
|
+
}
|
|
1229
|
+
let index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : undefined;
|
|
1230
|
+
stack.set(array, other);
|
|
1231
|
+
stack.set(other, array);
|
|
1232
|
+
while (++index < arrLength) {
|
|
1233
|
+
let arrValue = array[index], othValue = other[index];
|
|
1234
|
+
if (customizer) {
|
|
1235
|
+
let compared = isPartial
|
|
1236
|
+
? customizer(othValue, arrValue, index, other, array, stack)
|
|
1237
|
+
: customizer(arrValue, othValue, index, array, other, stack);
|
|
1238
|
+
}
|
|
1239
|
+
if (compared !== undefined) {
|
|
1240
|
+
if (compared) {
|
|
1241
|
+
continue;
|
|
1242
|
+
}
|
|
1243
|
+
result = false;
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
if (seen) {
|
|
1247
|
+
if (!arraySome(other, function (othValue, othIndex) {
|
|
1248
|
+
if (!seen.has(othIndex) &&
|
|
1249
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
|
|
1250
|
+
return seen.add(othIndex);
|
|
1251
|
+
}
|
|
1252
|
+
})) {
|
|
1253
|
+
result = false;
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
|
|
1258
|
+
result = false;
|
|
1259
|
+
break;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
stack['delete'](array);
|
|
1263
|
+
stack['delete'](other);
|
|
1264
|
+
return result;
|
|
1265
|
+
}
|
|
1266
|
+
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
1267
|
+
switch (tag) {
|
|
1268
|
+
case dataViewTag:
|
|
1269
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
object = object.buffer;
|
|
1273
|
+
other = other.buffer;
|
|
1274
|
+
case arrayBufferTag:
|
|
1275
|
+
if (object.byteLength != other.byteLength ||
|
|
1276
|
+
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
return true;
|
|
1280
|
+
case boolTag:
|
|
1281
|
+
case dateTag:
|
|
1282
|
+
case numberTag:
|
|
1283
|
+
return eq(+object, +other);
|
|
1284
|
+
case errorTag:
|
|
1285
|
+
return object.name == other.name && object.message == other.message;
|
|
1286
|
+
case regexpTag:
|
|
1287
|
+
case stringTag:
|
|
1288
|
+
return object == other + '';
|
|
1289
|
+
case mapTag:
|
|
1290
|
+
let convert = mapToArray;
|
|
1291
|
+
case setTag:
|
|
1292
|
+
let isPartial = bitmask & PARTIAL_COMPARE_FLAG;
|
|
1293
|
+
convert || (convert = setToArray);
|
|
1294
|
+
if (object.size != other.size && !isPartial) {
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
let stacked = stack.get(object);
|
|
1298
|
+
if (stacked) {
|
|
1299
|
+
return stacked == other;
|
|
1300
|
+
}
|
|
1301
|
+
bitmask |= UNORDERED_COMPARE_FLAG;
|
|
1302
|
+
stack.set(object, other);
|
|
1303
|
+
let result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
|
|
1304
|
+
stack['delete'](object);
|
|
1305
|
+
return result;
|
|
1306
|
+
case symbolTag:
|
|
1307
|
+
if (symbolValueOf) {
|
|
1308
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
1314
|
+
let isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
|
|
1315
|
+
if (objLength != othLength && !isPartial) {
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
let index = objLength;
|
|
1319
|
+
while (index--) {
|
|
1320
|
+
let key = objProps[index];
|
|
1321
|
+
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
1322
|
+
return false;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
let stacked = stack.get(object);
|
|
1326
|
+
if (stacked && stack.get(other)) {
|
|
1327
|
+
return stacked == other;
|
|
1328
|
+
}
|
|
1329
|
+
let result = true;
|
|
1330
|
+
stack.set(object, other);
|
|
1331
|
+
stack.set(other, object);
|
|
1332
|
+
let skipCtor = isPartial;
|
|
1333
|
+
while (++index < objLength) {
|
|
1334
|
+
key = objProps[index];
|
|
1335
|
+
let objValue = object[key], othValue = other[key];
|
|
1336
|
+
if (customizer) {
|
|
1337
|
+
let compared = isPartial
|
|
1338
|
+
? customizer(othValue, objValue, key, other, object, stack)
|
|
1339
|
+
: customizer(objValue, othValue, key, object, other, stack);
|
|
1340
|
+
}
|
|
1341
|
+
if (!(compared === undefined
|
|
1342
|
+
? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)
|
|
1343
|
+
: compared)) {
|
|
1344
|
+
result = false;
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
skipCtor || (skipCtor = key == 'constructor');
|
|
1348
|
+
}
|
|
1349
|
+
if (result && !skipCtor) {
|
|
1350
|
+
let objCtor = object.constructor, othCtor = other.constructor;
|
|
1351
|
+
if (objCtor != othCtor &&
|
|
1352
|
+
'constructor' in object &&
|
|
1353
|
+
'constructor' in other &&
|
|
1354
|
+
!(typeof objCtor == 'function' &&
|
|
1355
|
+
objCtor instanceof objCtor &&
|
|
1356
|
+
typeof othCtor == 'function' &&
|
|
1357
|
+
othCtor instanceof othCtor)) {
|
|
1358
|
+
result = false;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
stack['delete'](object);
|
|
1362
|
+
stack['delete'](other);
|
|
1363
|
+
return result;
|
|
1364
|
+
}
|
|
1365
|
+
function getMapData(map, key) {
|
|
1366
|
+
let data = map.__data__;
|
|
1367
|
+
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
|
|
1368
|
+
}
|
|
1369
|
+
function getMatchData(object) {
|
|
1370
|
+
let result = keys(object), length = result.length;
|
|
1371
|
+
while (length--) {
|
|
1372
|
+
let key = result[length], value = object[key];
|
|
1373
|
+
result[length] = [key, value, isStrictComparable(value)];
|
|
1374
|
+
}
|
|
1375
|
+
return result;
|
|
1376
|
+
}
|
|
1377
|
+
function getNative(object, key) {
|
|
1378
|
+
let value = getValue(object, key);
|
|
1379
|
+
return baseIsNative(value) ? value : undefined;
|
|
1380
|
+
}
|
|
1381
|
+
let getTag = baseGetTag;
|
|
1382
|
+
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
1383
|
+
(Map && getTag(new Map()) != mapTag) ||
|
|
1384
|
+
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
1385
|
+
(Set && getTag(new Set()) != setTag) ||
|
|
1386
|
+
(WeakMap && getTag(new WeakMap()) != weakMapTag)) {
|
|
1387
|
+
getTag = function (value) {
|
|
1388
|
+
let result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined;
|
|
1389
|
+
if (ctorString) {
|
|
1390
|
+
switch (ctorString) {
|
|
1391
|
+
case dataViewCtorString:
|
|
1392
|
+
return dataViewTag;
|
|
1393
|
+
case mapCtorString:
|
|
1394
|
+
return mapTag;
|
|
1395
|
+
case promiseCtorString:
|
|
1396
|
+
return promiseTag;
|
|
1397
|
+
case setCtorString:
|
|
1398
|
+
return setTag;
|
|
1399
|
+
case weakMapCtorString:
|
|
1400
|
+
return weakMapTag;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return result;
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
function hasPath(object, path, hasFunc) {
|
|
1407
|
+
path = isKey(path, object) ? [path] : castPath(path);
|
|
1408
|
+
let result;
|
|
1409
|
+
let index = -1;
|
|
1410
|
+
let length = path.length;
|
|
1411
|
+
while (++index < length) {
|
|
1412
|
+
let key = toKey(path[index]);
|
|
1413
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
1414
|
+
break;
|
|
1415
|
+
}
|
|
1416
|
+
object = object[key];
|
|
1417
|
+
}
|
|
1418
|
+
if (result) {
|
|
1419
|
+
return result;
|
|
1420
|
+
}
|
|
1421
|
+
length = object ? object.length : 0;
|
|
1422
|
+
return (!!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)));
|
|
1423
|
+
}
|
|
1424
|
+
function isIndex(value, length) {
|
|
1425
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
1426
|
+
return (!!length &&
|
|
1427
|
+
(typeof value == 'number' || reIsUint.test(value)) &&
|
|
1428
|
+
value > -1 &&
|
|
1429
|
+
value % 1 == 0 &&
|
|
1430
|
+
value < length);
|
|
1431
|
+
}
|
|
1432
|
+
function isKey(value, object) {
|
|
1433
|
+
if (isArray(value)) {
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
let type = typeof value;
|
|
1437
|
+
if (type == 'number' ||
|
|
1438
|
+
type == 'symbol' ||
|
|
1439
|
+
type == 'boolean' ||
|
|
1440
|
+
value == null ||
|
|
1441
|
+
isSymbol(value)) {
|
|
1442
|
+
return true;
|
|
1443
|
+
}
|
|
1444
|
+
return (reIsPlainProp.test(value) ||
|
|
1445
|
+
!reIsDeepProp.test(value) ||
|
|
1446
|
+
(object != null && value in Object(object)));
|
|
1447
|
+
}
|
|
1448
|
+
function isKeyable(value) {
|
|
1449
|
+
let type = typeof value;
|
|
1450
|
+
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean'
|
|
1451
|
+
? value !== '__proto__'
|
|
1452
|
+
: value === null;
|
|
1453
|
+
}
|
|
1454
|
+
function isMasked(func) {
|
|
1455
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
1456
|
+
}
|
|
1457
|
+
function isPrototype(value) {
|
|
1458
|
+
let Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
|
1459
|
+
return value === proto;
|
|
1460
|
+
}
|
|
1461
|
+
function isStrictComparable(value) {
|
|
1462
|
+
return value === value && !isObject(value);
|
|
1463
|
+
}
|
|
1464
|
+
function matchesStrictComparable(key, srcValue) {
|
|
1465
|
+
return function (object) {
|
|
1466
|
+
if (object == null) {
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
let stringToPath = memoize(function (string) {
|
|
1473
|
+
string = toString(string);
|
|
1474
|
+
let result = [];
|
|
1475
|
+
if (reLeadingDot.test(string)) {
|
|
1476
|
+
result.push('');
|
|
1477
|
+
}
|
|
1478
|
+
string.replace(rePropName, function (match, number, quote, string) {
|
|
1479
|
+
result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);
|
|
1480
|
+
});
|
|
1481
|
+
return result;
|
|
1482
|
+
});
|
|
1483
|
+
function toKey(value) {
|
|
1484
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
1485
|
+
return value;
|
|
1486
|
+
}
|
|
1487
|
+
let result = value + '';
|
|
1488
|
+
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
|
1489
|
+
}
|
|
1490
|
+
function toSource(func) {
|
|
1491
|
+
if (func != null) {
|
|
1492
|
+
try {
|
|
1493
|
+
return funcToString.call(func);
|
|
1494
|
+
}
|
|
1495
|
+
catch (e) { }
|
|
1496
|
+
try {
|
|
1497
|
+
return func + '';
|
|
1498
|
+
}
|
|
1499
|
+
catch (e) { }
|
|
1500
|
+
}
|
|
1501
|
+
return '';
|
|
1502
|
+
}
|
|
1503
|
+
function zxhiddenCustomOrderByByJeremyAshkenas(collection, iteratees, orders) {
|
|
1504
|
+
if (collection == null) {
|
|
1505
|
+
return [];
|
|
1506
|
+
}
|
|
1507
|
+
if (!isArray(iteratees)) {
|
|
1508
|
+
iteratees = iteratees == null ? [] : [iteratees];
|
|
1509
|
+
}
|
|
1510
|
+
if (!isArray(orders)) {
|
|
1511
|
+
orders = orders == null ? [] : [orders];
|
|
1512
|
+
}
|
|
1513
|
+
return baseOrderBy(collection, iteratees, orders);
|
|
1514
|
+
}
|
|
1515
|
+
function memoize(func, resolver) {
|
|
1516
|
+
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
1517
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1518
|
+
}
|
|
1519
|
+
let memoized = function () {
|
|
1520
|
+
let args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
1521
|
+
if (cache.has(key)) {
|
|
1522
|
+
return cache.get(key);
|
|
1523
|
+
}
|
|
1524
|
+
let result = func.apply(this, args);
|
|
1525
|
+
memoized.cache = cache.set(key, result);
|
|
1526
|
+
return result;
|
|
1527
|
+
};
|
|
1528
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
1529
|
+
return memoized;
|
|
1530
|
+
}
|
|
1531
|
+
memoize.Cache = MapCache;
|
|
1532
|
+
function eq(value, other) {
|
|
1533
|
+
return value === other || (value !== value && other !== other);
|
|
1534
|
+
}
|
|
1535
|
+
function isArguments(value) {
|
|
1536
|
+
return (isArrayLikeObject(value) &&
|
|
1537
|
+
hasOwnProperty.call(value, 'callee') &&
|
|
1538
|
+
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag));
|
|
1539
|
+
}
|
|
1540
|
+
let isArray = Array.isArray;
|
|
1541
|
+
function isArrayLike(value) {
|
|
1542
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
1543
|
+
}
|
|
1544
|
+
function isArrayLikeObject(value) {
|
|
1545
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
1546
|
+
}
|
|
1547
|
+
function isFunction(value) {
|
|
1548
|
+
let tag = isObject(value) ? objectToString.call(value) : '';
|
|
1549
|
+
return tag == funcTag || tag == genTag;
|
|
1550
|
+
}
|
|
1551
|
+
function isLength(value) {
|
|
1552
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1553
|
+
}
|
|
1554
|
+
function isObject(value) {
|
|
1555
|
+
let type = typeof value;
|
|
1556
|
+
return !!value && (type == 'object' || type == 'function');
|
|
1557
|
+
}
|
|
1558
|
+
function isObjectLike(value) {
|
|
1559
|
+
return !!value && typeof value == 'object';
|
|
1560
|
+
}
|
|
1561
|
+
function isSymbol(value) {
|
|
1562
|
+
return (typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag));
|
|
1563
|
+
}
|
|
1564
|
+
let isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1565
|
+
function toString(value) {
|
|
1566
|
+
return value == null ? '' : baseToString(value);
|
|
1567
|
+
}
|
|
1568
|
+
function get(object, path, defaultValue) {
|
|
1569
|
+
let result = object == null ? undefined : baseGet(object, path);
|
|
1570
|
+
return result === undefined ? defaultValue : result;
|
|
1571
|
+
}
|
|
1572
|
+
function hasIn(object, path) {
|
|
1573
|
+
return object != null && hasPath(object, path, baseHasIn);
|
|
1574
|
+
}
|
|
1575
|
+
function keys(object) {
|
|
1576
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1577
|
+
}
|
|
1578
|
+
function identity(value) {
|
|
1579
|
+
return value;
|
|
1580
|
+
}
|
|
1581
|
+
function property(path) {
|
|
1582
|
+
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* This method is like _.clone except that it recursively clones value.
|
|
1587
|
+
*
|
|
1588
|
+
* @param value The value to recursively clone.
|
|
1589
|
+
* @return Returns the deep cloned value.
|
|
1590
|
+
*/
|
|
1591
|
+
function cloneDeep(value) {
|
|
1592
|
+
return zxhiddenCustomCloneDeepByJeremyAshkenas(value);
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Creates a shallow clone of value.
|
|
1596
|
+
*
|
|
1597
|
+
* @param value The value to clone.
|
|
1598
|
+
* @return Returns the cloned value.
|
|
1599
|
+
*/
|
|
1600
|
+
function clone(value) {
|
|
1601
|
+
if (value instanceof Date)
|
|
1602
|
+
return new Date(value.getTime());
|
|
1603
|
+
if (value instanceof Array)
|
|
1604
|
+
return value.slice();
|
|
1605
|
+
if (typeof value === 'object')
|
|
1606
|
+
return JSON.parse(JSON.stringify(value));
|
|
1607
|
+
return value;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Creates an array of elements, sorted in ascending / descending order by
|
|
1611
|
+
* the results of running each element in a collection through each iteratee.
|
|
1612
|
+
* This method performs a stable sort, that is, it preserves the original
|
|
1613
|
+
* sort order of equal elements. The iteratees are invoked with one argument:
|
|
1614
|
+
* (value).
|
|
1615
|
+
*
|
|
1616
|
+
* @category Collection
|
|
1617
|
+
* @param collection The collection to iterate over.
|
|
1618
|
+
* @param [iteratees=[_.identity]] The iteratees to sort by.
|
|
1619
|
+
* @param [orders] The sort orders of `iteratees`.
|
|
1620
|
+
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
|
|
1621
|
+
* @returns Returns the new sorted array.
|
|
1622
|
+
* @example
|
|
1623
|
+
*
|
|
1624
|
+
* const users = [
|
|
1625
|
+
* { 'user': 'fred', 'age': 48 },
|
|
1626
|
+
* { 'user': 'barney', 'age': 34 },
|
|
1627
|
+
* { 'user': 'fred', 'age': 42 },
|
|
1628
|
+
* { 'user': 'barney', 'age': 36 }
|
|
1629
|
+
* ];
|
|
1630
|
+
*
|
|
1631
|
+
* // sort by `user` in ascending order and by `age` in descending order
|
|
1632
|
+
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
|
|
1633
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
|
1634
|
+
*/
|
|
1635
|
+
function orderBy(collection, iteratees, orders) {
|
|
1636
|
+
return zxhiddenCustomOrderByByJeremyAshkenas(collection, iteratees, orders);
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Return a clone without duplicated values.
|
|
1640
|
+
*
|
|
1641
|
+
* @param collection
|
|
1642
|
+
* @param key
|
|
1643
|
+
* @example
|
|
1644
|
+
*
|
|
1645
|
+
* const data = [1,2,2,3,4,4];
|
|
1646
|
+
* const result = uniq(data); // [1,2,3,4]
|
|
1647
|
+
*
|
|
1648
|
+
* const dataArr = [
|
|
1649
|
+
* {nombre : 'Enrique', lastName : 'Cuello'},
|
|
1650
|
+
* {nombre : 'Maria', lastName : 'Aponte'},
|
|
1651
|
+
* {nombre : 'Enrique', lastName : 'De Armas'},
|
|
1652
|
+
* ];
|
|
1653
|
+
*
|
|
1654
|
+
* const resultArr = uniq(dataArr, 'nombre');
|
|
1655
|
+
* // [{nombre : 'Enrique', lastName : 'Cuello'},{nombre : 'Maria', lastName : 'Aponte'}]
|
|
1656
|
+
*/
|
|
1657
|
+
function uniq(collection, key) {
|
|
1658
|
+
let result = [];
|
|
1659
|
+
collection.forEach((_, i) => {
|
|
1660
|
+
if (!i)
|
|
1661
|
+
result.push(_);
|
|
1662
|
+
if (!key) {
|
|
1663
|
+
if (!result.filter(_2 => _2 === _).length)
|
|
1664
|
+
result.push(_);
|
|
1665
|
+
}
|
|
1666
|
+
else {
|
|
1667
|
+
if (!result.filter(_2 => _2[key] === _[key]).length)
|
|
1668
|
+
result.push(_);
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
return result;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
const isDefined = (object) => typeof object !== 'undefined' && object !== null;
|
|
1675
|
+
const isLeft = (value) => isDefined(value.left);
|
|
1676
|
+
const isRight = (value) => isDefined(value.right);
|
|
1677
|
+
const makeLeft = (value) => ({ left: value });
|
|
1678
|
+
const makeRight = (value) => ({ right: value });
|
|
1679
|
+
const unwrapEither = (value) => {
|
|
1680
|
+
const { left, right } = value;
|
|
1681
|
+
const errorMsn_1 = 'Received both left and right values at runtime';
|
|
1682
|
+
const errorMsn_2 = 'Received no left or right values at runtime when opening Either';
|
|
1683
|
+
if (isDefined(right) && isDefined(left))
|
|
1684
|
+
throw new Error(errorMsn_1);
|
|
1685
|
+
if (isDefined(left))
|
|
1686
|
+
return left;
|
|
1687
|
+
if (isDefined(right))
|
|
1688
|
+
return right;
|
|
1689
|
+
throw new Error(errorMsn_2);
|
|
1690
|
+
};
|
|
1691
|
+
const getErrorMessage = (error) => {
|
|
1692
|
+
if (error) {
|
|
1693
|
+
if (error.error)
|
|
1694
|
+
return error.error.message || error.error.status;
|
|
1695
|
+
else
|
|
1696
|
+
return error.message || error;
|
|
1697
|
+
}
|
|
1698
|
+
else
|
|
1699
|
+
return error;
|
|
1700
|
+
};
|
|
1701
|
+
class Either {
|
|
1702
|
+
constructor(value) {
|
|
1703
|
+
this.value = value;
|
|
1704
|
+
}
|
|
1705
|
+
fold(resolver) {
|
|
1706
|
+
if (isRight(this.value) && resolver.right)
|
|
1707
|
+
return resolver.right(unwrapEither(this.value));
|
|
1708
|
+
if (isLeft(this.value) && resolver.left)
|
|
1709
|
+
return resolver.left(unwrapEither(this.value));
|
|
1710
|
+
return undefined;
|
|
1711
|
+
}
|
|
1712
|
+
static left(value, isErr = true) {
|
|
1713
|
+
if (typeof value === 'object' && isErr)
|
|
1714
|
+
return new Either(makeLeft(getErrorMessage(value)));
|
|
1715
|
+
else
|
|
1716
|
+
return new Either(makeLeft(value));
|
|
1717
|
+
}
|
|
1718
|
+
static right(value) {
|
|
1719
|
+
return new Either(makeRight(value));
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// Regex to split a windows path into three parts: [*, device, slash,
|
|
1724
|
+
// tail] windows-only
|
|
1725
|
+
const splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
1726
|
+
// Regex to split the tail part of the above into [*, dir, basename, ext]
|
|
1727
|
+
const splitTailRe = /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
|
1728
|
+
// Function to split a filename into [root, dir, basename, ext]
|
|
1729
|
+
function win32SplitPath(filename) {
|
|
1730
|
+
// Separate device+slash from tail
|
|
1731
|
+
const result = splitDeviceRe.exec(filename), device = (result[1] || '') + (result[2] || ''), tail = result[3] || '';
|
|
1732
|
+
// Split the tail into dir, basename and extension
|
|
1733
|
+
const result2 = splitTailRe.exec(tail), dir = result2[1], basename = result2[2], ext = result2[3];
|
|
1734
|
+
return [device, dir, basename, ext];
|
|
1735
|
+
}
|
|
1736
|
+
const extname = (path) => {
|
|
1737
|
+
return win32SplitPath(path)[3];
|
|
1738
|
+
};
|
|
1739
|
+
|
|
1740
|
+
/*
|
|
1741
|
+
* Public API Surface of @kato-lee/utilities
|
|
1742
|
+
*/
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Generated bundle index. Do not edit.
|
|
1746
|
+
*/
|
|
1747
|
+
|
|
1748
|
+
export { Either, clone, cloneDeep, extname, groupByKey, orderBy, uniq };
|
|
1749
|
+
//# sourceMappingURL=kato-lee-utilities.mjs.map
|