object-flatten-all-arrays 5.0.16 → 6.0.2

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.
@@ -1,3964 +0,0 @@
1
- /**
2
- * @name object-flatten-all-arrays
3
- * @fileoverview Merge and flatten any arrays found in all values within plain objects
4
- * @version 5.0.16
5
- * @author Roy Revelt, Codsen Ltd
6
- * @license MIT
7
- * {@link https://codsen.com/os/object-flatten-all-arrays/}
8
- */
9
-
10
- (function (global, factory) {
11
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
12
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
13
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.objectFlattenAllArrays = {}));
14
- }(this, (function (exports) { 'use strict';
15
-
16
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
17
-
18
- function createCommonjsModule(fn) {
19
- var module = { exports: {} };
20
- return fn(module, module.exports), module.exports;
21
- }
22
-
23
- /**
24
- * Lodash (Custom Build) <https://lodash.com/>
25
- * Build: `lodash modularize exports="npm" -o ./`
26
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
27
- * Released under MIT license <https://lodash.com/license>
28
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
29
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
30
- */
31
-
32
- var lodash_merge = createCommonjsModule(function (module, exports) {
33
- /** Used as the size to enable large array optimizations. */
34
- var LARGE_ARRAY_SIZE = 200;
35
-
36
- /** Used to stand-in for `undefined` hash values. */
37
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
38
-
39
- /** Used to detect hot functions by number of calls within a span of milliseconds. */
40
- var HOT_COUNT = 800,
41
- HOT_SPAN = 16;
42
-
43
- /** Used as references for various `Number` constants. */
44
- var MAX_SAFE_INTEGER = 9007199254740991;
45
-
46
- /** `Object#toString` result references. */
47
- var argsTag = '[object Arguments]',
48
- arrayTag = '[object Array]',
49
- asyncTag = '[object AsyncFunction]',
50
- boolTag = '[object Boolean]',
51
- dateTag = '[object Date]',
52
- errorTag = '[object Error]',
53
- funcTag = '[object Function]',
54
- genTag = '[object GeneratorFunction]',
55
- mapTag = '[object Map]',
56
- numberTag = '[object Number]',
57
- nullTag = '[object Null]',
58
- objectTag = '[object Object]',
59
- proxyTag = '[object Proxy]',
60
- regexpTag = '[object RegExp]',
61
- setTag = '[object Set]',
62
- stringTag = '[object String]',
63
- undefinedTag = '[object Undefined]',
64
- weakMapTag = '[object WeakMap]';
65
-
66
- var arrayBufferTag = '[object ArrayBuffer]',
67
- dataViewTag = '[object DataView]',
68
- float32Tag = '[object Float32Array]',
69
- float64Tag = '[object Float64Array]',
70
- int8Tag = '[object Int8Array]',
71
- int16Tag = '[object Int16Array]',
72
- int32Tag = '[object Int32Array]',
73
- uint8Tag = '[object Uint8Array]',
74
- uint8ClampedTag = '[object Uint8ClampedArray]',
75
- uint16Tag = '[object Uint16Array]',
76
- uint32Tag = '[object Uint32Array]';
77
-
78
- /**
79
- * Used to match `RegExp`
80
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
81
- */
82
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
83
-
84
- /** Used to detect host constructors (Safari). */
85
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
86
-
87
- /** Used to detect unsigned integer values. */
88
- var reIsUint = /^(?:0|[1-9]\d*)$/;
89
-
90
- /** Used to identify `toStringTag` values of typed arrays. */
91
- var typedArrayTags = {};
92
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
93
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
94
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
95
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
96
- typedArrayTags[uint32Tag] = true;
97
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
98
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
99
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
100
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
101
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
102
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
103
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
104
- typedArrayTags[weakMapTag] = false;
105
-
106
- /** Detect free variable `global` from Node.js. */
107
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
108
-
109
- /** Detect free variable `self`. */
110
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
111
-
112
- /** Used as a reference to the global object. */
113
- var root = freeGlobal || freeSelf || Function('return this')();
114
-
115
- /** Detect free variable `exports`. */
116
- var freeExports = exports && !exports.nodeType && exports;
117
-
118
- /** Detect free variable `module`. */
119
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
120
-
121
- /** Detect the popular CommonJS extension `module.exports`. */
122
- var moduleExports = freeModule && freeModule.exports === freeExports;
123
-
124
- /** Detect free variable `process` from Node.js. */
125
- var freeProcess = moduleExports && freeGlobal.process;
126
-
127
- /** Used to access faster Node.js helpers. */
128
- var nodeUtil = (function() {
129
- try {
130
- // Use `util.types` for Node.js 10+.
131
- var types = freeModule && freeModule.require && freeModule.require('util').types;
132
-
133
- if (types) {
134
- return types;
135
- }
136
-
137
- // Legacy `process.binding('util')` for Node.js < 10.
138
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
139
- } catch (e) {}
140
- }());
141
-
142
- /* Node.js helper references. */
143
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
144
-
145
- /**
146
- * A faster alternative to `Function#apply`, this function invokes `func`
147
- * with the `this` binding of `thisArg` and the arguments of `args`.
148
- *
149
- * @private
150
- * @param {Function} func The function to invoke.
151
- * @param {*} thisArg The `this` binding of `func`.
152
- * @param {Array} args The arguments to invoke `func` with.
153
- * @returns {*} Returns the result of `func`.
154
- */
155
- function apply(func, thisArg, args) {
156
- switch (args.length) {
157
- case 0: return func.call(thisArg);
158
- case 1: return func.call(thisArg, args[0]);
159
- case 2: return func.call(thisArg, args[0], args[1]);
160
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
161
- }
162
- return func.apply(thisArg, args);
163
- }
164
-
165
- /**
166
- * The base implementation of `_.times` without support for iteratee shorthands
167
- * or max array length checks.
168
- *
169
- * @private
170
- * @param {number} n The number of times to invoke `iteratee`.
171
- * @param {Function} iteratee The function invoked per iteration.
172
- * @returns {Array} Returns the array of results.
173
- */
174
- function baseTimes(n, iteratee) {
175
- var index = -1,
176
- result = Array(n);
177
-
178
- while (++index < n) {
179
- result[index] = iteratee(index);
180
- }
181
- return result;
182
- }
183
-
184
- /**
185
- * The base implementation of `_.unary` without support for storing metadata.
186
- *
187
- * @private
188
- * @param {Function} func The function to cap arguments for.
189
- * @returns {Function} Returns the new capped function.
190
- */
191
- function baseUnary(func) {
192
- return function(value) {
193
- return func(value);
194
- };
195
- }
196
-
197
- /**
198
- * Gets the value at `key` of `object`.
199
- *
200
- * @private
201
- * @param {Object} [object] The object to query.
202
- * @param {string} key The key of the property to get.
203
- * @returns {*} Returns the property value.
204
- */
205
- function getValue(object, key) {
206
- return object == null ? undefined : object[key];
207
- }
208
-
209
- /**
210
- * Creates a unary function that invokes `func` with its argument transformed.
211
- *
212
- * @private
213
- * @param {Function} func The function to wrap.
214
- * @param {Function} transform The argument transform.
215
- * @returns {Function} Returns the new function.
216
- */
217
- function overArg(func, transform) {
218
- return function(arg) {
219
- return func(transform(arg));
220
- };
221
- }
222
-
223
- /** Used for built-in method references. */
224
- var arrayProto = Array.prototype,
225
- funcProto = Function.prototype,
226
- objectProto = Object.prototype;
227
-
228
- /** Used to detect overreaching core-js shims. */
229
- var coreJsData = root['__core-js_shared__'];
230
-
231
- /** Used to resolve the decompiled source of functions. */
232
- var funcToString = funcProto.toString;
233
-
234
- /** Used to check objects for own properties. */
235
- var hasOwnProperty = objectProto.hasOwnProperty;
236
-
237
- /** Used to detect methods masquerading as native. */
238
- var maskSrcKey = (function() {
239
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
240
- return uid ? ('Symbol(src)_1.' + uid) : '';
241
- }());
242
-
243
- /**
244
- * Used to resolve the
245
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
246
- * of values.
247
- */
248
- var nativeObjectToString = objectProto.toString;
249
-
250
- /** Used to infer the `Object` constructor. */
251
- var objectCtorString = funcToString.call(Object);
252
-
253
- /** Used to detect if a method is native. */
254
- var reIsNative = RegExp('^' +
255
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
256
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
257
- );
258
-
259
- /** Built-in value references. */
260
- var Buffer = moduleExports ? root.Buffer : undefined,
261
- Symbol = root.Symbol,
262
- Uint8Array = root.Uint8Array,
263
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
264
- getPrototype = overArg(Object.getPrototypeOf, Object),
265
- objectCreate = Object.create,
266
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
267
- splice = arrayProto.splice,
268
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
269
-
270
- var defineProperty = (function() {
271
- try {
272
- var func = getNative(Object, 'defineProperty');
273
- func({}, '', {});
274
- return func;
275
- } catch (e) {}
276
- }());
277
-
278
- /* Built-in method references for those with the same name as other `lodash` methods. */
279
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
280
- nativeMax = Math.max,
281
- nativeNow = Date.now;
282
-
283
- /* Built-in method references that are verified to be native. */
284
- var Map = getNative(root, 'Map'),
285
- nativeCreate = getNative(Object, 'create');
286
-
287
- /**
288
- * The base implementation of `_.create` without support for assigning
289
- * properties to the created object.
290
- *
291
- * @private
292
- * @param {Object} proto The object to inherit from.
293
- * @returns {Object} Returns the new object.
294
- */
295
- var baseCreate = (function() {
296
- function object() {}
297
- return function(proto) {
298
- if (!isObject(proto)) {
299
- return {};
300
- }
301
- if (objectCreate) {
302
- return objectCreate(proto);
303
- }
304
- object.prototype = proto;
305
- var result = new object;
306
- object.prototype = undefined;
307
- return result;
308
- };
309
- }());
310
-
311
- /**
312
- * Creates a hash object.
313
- *
314
- * @private
315
- * @constructor
316
- * @param {Array} [entries] The key-value pairs to cache.
317
- */
318
- function Hash(entries) {
319
- var index = -1,
320
- length = entries == null ? 0 : entries.length;
321
-
322
- this.clear();
323
- while (++index < length) {
324
- var entry = entries[index];
325
- this.set(entry[0], entry[1]);
326
- }
327
- }
328
-
329
- /**
330
- * Removes all key-value entries from the hash.
331
- *
332
- * @private
333
- * @name clear
334
- * @memberOf Hash
335
- */
336
- function hashClear() {
337
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
338
- this.size = 0;
339
- }
340
-
341
- /**
342
- * Removes `key` and its value from the hash.
343
- *
344
- * @private
345
- * @name delete
346
- * @memberOf Hash
347
- * @param {Object} hash The hash to modify.
348
- * @param {string} key The key of the value to remove.
349
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
350
- */
351
- function hashDelete(key) {
352
- var result = this.has(key) && delete this.__data__[key];
353
- this.size -= result ? 1 : 0;
354
- return result;
355
- }
356
-
357
- /**
358
- * Gets the hash value for `key`.
359
- *
360
- * @private
361
- * @name get
362
- * @memberOf Hash
363
- * @param {string} key The key of the value to get.
364
- * @returns {*} Returns the entry value.
365
- */
366
- function hashGet(key) {
367
- var data = this.__data__;
368
- if (nativeCreate) {
369
- var result = data[key];
370
- return result === HASH_UNDEFINED ? undefined : result;
371
- }
372
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
373
- }
374
-
375
- /**
376
- * Checks if a hash value for `key` exists.
377
- *
378
- * @private
379
- * @name has
380
- * @memberOf Hash
381
- * @param {string} key The key of the entry to check.
382
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
383
- */
384
- function hashHas(key) {
385
- var data = this.__data__;
386
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
387
- }
388
-
389
- /**
390
- * Sets the hash `key` to `value`.
391
- *
392
- * @private
393
- * @name set
394
- * @memberOf Hash
395
- * @param {string} key The key of the value to set.
396
- * @param {*} value The value to set.
397
- * @returns {Object} Returns the hash instance.
398
- */
399
- function hashSet(key, value) {
400
- var data = this.__data__;
401
- this.size += this.has(key) ? 0 : 1;
402
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
403
- return this;
404
- }
405
-
406
- // Add methods to `Hash`.
407
- Hash.prototype.clear = hashClear;
408
- Hash.prototype['delete'] = hashDelete;
409
- Hash.prototype.get = hashGet;
410
- Hash.prototype.has = hashHas;
411
- Hash.prototype.set = hashSet;
412
-
413
- /**
414
- * Creates an list cache object.
415
- *
416
- * @private
417
- * @constructor
418
- * @param {Array} [entries] The key-value pairs to cache.
419
- */
420
- function ListCache(entries) {
421
- var index = -1,
422
- length = entries == null ? 0 : entries.length;
423
-
424
- this.clear();
425
- while (++index < length) {
426
- var entry = entries[index];
427
- this.set(entry[0], entry[1]);
428
- }
429
- }
430
-
431
- /**
432
- * Removes all key-value entries from the list cache.
433
- *
434
- * @private
435
- * @name clear
436
- * @memberOf ListCache
437
- */
438
- function listCacheClear() {
439
- this.__data__ = [];
440
- this.size = 0;
441
- }
442
-
443
- /**
444
- * Removes `key` and its value from the list cache.
445
- *
446
- * @private
447
- * @name delete
448
- * @memberOf ListCache
449
- * @param {string} key The key of the value to remove.
450
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
451
- */
452
- function listCacheDelete(key) {
453
- var data = this.__data__,
454
- index = assocIndexOf(data, key);
455
-
456
- if (index < 0) {
457
- return false;
458
- }
459
- var lastIndex = data.length - 1;
460
- if (index == lastIndex) {
461
- data.pop();
462
- } else {
463
- splice.call(data, index, 1);
464
- }
465
- --this.size;
466
- return true;
467
- }
468
-
469
- /**
470
- * Gets the list cache value for `key`.
471
- *
472
- * @private
473
- * @name get
474
- * @memberOf ListCache
475
- * @param {string} key The key of the value to get.
476
- * @returns {*} Returns the entry value.
477
- */
478
- function listCacheGet(key) {
479
- var data = this.__data__,
480
- index = assocIndexOf(data, key);
481
-
482
- return index < 0 ? undefined : data[index][1];
483
- }
484
-
485
- /**
486
- * Checks if a list cache value for `key` exists.
487
- *
488
- * @private
489
- * @name has
490
- * @memberOf ListCache
491
- * @param {string} key The key of the entry to check.
492
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
493
- */
494
- function listCacheHas(key) {
495
- return assocIndexOf(this.__data__, key) > -1;
496
- }
497
-
498
- /**
499
- * Sets the list cache `key` to `value`.
500
- *
501
- * @private
502
- * @name set
503
- * @memberOf ListCache
504
- * @param {string} key The key of the value to set.
505
- * @param {*} value The value to set.
506
- * @returns {Object} Returns the list cache instance.
507
- */
508
- function listCacheSet(key, value) {
509
- var data = this.__data__,
510
- index = assocIndexOf(data, key);
511
-
512
- if (index < 0) {
513
- ++this.size;
514
- data.push([key, value]);
515
- } else {
516
- data[index][1] = value;
517
- }
518
- return this;
519
- }
520
-
521
- // Add methods to `ListCache`.
522
- ListCache.prototype.clear = listCacheClear;
523
- ListCache.prototype['delete'] = listCacheDelete;
524
- ListCache.prototype.get = listCacheGet;
525
- ListCache.prototype.has = listCacheHas;
526
- ListCache.prototype.set = listCacheSet;
527
-
528
- /**
529
- * Creates a map cache object to store key-value pairs.
530
- *
531
- * @private
532
- * @constructor
533
- * @param {Array} [entries] The key-value pairs to cache.
534
- */
535
- function MapCache(entries) {
536
- var index = -1,
537
- length = entries == null ? 0 : entries.length;
538
-
539
- this.clear();
540
- while (++index < length) {
541
- var entry = entries[index];
542
- this.set(entry[0], entry[1]);
543
- }
544
- }
545
-
546
- /**
547
- * Removes all key-value entries from the map.
548
- *
549
- * @private
550
- * @name clear
551
- * @memberOf MapCache
552
- */
553
- function mapCacheClear() {
554
- this.size = 0;
555
- this.__data__ = {
556
- 'hash': new Hash,
557
- 'map': new (Map || ListCache),
558
- 'string': new Hash
559
- };
560
- }
561
-
562
- /**
563
- * Removes `key` and its value from the map.
564
- *
565
- * @private
566
- * @name delete
567
- * @memberOf MapCache
568
- * @param {string} key The key of the value to remove.
569
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
570
- */
571
- function mapCacheDelete(key) {
572
- var result = getMapData(this, key)['delete'](key);
573
- this.size -= result ? 1 : 0;
574
- return result;
575
- }
576
-
577
- /**
578
- * Gets the map value for `key`.
579
- *
580
- * @private
581
- * @name get
582
- * @memberOf MapCache
583
- * @param {string} key The key of the value to get.
584
- * @returns {*} Returns the entry value.
585
- */
586
- function mapCacheGet(key) {
587
- return getMapData(this, key).get(key);
588
- }
589
-
590
- /**
591
- * Checks if a map value for `key` exists.
592
- *
593
- * @private
594
- * @name has
595
- * @memberOf MapCache
596
- * @param {string} key The key of the entry to check.
597
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
598
- */
599
- function mapCacheHas(key) {
600
- return getMapData(this, key).has(key);
601
- }
602
-
603
- /**
604
- * Sets the map `key` to `value`.
605
- *
606
- * @private
607
- * @name set
608
- * @memberOf MapCache
609
- * @param {string} key The key of the value to set.
610
- * @param {*} value The value to set.
611
- * @returns {Object} Returns the map cache instance.
612
- */
613
- function mapCacheSet(key, value) {
614
- var data = getMapData(this, key),
615
- size = data.size;
616
-
617
- data.set(key, value);
618
- this.size += data.size == size ? 0 : 1;
619
- return this;
620
- }
621
-
622
- // Add methods to `MapCache`.
623
- MapCache.prototype.clear = mapCacheClear;
624
- MapCache.prototype['delete'] = mapCacheDelete;
625
- MapCache.prototype.get = mapCacheGet;
626
- MapCache.prototype.has = mapCacheHas;
627
- MapCache.prototype.set = mapCacheSet;
628
-
629
- /**
630
- * Creates a stack cache object to store key-value pairs.
631
- *
632
- * @private
633
- * @constructor
634
- * @param {Array} [entries] The key-value pairs to cache.
635
- */
636
- function Stack(entries) {
637
- var data = this.__data__ = new ListCache(entries);
638
- this.size = data.size;
639
- }
640
-
641
- /**
642
- * Removes all key-value entries from the stack.
643
- *
644
- * @private
645
- * @name clear
646
- * @memberOf Stack
647
- */
648
- function stackClear() {
649
- this.__data__ = new ListCache;
650
- this.size = 0;
651
- }
652
-
653
- /**
654
- * Removes `key` and its value from the stack.
655
- *
656
- * @private
657
- * @name delete
658
- * @memberOf Stack
659
- * @param {string} key The key of the value to remove.
660
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
661
- */
662
- function stackDelete(key) {
663
- var data = this.__data__,
664
- result = data['delete'](key);
665
-
666
- this.size = data.size;
667
- return result;
668
- }
669
-
670
- /**
671
- * Gets the stack value for `key`.
672
- *
673
- * @private
674
- * @name get
675
- * @memberOf Stack
676
- * @param {string} key The key of the value to get.
677
- * @returns {*} Returns the entry value.
678
- */
679
- function stackGet(key) {
680
- return this.__data__.get(key);
681
- }
682
-
683
- /**
684
- * Checks if a stack value for `key` exists.
685
- *
686
- * @private
687
- * @name has
688
- * @memberOf Stack
689
- * @param {string} key The key of the entry to check.
690
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
691
- */
692
- function stackHas(key) {
693
- return this.__data__.has(key);
694
- }
695
-
696
- /**
697
- * Sets the stack `key` to `value`.
698
- *
699
- * @private
700
- * @name set
701
- * @memberOf Stack
702
- * @param {string} key The key of the value to set.
703
- * @param {*} value The value to set.
704
- * @returns {Object} Returns the stack cache instance.
705
- */
706
- function stackSet(key, value) {
707
- var data = this.__data__;
708
- if (data instanceof ListCache) {
709
- var pairs = data.__data__;
710
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
711
- pairs.push([key, value]);
712
- this.size = ++data.size;
713
- return this;
714
- }
715
- data = this.__data__ = new MapCache(pairs);
716
- }
717
- data.set(key, value);
718
- this.size = data.size;
719
- return this;
720
- }
721
-
722
- // Add methods to `Stack`.
723
- Stack.prototype.clear = stackClear;
724
- Stack.prototype['delete'] = stackDelete;
725
- Stack.prototype.get = stackGet;
726
- Stack.prototype.has = stackHas;
727
- Stack.prototype.set = stackSet;
728
-
729
- /**
730
- * Creates an array of the enumerable property names of the array-like `value`.
731
- *
732
- * @private
733
- * @param {*} value The value to query.
734
- * @param {boolean} inherited Specify returning inherited property names.
735
- * @returns {Array} Returns the array of property names.
736
- */
737
- function arrayLikeKeys(value, inherited) {
738
- var isArr = isArray(value),
739
- isArg = !isArr && isArguments(value),
740
- isBuff = !isArr && !isArg && isBuffer(value),
741
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
742
- skipIndexes = isArr || isArg || isBuff || isType,
743
- result = skipIndexes ? baseTimes(value.length, String) : [],
744
- length = result.length;
745
-
746
- for (var key in value) {
747
- if ((inherited || hasOwnProperty.call(value, key)) &&
748
- !(skipIndexes && (
749
- // Safari 9 has enumerable `arguments.length` in strict mode.
750
- key == 'length' ||
751
- // Node.js 0.10 has enumerable non-index properties on buffers.
752
- (isBuff && (key == 'offset' || key == 'parent')) ||
753
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
754
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
755
- // Skip index properties.
756
- isIndex(key, length)
757
- ))) {
758
- result.push(key);
759
- }
760
- }
761
- return result;
762
- }
763
-
764
- /**
765
- * This function is like `assignValue` except that it doesn't assign
766
- * `undefined` values.
767
- *
768
- * @private
769
- * @param {Object} object The object to modify.
770
- * @param {string} key The key of the property to assign.
771
- * @param {*} value The value to assign.
772
- */
773
- function assignMergeValue(object, key, value) {
774
- if ((value !== undefined && !eq(object[key], value)) ||
775
- (value === undefined && !(key in object))) {
776
- baseAssignValue(object, key, value);
777
- }
778
- }
779
-
780
- /**
781
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
782
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
783
- * for equality comparisons.
784
- *
785
- * @private
786
- * @param {Object} object The object to modify.
787
- * @param {string} key The key of the property to assign.
788
- * @param {*} value The value to assign.
789
- */
790
- function assignValue(object, key, value) {
791
- var objValue = object[key];
792
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
793
- (value === undefined && !(key in object))) {
794
- baseAssignValue(object, key, value);
795
- }
796
- }
797
-
798
- /**
799
- * Gets the index at which the `key` is found in `array` of key-value pairs.
800
- *
801
- * @private
802
- * @param {Array} array The array to inspect.
803
- * @param {*} key The key to search for.
804
- * @returns {number} Returns the index of the matched value, else `-1`.
805
- */
806
- function assocIndexOf(array, key) {
807
- var length = array.length;
808
- while (length--) {
809
- if (eq(array[length][0], key)) {
810
- return length;
811
- }
812
- }
813
- return -1;
814
- }
815
-
816
- /**
817
- * The base implementation of `assignValue` and `assignMergeValue` without
818
- * value checks.
819
- *
820
- * @private
821
- * @param {Object} object The object to modify.
822
- * @param {string} key The key of the property to assign.
823
- * @param {*} value The value to assign.
824
- */
825
- function baseAssignValue(object, key, value) {
826
- if (key == '__proto__' && defineProperty) {
827
- defineProperty(object, key, {
828
- 'configurable': true,
829
- 'enumerable': true,
830
- 'value': value,
831
- 'writable': true
832
- });
833
- } else {
834
- object[key] = value;
835
- }
836
- }
837
-
838
- /**
839
- * The base implementation of `baseForOwn` which iterates over `object`
840
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
841
- * Iteratee functions may exit iteration early by explicitly returning `false`.
842
- *
843
- * @private
844
- * @param {Object} object The object to iterate over.
845
- * @param {Function} iteratee The function invoked per iteration.
846
- * @param {Function} keysFunc The function to get the keys of `object`.
847
- * @returns {Object} Returns `object`.
848
- */
849
- var baseFor = createBaseFor();
850
-
851
- /**
852
- * The base implementation of `getTag` without fallbacks for buggy environments.
853
- *
854
- * @private
855
- * @param {*} value The value to query.
856
- * @returns {string} Returns the `toStringTag`.
857
- */
858
- function baseGetTag(value) {
859
- if (value == null) {
860
- return value === undefined ? undefinedTag : nullTag;
861
- }
862
- return (symToStringTag && symToStringTag in Object(value))
863
- ? getRawTag(value)
864
- : objectToString(value);
865
- }
866
-
867
- /**
868
- * The base implementation of `_.isArguments`.
869
- *
870
- * @private
871
- * @param {*} value The value to check.
872
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
873
- */
874
- function baseIsArguments(value) {
875
- return isObjectLike(value) && baseGetTag(value) == argsTag;
876
- }
877
-
878
- /**
879
- * The base implementation of `_.isNative` without bad shim checks.
880
- *
881
- * @private
882
- * @param {*} value The value to check.
883
- * @returns {boolean} Returns `true` if `value` is a native function,
884
- * else `false`.
885
- */
886
- function baseIsNative(value) {
887
- if (!isObject(value) || isMasked(value)) {
888
- return false;
889
- }
890
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
891
- return pattern.test(toSource(value));
892
- }
893
-
894
- /**
895
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
896
- *
897
- * @private
898
- * @param {*} value The value to check.
899
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
900
- */
901
- function baseIsTypedArray(value) {
902
- return isObjectLike(value) &&
903
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
904
- }
905
-
906
- /**
907
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
908
- *
909
- * @private
910
- * @param {Object} object The object to query.
911
- * @returns {Array} Returns the array of property names.
912
- */
913
- function baseKeysIn(object) {
914
- if (!isObject(object)) {
915
- return nativeKeysIn(object);
916
- }
917
- var isProto = isPrototype(object),
918
- result = [];
919
-
920
- for (var key in object) {
921
- if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
922
- result.push(key);
923
- }
924
- }
925
- return result;
926
- }
927
-
928
- /**
929
- * The base implementation of `_.merge` without support for multiple sources.
930
- *
931
- * @private
932
- * @param {Object} object The destination object.
933
- * @param {Object} source The source object.
934
- * @param {number} srcIndex The index of `source`.
935
- * @param {Function} [customizer] The function to customize merged values.
936
- * @param {Object} [stack] Tracks traversed source values and their merged
937
- * counterparts.
938
- */
939
- function baseMerge(object, source, srcIndex, customizer, stack) {
940
- if (object === source) {
941
- return;
942
- }
943
- baseFor(source, function(srcValue, key) {
944
- stack || (stack = new Stack);
945
- if (isObject(srcValue)) {
946
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
947
- }
948
- else {
949
- var newValue = customizer
950
- ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
951
- : undefined;
952
-
953
- if (newValue === undefined) {
954
- newValue = srcValue;
955
- }
956
- assignMergeValue(object, key, newValue);
957
- }
958
- }, keysIn);
959
- }
960
-
961
- /**
962
- * A specialized version of `baseMerge` for arrays and objects which performs
963
- * deep merges and tracks traversed objects enabling objects with circular
964
- * references to be merged.
965
- *
966
- * @private
967
- * @param {Object} object The destination object.
968
- * @param {Object} source The source object.
969
- * @param {string} key The key of the value to merge.
970
- * @param {number} srcIndex The index of `source`.
971
- * @param {Function} mergeFunc The function to merge values.
972
- * @param {Function} [customizer] The function to customize assigned values.
973
- * @param {Object} [stack] Tracks traversed source values and their merged
974
- * counterparts.
975
- */
976
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
977
- var objValue = safeGet(object, key),
978
- srcValue = safeGet(source, key),
979
- stacked = stack.get(srcValue);
980
-
981
- if (stacked) {
982
- assignMergeValue(object, key, stacked);
983
- return;
984
- }
985
- var newValue = customizer
986
- ? customizer(objValue, srcValue, (key + ''), object, source, stack)
987
- : undefined;
988
-
989
- var isCommon = newValue === undefined;
990
-
991
- if (isCommon) {
992
- var isArr = isArray(srcValue),
993
- isBuff = !isArr && isBuffer(srcValue),
994
- isTyped = !isArr && !isBuff && isTypedArray(srcValue);
995
-
996
- newValue = srcValue;
997
- if (isArr || isBuff || isTyped) {
998
- if (isArray(objValue)) {
999
- newValue = objValue;
1000
- }
1001
- else if (isArrayLikeObject(objValue)) {
1002
- newValue = copyArray(objValue);
1003
- }
1004
- else if (isBuff) {
1005
- isCommon = false;
1006
- newValue = cloneBuffer(srcValue, true);
1007
- }
1008
- else if (isTyped) {
1009
- isCommon = false;
1010
- newValue = cloneTypedArray(srcValue, true);
1011
- }
1012
- else {
1013
- newValue = [];
1014
- }
1015
- }
1016
- else if (isPlainObject(srcValue) || isArguments(srcValue)) {
1017
- newValue = objValue;
1018
- if (isArguments(objValue)) {
1019
- newValue = toPlainObject(objValue);
1020
- }
1021
- else if (!isObject(objValue) || isFunction(objValue)) {
1022
- newValue = initCloneObject(srcValue);
1023
- }
1024
- }
1025
- else {
1026
- isCommon = false;
1027
- }
1028
- }
1029
- if (isCommon) {
1030
- // Recursively merge objects and arrays (susceptible to call stack limits).
1031
- stack.set(srcValue, newValue);
1032
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
1033
- stack['delete'](srcValue);
1034
- }
1035
- assignMergeValue(object, key, newValue);
1036
- }
1037
-
1038
- /**
1039
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
1040
- *
1041
- * @private
1042
- * @param {Function} func The function to apply a rest parameter to.
1043
- * @param {number} [start=func.length-1] The start position of the rest parameter.
1044
- * @returns {Function} Returns the new function.
1045
- */
1046
- function baseRest(func, start) {
1047
- return setToString(overRest(func, start, identity), func + '');
1048
- }
1049
-
1050
- /**
1051
- * The base implementation of `setToString` without support for hot loop shorting.
1052
- *
1053
- * @private
1054
- * @param {Function} func The function to modify.
1055
- * @param {Function} string The `toString` result.
1056
- * @returns {Function} Returns `func`.
1057
- */
1058
- var baseSetToString = !defineProperty ? identity : function(func, string) {
1059
- return defineProperty(func, 'toString', {
1060
- 'configurable': true,
1061
- 'enumerable': false,
1062
- 'value': constant(string),
1063
- 'writable': true
1064
- });
1065
- };
1066
-
1067
- /**
1068
- * Creates a clone of `buffer`.
1069
- *
1070
- * @private
1071
- * @param {Buffer} buffer The buffer to clone.
1072
- * @param {boolean} [isDeep] Specify a deep clone.
1073
- * @returns {Buffer} Returns the cloned buffer.
1074
- */
1075
- function cloneBuffer(buffer, isDeep) {
1076
- if (isDeep) {
1077
- return buffer.slice();
1078
- }
1079
- var length = buffer.length,
1080
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1081
-
1082
- buffer.copy(result);
1083
- return result;
1084
- }
1085
-
1086
- /**
1087
- * Creates a clone of `arrayBuffer`.
1088
- *
1089
- * @private
1090
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
1091
- * @returns {ArrayBuffer} Returns the cloned array buffer.
1092
- */
1093
- function cloneArrayBuffer(arrayBuffer) {
1094
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1095
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
1096
- return result;
1097
- }
1098
-
1099
- /**
1100
- * Creates a clone of `typedArray`.
1101
- *
1102
- * @private
1103
- * @param {Object} typedArray The typed array to clone.
1104
- * @param {boolean} [isDeep] Specify a deep clone.
1105
- * @returns {Object} Returns the cloned typed array.
1106
- */
1107
- function cloneTypedArray(typedArray, isDeep) {
1108
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
1109
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1110
- }
1111
-
1112
- /**
1113
- * Copies the values of `source` to `array`.
1114
- *
1115
- * @private
1116
- * @param {Array} source The array to copy values from.
1117
- * @param {Array} [array=[]] The array to copy values to.
1118
- * @returns {Array} Returns `array`.
1119
- */
1120
- function copyArray(source, array) {
1121
- var index = -1,
1122
- length = source.length;
1123
-
1124
- array || (array = Array(length));
1125
- while (++index < length) {
1126
- array[index] = source[index];
1127
- }
1128
- return array;
1129
- }
1130
-
1131
- /**
1132
- * Copies properties of `source` to `object`.
1133
- *
1134
- * @private
1135
- * @param {Object} source The object to copy properties from.
1136
- * @param {Array} props The property identifiers to copy.
1137
- * @param {Object} [object={}] The object to copy properties to.
1138
- * @param {Function} [customizer] The function to customize copied values.
1139
- * @returns {Object} Returns `object`.
1140
- */
1141
- function copyObject(source, props, object, customizer) {
1142
- var isNew = !object;
1143
- object || (object = {});
1144
-
1145
- var index = -1,
1146
- length = props.length;
1147
-
1148
- while (++index < length) {
1149
- var key = props[index];
1150
-
1151
- var newValue = customizer
1152
- ? customizer(object[key], source[key], key, object, source)
1153
- : undefined;
1154
-
1155
- if (newValue === undefined) {
1156
- newValue = source[key];
1157
- }
1158
- if (isNew) {
1159
- baseAssignValue(object, key, newValue);
1160
- } else {
1161
- assignValue(object, key, newValue);
1162
- }
1163
- }
1164
- return object;
1165
- }
1166
-
1167
- /**
1168
- * Creates a function like `_.assign`.
1169
- *
1170
- * @private
1171
- * @param {Function} assigner The function to assign values.
1172
- * @returns {Function} Returns the new assigner function.
1173
- */
1174
- function createAssigner(assigner) {
1175
- return baseRest(function(object, sources) {
1176
- var index = -1,
1177
- length = sources.length,
1178
- customizer = length > 1 ? sources[length - 1] : undefined,
1179
- guard = length > 2 ? sources[2] : undefined;
1180
-
1181
- customizer = (assigner.length > 3 && typeof customizer == 'function')
1182
- ? (length--, customizer)
1183
- : undefined;
1184
-
1185
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
1186
- customizer = length < 3 ? undefined : customizer;
1187
- length = 1;
1188
- }
1189
- object = Object(object);
1190
- while (++index < length) {
1191
- var source = sources[index];
1192
- if (source) {
1193
- assigner(object, source, index, customizer);
1194
- }
1195
- }
1196
- return object;
1197
- });
1198
- }
1199
-
1200
- /**
1201
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
1202
- *
1203
- * @private
1204
- * @param {boolean} [fromRight] Specify iterating from right to left.
1205
- * @returns {Function} Returns the new base function.
1206
- */
1207
- function createBaseFor(fromRight) {
1208
- return function(object, iteratee, keysFunc) {
1209
- var index = -1,
1210
- iterable = Object(object),
1211
- props = keysFunc(object),
1212
- length = props.length;
1213
-
1214
- while (length--) {
1215
- var key = props[fromRight ? length : ++index];
1216
- if (iteratee(iterable[key], key, iterable) === false) {
1217
- break;
1218
- }
1219
- }
1220
- return object;
1221
- };
1222
- }
1223
-
1224
- /**
1225
- * Gets the data for `map`.
1226
- *
1227
- * @private
1228
- * @param {Object} map The map to query.
1229
- * @param {string} key The reference key.
1230
- * @returns {*} Returns the map data.
1231
- */
1232
- function getMapData(map, key) {
1233
- var data = map.__data__;
1234
- return isKeyable(key)
1235
- ? data[typeof key == 'string' ? 'string' : 'hash']
1236
- : data.map;
1237
- }
1238
-
1239
- /**
1240
- * Gets the native function at `key` of `object`.
1241
- *
1242
- * @private
1243
- * @param {Object} object The object to query.
1244
- * @param {string} key The key of the method to get.
1245
- * @returns {*} Returns the function if it's native, else `undefined`.
1246
- */
1247
- function getNative(object, key) {
1248
- var value = getValue(object, key);
1249
- return baseIsNative(value) ? value : undefined;
1250
- }
1251
-
1252
- /**
1253
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1254
- *
1255
- * @private
1256
- * @param {*} value The value to query.
1257
- * @returns {string} Returns the raw `toStringTag`.
1258
- */
1259
- function getRawTag(value) {
1260
- var isOwn = hasOwnProperty.call(value, symToStringTag),
1261
- tag = value[symToStringTag];
1262
-
1263
- try {
1264
- value[symToStringTag] = undefined;
1265
- var unmasked = true;
1266
- } catch (e) {}
1267
-
1268
- var result = nativeObjectToString.call(value);
1269
- if (unmasked) {
1270
- if (isOwn) {
1271
- value[symToStringTag] = tag;
1272
- } else {
1273
- delete value[symToStringTag];
1274
- }
1275
- }
1276
- return result;
1277
- }
1278
-
1279
- /**
1280
- * Initializes an object clone.
1281
- *
1282
- * @private
1283
- * @param {Object} object The object to clone.
1284
- * @returns {Object} Returns the initialized clone.
1285
- */
1286
- function initCloneObject(object) {
1287
- return (typeof object.constructor == 'function' && !isPrototype(object))
1288
- ? baseCreate(getPrototype(object))
1289
- : {};
1290
- }
1291
-
1292
- /**
1293
- * Checks if `value` is a valid array-like index.
1294
- *
1295
- * @private
1296
- * @param {*} value The value to check.
1297
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1298
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1299
- */
1300
- function isIndex(value, length) {
1301
- var type = typeof value;
1302
- length = length == null ? MAX_SAFE_INTEGER : length;
1303
-
1304
- return !!length &&
1305
- (type == 'number' ||
1306
- (type != 'symbol' && reIsUint.test(value))) &&
1307
- (value > -1 && value % 1 == 0 && value < length);
1308
- }
1309
-
1310
- /**
1311
- * Checks if the given arguments are from an iteratee call.
1312
- *
1313
- * @private
1314
- * @param {*} value The potential iteratee value argument.
1315
- * @param {*} index The potential iteratee index or key argument.
1316
- * @param {*} object The potential iteratee object argument.
1317
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
1318
- * else `false`.
1319
- */
1320
- function isIterateeCall(value, index, object) {
1321
- if (!isObject(object)) {
1322
- return false;
1323
- }
1324
- var type = typeof index;
1325
- if (type == 'number'
1326
- ? (isArrayLike(object) && isIndex(index, object.length))
1327
- : (type == 'string' && index in object)
1328
- ) {
1329
- return eq(object[index], value);
1330
- }
1331
- return false;
1332
- }
1333
-
1334
- /**
1335
- * Checks if `value` is suitable for use as unique object key.
1336
- *
1337
- * @private
1338
- * @param {*} value The value to check.
1339
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1340
- */
1341
- function isKeyable(value) {
1342
- var type = typeof value;
1343
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1344
- ? (value !== '__proto__')
1345
- : (value === null);
1346
- }
1347
-
1348
- /**
1349
- * Checks if `func` has its source masked.
1350
- *
1351
- * @private
1352
- * @param {Function} func The function to check.
1353
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1354
- */
1355
- function isMasked(func) {
1356
- return !!maskSrcKey && (maskSrcKey in func);
1357
- }
1358
-
1359
- /**
1360
- * Checks if `value` is likely a prototype object.
1361
- *
1362
- * @private
1363
- * @param {*} value The value to check.
1364
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1365
- */
1366
- function isPrototype(value) {
1367
- var Ctor = value && value.constructor,
1368
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1369
-
1370
- return value === proto;
1371
- }
1372
-
1373
- /**
1374
- * This function is like
1375
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1376
- * except that it includes inherited enumerable properties.
1377
- *
1378
- * @private
1379
- * @param {Object} object The object to query.
1380
- * @returns {Array} Returns the array of property names.
1381
- */
1382
- function nativeKeysIn(object) {
1383
- var result = [];
1384
- if (object != null) {
1385
- for (var key in Object(object)) {
1386
- result.push(key);
1387
- }
1388
- }
1389
- return result;
1390
- }
1391
-
1392
- /**
1393
- * Converts `value` to a string using `Object.prototype.toString`.
1394
- *
1395
- * @private
1396
- * @param {*} value The value to convert.
1397
- * @returns {string} Returns the converted string.
1398
- */
1399
- function objectToString(value) {
1400
- return nativeObjectToString.call(value);
1401
- }
1402
-
1403
- /**
1404
- * A specialized version of `baseRest` which transforms the rest array.
1405
- *
1406
- * @private
1407
- * @param {Function} func The function to apply a rest parameter to.
1408
- * @param {number} [start=func.length-1] The start position of the rest parameter.
1409
- * @param {Function} transform The rest array transform.
1410
- * @returns {Function} Returns the new function.
1411
- */
1412
- function overRest(func, start, transform) {
1413
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
1414
- return function() {
1415
- var args = arguments,
1416
- index = -1,
1417
- length = nativeMax(args.length - start, 0),
1418
- array = Array(length);
1419
-
1420
- while (++index < length) {
1421
- array[index] = args[start + index];
1422
- }
1423
- index = -1;
1424
- var otherArgs = Array(start + 1);
1425
- while (++index < start) {
1426
- otherArgs[index] = args[index];
1427
- }
1428
- otherArgs[start] = transform(array);
1429
- return apply(func, this, otherArgs);
1430
- };
1431
- }
1432
-
1433
- /**
1434
- * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
1435
- *
1436
- * @private
1437
- * @param {Object} object The object to query.
1438
- * @param {string} key The key of the property to get.
1439
- * @returns {*} Returns the property value.
1440
- */
1441
- function safeGet(object, key) {
1442
- if (key === 'constructor' && typeof object[key] === 'function') {
1443
- return;
1444
- }
1445
-
1446
- if (key == '__proto__') {
1447
- return;
1448
- }
1449
-
1450
- return object[key];
1451
- }
1452
-
1453
- /**
1454
- * Sets the `toString` method of `func` to return `string`.
1455
- *
1456
- * @private
1457
- * @param {Function} func The function to modify.
1458
- * @param {Function} string The `toString` result.
1459
- * @returns {Function} Returns `func`.
1460
- */
1461
- var setToString = shortOut(baseSetToString);
1462
-
1463
- /**
1464
- * Creates a function that'll short out and invoke `identity` instead
1465
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
1466
- * milliseconds.
1467
- *
1468
- * @private
1469
- * @param {Function} func The function to restrict.
1470
- * @returns {Function} Returns the new shortable function.
1471
- */
1472
- function shortOut(func) {
1473
- var count = 0,
1474
- lastCalled = 0;
1475
-
1476
- return function() {
1477
- var stamp = nativeNow(),
1478
- remaining = HOT_SPAN - (stamp - lastCalled);
1479
-
1480
- lastCalled = stamp;
1481
- if (remaining > 0) {
1482
- if (++count >= HOT_COUNT) {
1483
- return arguments[0];
1484
- }
1485
- } else {
1486
- count = 0;
1487
- }
1488
- return func.apply(undefined, arguments);
1489
- };
1490
- }
1491
-
1492
- /**
1493
- * Converts `func` to its source code.
1494
- *
1495
- * @private
1496
- * @param {Function} func The function to convert.
1497
- * @returns {string} Returns the source code.
1498
- */
1499
- function toSource(func) {
1500
- if (func != null) {
1501
- try {
1502
- return funcToString.call(func);
1503
- } catch (e) {}
1504
- try {
1505
- return (func + '');
1506
- } catch (e) {}
1507
- }
1508
- return '';
1509
- }
1510
-
1511
- /**
1512
- * Performs a
1513
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1514
- * comparison between two values to determine if they are equivalent.
1515
- *
1516
- * @static
1517
- * @memberOf _
1518
- * @since 4.0.0
1519
- * @category Lang
1520
- * @param {*} value The value to compare.
1521
- * @param {*} other The other value to compare.
1522
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1523
- * @example
1524
- *
1525
- * var object = { 'a': 1 };
1526
- * var other = { 'a': 1 };
1527
- *
1528
- * _.eq(object, object);
1529
- * // => true
1530
- *
1531
- * _.eq(object, other);
1532
- * // => false
1533
- *
1534
- * _.eq('a', 'a');
1535
- * // => true
1536
- *
1537
- * _.eq('a', Object('a'));
1538
- * // => false
1539
- *
1540
- * _.eq(NaN, NaN);
1541
- * // => true
1542
- */
1543
- function eq(value, other) {
1544
- return value === other || (value !== value && other !== other);
1545
- }
1546
-
1547
- /**
1548
- * Checks if `value` is likely an `arguments` object.
1549
- *
1550
- * @static
1551
- * @memberOf _
1552
- * @since 0.1.0
1553
- * @category Lang
1554
- * @param {*} value The value to check.
1555
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1556
- * else `false`.
1557
- * @example
1558
- *
1559
- * _.isArguments(function() { return arguments; }());
1560
- * // => true
1561
- *
1562
- * _.isArguments([1, 2, 3]);
1563
- * // => false
1564
- */
1565
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1566
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1567
- !propertyIsEnumerable.call(value, 'callee');
1568
- };
1569
-
1570
- /**
1571
- * Checks if `value` is classified as an `Array` object.
1572
- *
1573
- * @static
1574
- * @memberOf _
1575
- * @since 0.1.0
1576
- * @category Lang
1577
- * @param {*} value The value to check.
1578
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1579
- * @example
1580
- *
1581
- * _.isArray([1, 2, 3]);
1582
- * // => true
1583
- *
1584
- * _.isArray(document.body.children);
1585
- * // => false
1586
- *
1587
- * _.isArray('abc');
1588
- * // => false
1589
- *
1590
- * _.isArray(_.noop);
1591
- * // => false
1592
- */
1593
- var isArray = Array.isArray;
1594
-
1595
- /**
1596
- * Checks if `value` is array-like. A value is considered array-like if it's
1597
- * not a function and has a `value.length` that's an integer greater than or
1598
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1599
- *
1600
- * @static
1601
- * @memberOf _
1602
- * @since 4.0.0
1603
- * @category Lang
1604
- * @param {*} value The value to check.
1605
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1606
- * @example
1607
- *
1608
- * _.isArrayLike([1, 2, 3]);
1609
- * // => true
1610
- *
1611
- * _.isArrayLike(document.body.children);
1612
- * // => true
1613
- *
1614
- * _.isArrayLike('abc');
1615
- * // => true
1616
- *
1617
- * _.isArrayLike(_.noop);
1618
- * // => false
1619
- */
1620
- function isArrayLike(value) {
1621
- return value != null && isLength(value.length) && !isFunction(value);
1622
- }
1623
-
1624
- /**
1625
- * This method is like `_.isArrayLike` except that it also checks if `value`
1626
- * is an object.
1627
- *
1628
- * @static
1629
- * @memberOf _
1630
- * @since 4.0.0
1631
- * @category Lang
1632
- * @param {*} value The value to check.
1633
- * @returns {boolean} Returns `true` if `value` is an array-like object,
1634
- * else `false`.
1635
- * @example
1636
- *
1637
- * _.isArrayLikeObject([1, 2, 3]);
1638
- * // => true
1639
- *
1640
- * _.isArrayLikeObject(document.body.children);
1641
- * // => true
1642
- *
1643
- * _.isArrayLikeObject('abc');
1644
- * // => false
1645
- *
1646
- * _.isArrayLikeObject(_.noop);
1647
- * // => false
1648
- */
1649
- function isArrayLikeObject(value) {
1650
- return isObjectLike(value) && isArrayLike(value);
1651
- }
1652
-
1653
- /**
1654
- * Checks if `value` is a buffer.
1655
- *
1656
- * @static
1657
- * @memberOf _
1658
- * @since 4.3.0
1659
- * @category Lang
1660
- * @param {*} value The value to check.
1661
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1662
- * @example
1663
- *
1664
- * _.isBuffer(new Buffer(2));
1665
- * // => true
1666
- *
1667
- * _.isBuffer(new Uint8Array(2));
1668
- * // => false
1669
- */
1670
- var isBuffer = nativeIsBuffer || stubFalse;
1671
-
1672
- /**
1673
- * Checks if `value` is classified as a `Function` object.
1674
- *
1675
- * @static
1676
- * @memberOf _
1677
- * @since 0.1.0
1678
- * @category Lang
1679
- * @param {*} value The value to check.
1680
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1681
- * @example
1682
- *
1683
- * _.isFunction(_);
1684
- * // => true
1685
- *
1686
- * _.isFunction(/abc/);
1687
- * // => false
1688
- */
1689
- function isFunction(value) {
1690
- if (!isObject(value)) {
1691
- return false;
1692
- }
1693
- // The use of `Object#toString` avoids issues with the `typeof` operator
1694
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1695
- var tag = baseGetTag(value);
1696
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1697
- }
1698
-
1699
- /**
1700
- * Checks if `value` is a valid array-like length.
1701
- *
1702
- * **Note:** This method is loosely based on
1703
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1704
- *
1705
- * @static
1706
- * @memberOf _
1707
- * @since 4.0.0
1708
- * @category Lang
1709
- * @param {*} value The value to check.
1710
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1711
- * @example
1712
- *
1713
- * _.isLength(3);
1714
- * // => true
1715
- *
1716
- * _.isLength(Number.MIN_VALUE);
1717
- * // => false
1718
- *
1719
- * _.isLength(Infinity);
1720
- * // => false
1721
- *
1722
- * _.isLength('3');
1723
- * // => false
1724
- */
1725
- function isLength(value) {
1726
- return typeof value == 'number' &&
1727
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1728
- }
1729
-
1730
- /**
1731
- * Checks if `value` is the
1732
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1733
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1734
- *
1735
- * @static
1736
- * @memberOf _
1737
- * @since 0.1.0
1738
- * @category Lang
1739
- * @param {*} value The value to check.
1740
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1741
- * @example
1742
- *
1743
- * _.isObject({});
1744
- * // => true
1745
- *
1746
- * _.isObject([1, 2, 3]);
1747
- * // => true
1748
- *
1749
- * _.isObject(_.noop);
1750
- * // => true
1751
- *
1752
- * _.isObject(null);
1753
- * // => false
1754
- */
1755
- function isObject(value) {
1756
- var type = typeof value;
1757
- return value != null && (type == 'object' || type == 'function');
1758
- }
1759
-
1760
- /**
1761
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1762
- * and has a `typeof` result of "object".
1763
- *
1764
- * @static
1765
- * @memberOf _
1766
- * @since 4.0.0
1767
- * @category Lang
1768
- * @param {*} value The value to check.
1769
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1770
- * @example
1771
- *
1772
- * _.isObjectLike({});
1773
- * // => true
1774
- *
1775
- * _.isObjectLike([1, 2, 3]);
1776
- * // => true
1777
- *
1778
- * _.isObjectLike(_.noop);
1779
- * // => false
1780
- *
1781
- * _.isObjectLike(null);
1782
- * // => false
1783
- */
1784
- function isObjectLike(value) {
1785
- return value != null && typeof value == 'object';
1786
- }
1787
-
1788
- /**
1789
- * Checks if `value` is a plain object, that is, an object created by the
1790
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
1791
- *
1792
- * @static
1793
- * @memberOf _
1794
- * @since 0.8.0
1795
- * @category Lang
1796
- * @param {*} value The value to check.
1797
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
1798
- * @example
1799
- *
1800
- * function Foo() {
1801
- * this.a = 1;
1802
- * }
1803
- *
1804
- * _.isPlainObject(new Foo);
1805
- * // => false
1806
- *
1807
- * _.isPlainObject([1, 2, 3]);
1808
- * // => false
1809
- *
1810
- * _.isPlainObject({ 'x': 0, 'y': 0 });
1811
- * // => true
1812
- *
1813
- * _.isPlainObject(Object.create(null));
1814
- * // => true
1815
- */
1816
- function isPlainObject(value) {
1817
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
1818
- return false;
1819
- }
1820
- var proto = getPrototype(value);
1821
- if (proto === null) {
1822
- return true;
1823
- }
1824
- var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
1825
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
1826
- funcToString.call(Ctor) == objectCtorString;
1827
- }
1828
-
1829
- /**
1830
- * Checks if `value` is classified as a typed array.
1831
- *
1832
- * @static
1833
- * @memberOf _
1834
- * @since 3.0.0
1835
- * @category Lang
1836
- * @param {*} value The value to check.
1837
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1838
- * @example
1839
- *
1840
- * _.isTypedArray(new Uint8Array);
1841
- * // => true
1842
- *
1843
- * _.isTypedArray([]);
1844
- * // => false
1845
- */
1846
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1847
-
1848
- /**
1849
- * Converts `value` to a plain object flattening inherited enumerable string
1850
- * keyed properties of `value` to own properties of the plain object.
1851
- *
1852
- * @static
1853
- * @memberOf _
1854
- * @since 3.0.0
1855
- * @category Lang
1856
- * @param {*} value The value to convert.
1857
- * @returns {Object} Returns the converted plain object.
1858
- * @example
1859
- *
1860
- * function Foo() {
1861
- * this.b = 2;
1862
- * }
1863
- *
1864
- * Foo.prototype.c = 3;
1865
- *
1866
- * _.assign({ 'a': 1 }, new Foo);
1867
- * // => { 'a': 1, 'b': 2 }
1868
- *
1869
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
1870
- * // => { 'a': 1, 'b': 2, 'c': 3 }
1871
- */
1872
- function toPlainObject(value) {
1873
- return copyObject(value, keysIn(value));
1874
- }
1875
-
1876
- /**
1877
- * Creates an array of the own and inherited enumerable property names of `object`.
1878
- *
1879
- * **Note:** Non-object values are coerced to objects.
1880
- *
1881
- * @static
1882
- * @memberOf _
1883
- * @since 3.0.0
1884
- * @category Object
1885
- * @param {Object} object The object to query.
1886
- * @returns {Array} Returns the array of property names.
1887
- * @example
1888
- *
1889
- * function Foo() {
1890
- * this.a = 1;
1891
- * this.b = 2;
1892
- * }
1893
- *
1894
- * Foo.prototype.c = 3;
1895
- *
1896
- * _.keysIn(new Foo);
1897
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1898
- */
1899
- function keysIn(object) {
1900
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1901
- }
1902
-
1903
- /**
1904
- * This method is like `_.assign` except that it recursively merges own and
1905
- * inherited enumerable string keyed properties of source objects into the
1906
- * destination object. Source properties that resolve to `undefined` are
1907
- * skipped if a destination value exists. Array and plain object properties
1908
- * are merged recursively. Other objects and value types are overridden by
1909
- * assignment. Source objects are applied from left to right. Subsequent
1910
- * sources overwrite property assignments of previous sources.
1911
- *
1912
- * **Note:** This method mutates `object`.
1913
- *
1914
- * @static
1915
- * @memberOf _
1916
- * @since 0.5.0
1917
- * @category Object
1918
- * @param {Object} object The destination object.
1919
- * @param {...Object} [sources] The source objects.
1920
- * @returns {Object} Returns `object`.
1921
- * @example
1922
- *
1923
- * var object = {
1924
- * 'a': [{ 'b': 2 }, { 'd': 4 }]
1925
- * };
1926
- *
1927
- * var other = {
1928
- * 'a': [{ 'c': 3 }, { 'e': 5 }]
1929
- * };
1930
- *
1931
- * _.merge(object, other);
1932
- * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
1933
- */
1934
- var merge = createAssigner(function(object, source, srcIndex) {
1935
- baseMerge(object, source, srcIndex);
1936
- });
1937
-
1938
- /**
1939
- * Creates a function that returns `value`.
1940
- *
1941
- * @static
1942
- * @memberOf _
1943
- * @since 2.4.0
1944
- * @category Util
1945
- * @param {*} value The value to return from the new function.
1946
- * @returns {Function} Returns the new constant function.
1947
- * @example
1948
- *
1949
- * var objects = _.times(2, _.constant({ 'a': 1 }));
1950
- *
1951
- * console.log(objects);
1952
- * // => [{ 'a': 1 }, { 'a': 1 }]
1953
- *
1954
- * console.log(objects[0] === objects[1]);
1955
- * // => true
1956
- */
1957
- function constant(value) {
1958
- return function() {
1959
- return value;
1960
- };
1961
- }
1962
-
1963
- /**
1964
- * This method returns the first argument it receives.
1965
- *
1966
- * @static
1967
- * @since 0.1.0
1968
- * @memberOf _
1969
- * @category Util
1970
- * @param {*} value Any value.
1971
- * @returns {*} Returns `value`.
1972
- * @example
1973
- *
1974
- * var object = { 'a': 1 };
1975
- *
1976
- * console.log(_.identity(object) === object);
1977
- * // => true
1978
- */
1979
- function identity(value) {
1980
- return value;
1981
- }
1982
-
1983
- /**
1984
- * This method returns `false`.
1985
- *
1986
- * @static
1987
- * @memberOf _
1988
- * @since 4.13.0
1989
- * @category Util
1990
- * @returns {boolean} Returns `false`.
1991
- * @example
1992
- *
1993
- * _.times(2, _.stubFalse);
1994
- * // => [false, false]
1995
- */
1996
- function stubFalse() {
1997
- return false;
1998
- }
1999
-
2000
- module.exports = merge;
2001
- });
2002
-
2003
- /**
2004
- * lodash (Custom Build) <https://lodash.com/>
2005
- * Build: `lodash modularize exports="npm" -o ./`
2006
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
2007
- * Released under MIT license <https://lodash.com/license>
2008
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
2009
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2010
- */
2011
-
2012
- var lodash_clonedeep = createCommonjsModule(function (module, exports) {
2013
- /** Used as the size to enable large array optimizations. */
2014
- var LARGE_ARRAY_SIZE = 200;
2015
-
2016
- /** Used to stand-in for `undefined` hash values. */
2017
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
2018
-
2019
- /** Used as references for various `Number` constants. */
2020
- var MAX_SAFE_INTEGER = 9007199254740991;
2021
-
2022
- /** `Object#toString` result references. */
2023
- var argsTag = '[object Arguments]',
2024
- arrayTag = '[object Array]',
2025
- boolTag = '[object Boolean]',
2026
- dateTag = '[object Date]',
2027
- errorTag = '[object Error]',
2028
- funcTag = '[object Function]',
2029
- genTag = '[object GeneratorFunction]',
2030
- mapTag = '[object Map]',
2031
- numberTag = '[object Number]',
2032
- objectTag = '[object Object]',
2033
- promiseTag = '[object Promise]',
2034
- regexpTag = '[object RegExp]',
2035
- setTag = '[object Set]',
2036
- stringTag = '[object String]',
2037
- symbolTag = '[object Symbol]',
2038
- weakMapTag = '[object WeakMap]';
2039
-
2040
- var arrayBufferTag = '[object ArrayBuffer]',
2041
- dataViewTag = '[object DataView]',
2042
- float32Tag = '[object Float32Array]',
2043
- float64Tag = '[object Float64Array]',
2044
- int8Tag = '[object Int8Array]',
2045
- int16Tag = '[object Int16Array]',
2046
- int32Tag = '[object Int32Array]',
2047
- uint8Tag = '[object Uint8Array]',
2048
- uint8ClampedTag = '[object Uint8ClampedArray]',
2049
- uint16Tag = '[object Uint16Array]',
2050
- uint32Tag = '[object Uint32Array]';
2051
-
2052
- /**
2053
- * Used to match `RegExp`
2054
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
2055
- */
2056
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2057
-
2058
- /** Used to match `RegExp` flags from their coerced string values. */
2059
- var reFlags = /\w*$/;
2060
-
2061
- /** Used to detect host constructors (Safari). */
2062
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
2063
-
2064
- /** Used to detect unsigned integer values. */
2065
- var reIsUint = /^(?:0|[1-9]\d*)$/;
2066
-
2067
- /** Used to identify `toStringTag` values supported by `_.clone`. */
2068
- var cloneableTags = {};
2069
- cloneableTags[argsTag] = cloneableTags[arrayTag] =
2070
- cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
2071
- cloneableTags[boolTag] = cloneableTags[dateTag] =
2072
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
2073
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
2074
- cloneableTags[int32Tag] = cloneableTags[mapTag] =
2075
- cloneableTags[numberTag] = cloneableTags[objectTag] =
2076
- cloneableTags[regexpTag] = cloneableTags[setTag] =
2077
- cloneableTags[stringTag] = cloneableTags[symbolTag] =
2078
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
2079
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
2080
- cloneableTags[errorTag] = cloneableTags[funcTag] =
2081
- cloneableTags[weakMapTag] = false;
2082
-
2083
- /** Detect free variable `global` from Node.js. */
2084
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2085
-
2086
- /** Detect free variable `self`. */
2087
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
2088
-
2089
- /** Used as a reference to the global object. */
2090
- var root = freeGlobal || freeSelf || Function('return this')();
2091
-
2092
- /** Detect free variable `exports`. */
2093
- var freeExports = exports && !exports.nodeType && exports;
2094
-
2095
- /** Detect free variable `module`. */
2096
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2097
-
2098
- /** Detect the popular CommonJS extension `module.exports`. */
2099
- var moduleExports = freeModule && freeModule.exports === freeExports;
2100
-
2101
- /**
2102
- * Adds the key-value `pair` to `map`.
2103
- *
2104
- * @private
2105
- * @param {Object} map The map to modify.
2106
- * @param {Array} pair The key-value pair to add.
2107
- * @returns {Object} Returns `map`.
2108
- */
2109
- function addMapEntry(map, pair) {
2110
- // Don't return `map.set` because it's not chainable in IE 11.
2111
- map.set(pair[0], pair[1]);
2112
- return map;
2113
- }
2114
-
2115
- /**
2116
- * Adds `value` to `set`.
2117
- *
2118
- * @private
2119
- * @param {Object} set The set to modify.
2120
- * @param {*} value The value to add.
2121
- * @returns {Object} Returns `set`.
2122
- */
2123
- function addSetEntry(set, value) {
2124
- // Don't return `set.add` because it's not chainable in IE 11.
2125
- set.add(value);
2126
- return set;
2127
- }
2128
-
2129
- /**
2130
- * A specialized version of `_.forEach` for arrays without support for
2131
- * iteratee shorthands.
2132
- *
2133
- * @private
2134
- * @param {Array} [array] The array to iterate over.
2135
- * @param {Function} iteratee The function invoked per iteration.
2136
- * @returns {Array} Returns `array`.
2137
- */
2138
- function arrayEach(array, iteratee) {
2139
- var index = -1,
2140
- length = array ? array.length : 0;
2141
-
2142
- while (++index < length) {
2143
- if (iteratee(array[index], index, array) === false) {
2144
- break;
2145
- }
2146
- }
2147
- return array;
2148
- }
2149
-
2150
- /**
2151
- * Appends the elements of `values` to `array`.
2152
- *
2153
- * @private
2154
- * @param {Array} array The array to modify.
2155
- * @param {Array} values The values to append.
2156
- * @returns {Array} Returns `array`.
2157
- */
2158
- function arrayPush(array, values) {
2159
- var index = -1,
2160
- length = values.length,
2161
- offset = array.length;
2162
-
2163
- while (++index < length) {
2164
- array[offset + index] = values[index];
2165
- }
2166
- return array;
2167
- }
2168
-
2169
- /**
2170
- * A specialized version of `_.reduce` for arrays without support for
2171
- * iteratee shorthands.
2172
- *
2173
- * @private
2174
- * @param {Array} [array] The array to iterate over.
2175
- * @param {Function} iteratee The function invoked per iteration.
2176
- * @param {*} [accumulator] The initial value.
2177
- * @param {boolean} [initAccum] Specify using the first element of `array` as
2178
- * the initial value.
2179
- * @returns {*} Returns the accumulated value.
2180
- */
2181
- function arrayReduce(array, iteratee, accumulator, initAccum) {
2182
- var index = -1,
2183
- length = array ? array.length : 0;
2184
-
2185
- if (initAccum && length) {
2186
- accumulator = array[++index];
2187
- }
2188
- while (++index < length) {
2189
- accumulator = iteratee(accumulator, array[index], index, array);
2190
- }
2191
- return accumulator;
2192
- }
2193
-
2194
- /**
2195
- * The base implementation of `_.times` without support for iteratee shorthands
2196
- * or max array length checks.
2197
- *
2198
- * @private
2199
- * @param {number} n The number of times to invoke `iteratee`.
2200
- * @param {Function} iteratee The function invoked per iteration.
2201
- * @returns {Array} Returns the array of results.
2202
- */
2203
- function baseTimes(n, iteratee) {
2204
- var index = -1,
2205
- result = Array(n);
2206
-
2207
- while (++index < n) {
2208
- result[index] = iteratee(index);
2209
- }
2210
- return result;
2211
- }
2212
-
2213
- /**
2214
- * Gets the value at `key` of `object`.
2215
- *
2216
- * @private
2217
- * @param {Object} [object] The object to query.
2218
- * @param {string} key The key of the property to get.
2219
- * @returns {*} Returns the property value.
2220
- */
2221
- function getValue(object, key) {
2222
- return object == null ? undefined : object[key];
2223
- }
2224
-
2225
- /**
2226
- * Checks if `value` is a host object in IE < 9.
2227
- *
2228
- * @private
2229
- * @param {*} value The value to check.
2230
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
2231
- */
2232
- function isHostObject(value) {
2233
- // Many host objects are `Object` objects that can coerce to strings
2234
- // despite having improperly defined `toString` methods.
2235
- var result = false;
2236
- if (value != null && typeof value.toString != 'function') {
2237
- try {
2238
- result = !!(value + '');
2239
- } catch (e) {}
2240
- }
2241
- return result;
2242
- }
2243
-
2244
- /**
2245
- * Converts `map` to its key-value pairs.
2246
- *
2247
- * @private
2248
- * @param {Object} map The map to convert.
2249
- * @returns {Array} Returns the key-value pairs.
2250
- */
2251
- function mapToArray(map) {
2252
- var index = -1,
2253
- result = Array(map.size);
2254
-
2255
- map.forEach(function(value, key) {
2256
- result[++index] = [key, value];
2257
- });
2258
- return result;
2259
- }
2260
-
2261
- /**
2262
- * Creates a unary function that invokes `func` with its argument transformed.
2263
- *
2264
- * @private
2265
- * @param {Function} func The function to wrap.
2266
- * @param {Function} transform The argument transform.
2267
- * @returns {Function} Returns the new function.
2268
- */
2269
- function overArg(func, transform) {
2270
- return function(arg) {
2271
- return func(transform(arg));
2272
- };
2273
- }
2274
-
2275
- /**
2276
- * Converts `set` to an array of its values.
2277
- *
2278
- * @private
2279
- * @param {Object} set The set to convert.
2280
- * @returns {Array} Returns the values.
2281
- */
2282
- function setToArray(set) {
2283
- var index = -1,
2284
- result = Array(set.size);
2285
-
2286
- set.forEach(function(value) {
2287
- result[++index] = value;
2288
- });
2289
- return result;
2290
- }
2291
-
2292
- /** Used for built-in method references. */
2293
- var arrayProto = Array.prototype,
2294
- funcProto = Function.prototype,
2295
- objectProto = Object.prototype;
2296
-
2297
- /** Used to detect overreaching core-js shims. */
2298
- var coreJsData = root['__core-js_shared__'];
2299
-
2300
- /** Used to detect methods masquerading as native. */
2301
- var maskSrcKey = (function() {
2302
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
2303
- return uid ? ('Symbol(src)_1.' + uid) : '';
2304
- }());
2305
-
2306
- /** Used to resolve the decompiled source of functions. */
2307
- var funcToString = funcProto.toString;
2308
-
2309
- /** Used to check objects for own properties. */
2310
- var hasOwnProperty = objectProto.hasOwnProperty;
2311
-
2312
- /**
2313
- * Used to resolve the
2314
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2315
- * of values.
2316
- */
2317
- var objectToString = objectProto.toString;
2318
-
2319
- /** Used to detect if a method is native. */
2320
- var reIsNative = RegExp('^' +
2321
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
2322
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
2323
- );
2324
-
2325
- /** Built-in value references. */
2326
- var Buffer = moduleExports ? root.Buffer : undefined,
2327
- Symbol = root.Symbol,
2328
- Uint8Array = root.Uint8Array,
2329
- getPrototype = overArg(Object.getPrototypeOf, Object),
2330
- objectCreate = Object.create,
2331
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
2332
- splice = arrayProto.splice;
2333
-
2334
- /* Built-in method references for those with the same name as other `lodash` methods. */
2335
- var nativeGetSymbols = Object.getOwnPropertySymbols,
2336
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
2337
- nativeKeys = overArg(Object.keys, Object);
2338
-
2339
- /* Built-in method references that are verified to be native. */
2340
- var DataView = getNative(root, 'DataView'),
2341
- Map = getNative(root, 'Map'),
2342
- Promise = getNative(root, 'Promise'),
2343
- Set = getNative(root, 'Set'),
2344
- WeakMap = getNative(root, 'WeakMap'),
2345
- nativeCreate = getNative(Object, 'create');
2346
-
2347
- /** Used to detect maps, sets, and weakmaps. */
2348
- var dataViewCtorString = toSource(DataView),
2349
- mapCtorString = toSource(Map),
2350
- promiseCtorString = toSource(Promise),
2351
- setCtorString = toSource(Set),
2352
- weakMapCtorString = toSource(WeakMap);
2353
-
2354
- /** Used to convert symbols to primitives and strings. */
2355
- var symbolProto = Symbol ? Symbol.prototype : undefined,
2356
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2357
-
2358
- /**
2359
- * Creates a hash object.
2360
- *
2361
- * @private
2362
- * @constructor
2363
- * @param {Array} [entries] The key-value pairs to cache.
2364
- */
2365
- function Hash(entries) {
2366
- var index = -1,
2367
- length = entries ? entries.length : 0;
2368
-
2369
- this.clear();
2370
- while (++index < length) {
2371
- var entry = entries[index];
2372
- this.set(entry[0], entry[1]);
2373
- }
2374
- }
2375
-
2376
- /**
2377
- * Removes all key-value entries from the hash.
2378
- *
2379
- * @private
2380
- * @name clear
2381
- * @memberOf Hash
2382
- */
2383
- function hashClear() {
2384
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
2385
- }
2386
-
2387
- /**
2388
- * Removes `key` and its value from the hash.
2389
- *
2390
- * @private
2391
- * @name delete
2392
- * @memberOf Hash
2393
- * @param {Object} hash The hash to modify.
2394
- * @param {string} key The key of the value to remove.
2395
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2396
- */
2397
- function hashDelete(key) {
2398
- return this.has(key) && delete this.__data__[key];
2399
- }
2400
-
2401
- /**
2402
- * Gets the hash value for `key`.
2403
- *
2404
- * @private
2405
- * @name get
2406
- * @memberOf Hash
2407
- * @param {string} key The key of the value to get.
2408
- * @returns {*} Returns the entry value.
2409
- */
2410
- function hashGet(key) {
2411
- var data = this.__data__;
2412
- if (nativeCreate) {
2413
- var result = data[key];
2414
- return result === HASH_UNDEFINED ? undefined : result;
2415
- }
2416
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
2417
- }
2418
-
2419
- /**
2420
- * Checks if a hash value for `key` exists.
2421
- *
2422
- * @private
2423
- * @name has
2424
- * @memberOf Hash
2425
- * @param {string} key The key of the entry to check.
2426
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2427
- */
2428
- function hashHas(key) {
2429
- var data = this.__data__;
2430
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
2431
- }
2432
-
2433
- /**
2434
- * Sets the hash `key` to `value`.
2435
- *
2436
- * @private
2437
- * @name set
2438
- * @memberOf Hash
2439
- * @param {string} key The key of the value to set.
2440
- * @param {*} value The value to set.
2441
- * @returns {Object} Returns the hash instance.
2442
- */
2443
- function hashSet(key, value) {
2444
- var data = this.__data__;
2445
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
2446
- return this;
2447
- }
2448
-
2449
- // Add methods to `Hash`.
2450
- Hash.prototype.clear = hashClear;
2451
- Hash.prototype['delete'] = hashDelete;
2452
- Hash.prototype.get = hashGet;
2453
- Hash.prototype.has = hashHas;
2454
- Hash.prototype.set = hashSet;
2455
-
2456
- /**
2457
- * Creates an list cache object.
2458
- *
2459
- * @private
2460
- * @constructor
2461
- * @param {Array} [entries] The key-value pairs to cache.
2462
- */
2463
- function ListCache(entries) {
2464
- var index = -1,
2465
- length = entries ? entries.length : 0;
2466
-
2467
- this.clear();
2468
- while (++index < length) {
2469
- var entry = entries[index];
2470
- this.set(entry[0], entry[1]);
2471
- }
2472
- }
2473
-
2474
- /**
2475
- * Removes all key-value entries from the list cache.
2476
- *
2477
- * @private
2478
- * @name clear
2479
- * @memberOf ListCache
2480
- */
2481
- function listCacheClear() {
2482
- this.__data__ = [];
2483
- }
2484
-
2485
- /**
2486
- * Removes `key` and its value from the list cache.
2487
- *
2488
- * @private
2489
- * @name delete
2490
- * @memberOf ListCache
2491
- * @param {string} key The key of the value to remove.
2492
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2493
- */
2494
- function listCacheDelete(key) {
2495
- var data = this.__data__,
2496
- index = assocIndexOf(data, key);
2497
-
2498
- if (index < 0) {
2499
- return false;
2500
- }
2501
- var lastIndex = data.length - 1;
2502
- if (index == lastIndex) {
2503
- data.pop();
2504
- } else {
2505
- splice.call(data, index, 1);
2506
- }
2507
- return true;
2508
- }
2509
-
2510
- /**
2511
- * Gets the list cache value for `key`.
2512
- *
2513
- * @private
2514
- * @name get
2515
- * @memberOf ListCache
2516
- * @param {string} key The key of the value to get.
2517
- * @returns {*} Returns the entry value.
2518
- */
2519
- function listCacheGet(key) {
2520
- var data = this.__data__,
2521
- index = assocIndexOf(data, key);
2522
-
2523
- return index < 0 ? undefined : data[index][1];
2524
- }
2525
-
2526
- /**
2527
- * Checks if a list cache value for `key` exists.
2528
- *
2529
- * @private
2530
- * @name has
2531
- * @memberOf ListCache
2532
- * @param {string} key The key of the entry to check.
2533
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2534
- */
2535
- function listCacheHas(key) {
2536
- return assocIndexOf(this.__data__, key) > -1;
2537
- }
2538
-
2539
- /**
2540
- * Sets the list cache `key` to `value`.
2541
- *
2542
- * @private
2543
- * @name set
2544
- * @memberOf ListCache
2545
- * @param {string} key The key of the value to set.
2546
- * @param {*} value The value to set.
2547
- * @returns {Object} Returns the list cache instance.
2548
- */
2549
- function listCacheSet(key, value) {
2550
- var data = this.__data__,
2551
- index = assocIndexOf(data, key);
2552
-
2553
- if (index < 0) {
2554
- data.push([key, value]);
2555
- } else {
2556
- data[index][1] = value;
2557
- }
2558
- return this;
2559
- }
2560
-
2561
- // Add methods to `ListCache`.
2562
- ListCache.prototype.clear = listCacheClear;
2563
- ListCache.prototype['delete'] = listCacheDelete;
2564
- ListCache.prototype.get = listCacheGet;
2565
- ListCache.prototype.has = listCacheHas;
2566
- ListCache.prototype.set = listCacheSet;
2567
-
2568
- /**
2569
- * Creates a map cache object to store key-value pairs.
2570
- *
2571
- * @private
2572
- * @constructor
2573
- * @param {Array} [entries] The key-value pairs to cache.
2574
- */
2575
- function MapCache(entries) {
2576
- var index = -1,
2577
- length = entries ? entries.length : 0;
2578
-
2579
- this.clear();
2580
- while (++index < length) {
2581
- var entry = entries[index];
2582
- this.set(entry[0], entry[1]);
2583
- }
2584
- }
2585
-
2586
- /**
2587
- * Removes all key-value entries from the map.
2588
- *
2589
- * @private
2590
- * @name clear
2591
- * @memberOf MapCache
2592
- */
2593
- function mapCacheClear() {
2594
- this.__data__ = {
2595
- 'hash': new Hash,
2596
- 'map': new (Map || ListCache),
2597
- 'string': new Hash
2598
- };
2599
- }
2600
-
2601
- /**
2602
- * Removes `key` and its value from the map.
2603
- *
2604
- * @private
2605
- * @name delete
2606
- * @memberOf MapCache
2607
- * @param {string} key The key of the value to remove.
2608
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2609
- */
2610
- function mapCacheDelete(key) {
2611
- return getMapData(this, key)['delete'](key);
2612
- }
2613
-
2614
- /**
2615
- * Gets the map value for `key`.
2616
- *
2617
- * @private
2618
- * @name get
2619
- * @memberOf MapCache
2620
- * @param {string} key The key of the value to get.
2621
- * @returns {*} Returns the entry value.
2622
- */
2623
- function mapCacheGet(key) {
2624
- return getMapData(this, key).get(key);
2625
- }
2626
-
2627
- /**
2628
- * Checks if a map value for `key` exists.
2629
- *
2630
- * @private
2631
- * @name has
2632
- * @memberOf MapCache
2633
- * @param {string} key The key of the entry to check.
2634
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2635
- */
2636
- function mapCacheHas(key) {
2637
- return getMapData(this, key).has(key);
2638
- }
2639
-
2640
- /**
2641
- * Sets the map `key` to `value`.
2642
- *
2643
- * @private
2644
- * @name set
2645
- * @memberOf MapCache
2646
- * @param {string} key The key of the value to set.
2647
- * @param {*} value The value to set.
2648
- * @returns {Object} Returns the map cache instance.
2649
- */
2650
- function mapCacheSet(key, value) {
2651
- getMapData(this, key).set(key, value);
2652
- return this;
2653
- }
2654
-
2655
- // Add methods to `MapCache`.
2656
- MapCache.prototype.clear = mapCacheClear;
2657
- MapCache.prototype['delete'] = mapCacheDelete;
2658
- MapCache.prototype.get = mapCacheGet;
2659
- MapCache.prototype.has = mapCacheHas;
2660
- MapCache.prototype.set = mapCacheSet;
2661
-
2662
- /**
2663
- * Creates a stack cache object to store key-value pairs.
2664
- *
2665
- * @private
2666
- * @constructor
2667
- * @param {Array} [entries] The key-value pairs to cache.
2668
- */
2669
- function Stack(entries) {
2670
- this.__data__ = new ListCache(entries);
2671
- }
2672
-
2673
- /**
2674
- * Removes all key-value entries from the stack.
2675
- *
2676
- * @private
2677
- * @name clear
2678
- * @memberOf Stack
2679
- */
2680
- function stackClear() {
2681
- this.__data__ = new ListCache;
2682
- }
2683
-
2684
- /**
2685
- * Removes `key` and its value from the stack.
2686
- *
2687
- * @private
2688
- * @name delete
2689
- * @memberOf Stack
2690
- * @param {string} key The key of the value to remove.
2691
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2692
- */
2693
- function stackDelete(key) {
2694
- return this.__data__['delete'](key);
2695
- }
2696
-
2697
- /**
2698
- * Gets the stack value for `key`.
2699
- *
2700
- * @private
2701
- * @name get
2702
- * @memberOf Stack
2703
- * @param {string} key The key of the value to get.
2704
- * @returns {*} Returns the entry value.
2705
- */
2706
- function stackGet(key) {
2707
- return this.__data__.get(key);
2708
- }
2709
-
2710
- /**
2711
- * Checks if a stack value for `key` exists.
2712
- *
2713
- * @private
2714
- * @name has
2715
- * @memberOf Stack
2716
- * @param {string} key The key of the entry to check.
2717
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2718
- */
2719
- function stackHas(key) {
2720
- return this.__data__.has(key);
2721
- }
2722
-
2723
- /**
2724
- * Sets the stack `key` to `value`.
2725
- *
2726
- * @private
2727
- * @name set
2728
- * @memberOf Stack
2729
- * @param {string} key The key of the value to set.
2730
- * @param {*} value The value to set.
2731
- * @returns {Object} Returns the stack cache instance.
2732
- */
2733
- function stackSet(key, value) {
2734
- var cache = this.__data__;
2735
- if (cache instanceof ListCache) {
2736
- var pairs = cache.__data__;
2737
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2738
- pairs.push([key, value]);
2739
- return this;
2740
- }
2741
- cache = this.__data__ = new MapCache(pairs);
2742
- }
2743
- cache.set(key, value);
2744
- return this;
2745
- }
2746
-
2747
- // Add methods to `Stack`.
2748
- Stack.prototype.clear = stackClear;
2749
- Stack.prototype['delete'] = stackDelete;
2750
- Stack.prototype.get = stackGet;
2751
- Stack.prototype.has = stackHas;
2752
- Stack.prototype.set = stackSet;
2753
-
2754
- /**
2755
- * Creates an array of the enumerable property names of the array-like `value`.
2756
- *
2757
- * @private
2758
- * @param {*} value The value to query.
2759
- * @param {boolean} inherited Specify returning inherited property names.
2760
- * @returns {Array} Returns the array of property names.
2761
- */
2762
- function arrayLikeKeys(value, inherited) {
2763
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
2764
- // Safari 9 makes `arguments.length` enumerable in strict mode.
2765
- var result = (isArray(value) || isArguments(value))
2766
- ? baseTimes(value.length, String)
2767
- : [];
2768
-
2769
- var length = result.length,
2770
- skipIndexes = !!length;
2771
-
2772
- for (var key in value) {
2773
- if ((inherited || hasOwnProperty.call(value, key)) &&
2774
- !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
2775
- result.push(key);
2776
- }
2777
- }
2778
- return result;
2779
- }
2780
-
2781
- /**
2782
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
2783
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2784
- * for equality comparisons.
2785
- *
2786
- * @private
2787
- * @param {Object} object The object to modify.
2788
- * @param {string} key The key of the property to assign.
2789
- * @param {*} value The value to assign.
2790
- */
2791
- function assignValue(object, key, value) {
2792
- var objValue = object[key];
2793
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
2794
- (value === undefined && !(key in object))) {
2795
- object[key] = value;
2796
- }
2797
- }
2798
-
2799
- /**
2800
- * Gets the index at which the `key` is found in `array` of key-value pairs.
2801
- *
2802
- * @private
2803
- * @param {Array} array The array to inspect.
2804
- * @param {*} key The key to search for.
2805
- * @returns {number} Returns the index of the matched value, else `-1`.
2806
- */
2807
- function assocIndexOf(array, key) {
2808
- var length = array.length;
2809
- while (length--) {
2810
- if (eq(array[length][0], key)) {
2811
- return length;
2812
- }
2813
- }
2814
- return -1;
2815
- }
2816
-
2817
- /**
2818
- * The base implementation of `_.assign` without support for multiple sources
2819
- * or `customizer` functions.
2820
- *
2821
- * @private
2822
- * @param {Object} object The destination object.
2823
- * @param {Object} source The source object.
2824
- * @returns {Object} Returns `object`.
2825
- */
2826
- function baseAssign(object, source) {
2827
- return object && copyObject(source, keys(source), object);
2828
- }
2829
-
2830
- /**
2831
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
2832
- * traversed objects.
2833
- *
2834
- * @private
2835
- * @param {*} value The value to clone.
2836
- * @param {boolean} [isDeep] Specify a deep clone.
2837
- * @param {boolean} [isFull] Specify a clone including symbols.
2838
- * @param {Function} [customizer] The function to customize cloning.
2839
- * @param {string} [key] The key of `value`.
2840
- * @param {Object} [object] The parent object of `value`.
2841
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
2842
- * @returns {*} Returns the cloned value.
2843
- */
2844
- function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
2845
- var result;
2846
- if (customizer) {
2847
- result = object ? customizer(value, key, object, stack) : customizer(value);
2848
- }
2849
- if (result !== undefined) {
2850
- return result;
2851
- }
2852
- if (!isObject(value)) {
2853
- return value;
2854
- }
2855
- var isArr = isArray(value);
2856
- if (isArr) {
2857
- result = initCloneArray(value);
2858
- if (!isDeep) {
2859
- return copyArray(value, result);
2860
- }
2861
- } else {
2862
- var tag = getTag(value),
2863
- isFunc = tag == funcTag || tag == genTag;
2864
-
2865
- if (isBuffer(value)) {
2866
- return cloneBuffer(value, isDeep);
2867
- }
2868
- if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
2869
- if (isHostObject(value)) {
2870
- return object ? value : {};
2871
- }
2872
- result = initCloneObject(isFunc ? {} : value);
2873
- if (!isDeep) {
2874
- return copySymbols(value, baseAssign(result, value));
2875
- }
2876
- } else {
2877
- if (!cloneableTags[tag]) {
2878
- return object ? value : {};
2879
- }
2880
- result = initCloneByTag(value, tag, baseClone, isDeep);
2881
- }
2882
- }
2883
- // Check for circular references and return its corresponding clone.
2884
- stack || (stack = new Stack);
2885
- var stacked = stack.get(value);
2886
- if (stacked) {
2887
- return stacked;
2888
- }
2889
- stack.set(value, result);
2890
-
2891
- if (!isArr) {
2892
- var props = isFull ? getAllKeys(value) : keys(value);
2893
- }
2894
- arrayEach(props || value, function(subValue, key) {
2895
- if (props) {
2896
- key = subValue;
2897
- subValue = value[key];
2898
- }
2899
- // Recursively populate clone (susceptible to call stack limits).
2900
- assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
2901
- });
2902
- return result;
2903
- }
2904
-
2905
- /**
2906
- * The base implementation of `_.create` without support for assigning
2907
- * properties to the created object.
2908
- *
2909
- * @private
2910
- * @param {Object} prototype The object to inherit from.
2911
- * @returns {Object} Returns the new object.
2912
- */
2913
- function baseCreate(proto) {
2914
- return isObject(proto) ? objectCreate(proto) : {};
2915
- }
2916
-
2917
- /**
2918
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2919
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2920
- * symbols of `object`.
2921
- *
2922
- * @private
2923
- * @param {Object} object The object to query.
2924
- * @param {Function} keysFunc The function to get the keys of `object`.
2925
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
2926
- * @returns {Array} Returns the array of property names and symbols.
2927
- */
2928
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
2929
- var result = keysFunc(object);
2930
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
2931
- }
2932
-
2933
- /**
2934
- * The base implementation of `getTag`.
2935
- *
2936
- * @private
2937
- * @param {*} value The value to query.
2938
- * @returns {string} Returns the `toStringTag`.
2939
- */
2940
- function baseGetTag(value) {
2941
- return objectToString.call(value);
2942
- }
2943
-
2944
- /**
2945
- * The base implementation of `_.isNative` without bad shim checks.
2946
- *
2947
- * @private
2948
- * @param {*} value The value to check.
2949
- * @returns {boolean} Returns `true` if `value` is a native function,
2950
- * else `false`.
2951
- */
2952
- function baseIsNative(value) {
2953
- if (!isObject(value) || isMasked(value)) {
2954
- return false;
2955
- }
2956
- var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
2957
- return pattern.test(toSource(value));
2958
- }
2959
-
2960
- /**
2961
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2962
- *
2963
- * @private
2964
- * @param {Object} object The object to query.
2965
- * @returns {Array} Returns the array of property names.
2966
- */
2967
- function baseKeys(object) {
2968
- if (!isPrototype(object)) {
2969
- return nativeKeys(object);
2970
- }
2971
- var result = [];
2972
- for (var key in Object(object)) {
2973
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
2974
- result.push(key);
2975
- }
2976
- }
2977
- return result;
2978
- }
2979
-
2980
- /**
2981
- * Creates a clone of `buffer`.
2982
- *
2983
- * @private
2984
- * @param {Buffer} buffer The buffer to clone.
2985
- * @param {boolean} [isDeep] Specify a deep clone.
2986
- * @returns {Buffer} Returns the cloned buffer.
2987
- */
2988
- function cloneBuffer(buffer, isDeep) {
2989
- if (isDeep) {
2990
- return buffer.slice();
2991
- }
2992
- var result = new buffer.constructor(buffer.length);
2993
- buffer.copy(result);
2994
- return result;
2995
- }
2996
-
2997
- /**
2998
- * Creates a clone of `arrayBuffer`.
2999
- *
3000
- * @private
3001
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
3002
- * @returns {ArrayBuffer} Returns the cloned array buffer.
3003
- */
3004
- function cloneArrayBuffer(arrayBuffer) {
3005
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3006
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
3007
- return result;
3008
- }
3009
-
3010
- /**
3011
- * Creates a clone of `dataView`.
3012
- *
3013
- * @private
3014
- * @param {Object} dataView The data view to clone.
3015
- * @param {boolean} [isDeep] Specify a deep clone.
3016
- * @returns {Object} Returns the cloned data view.
3017
- */
3018
- function cloneDataView(dataView, isDeep) {
3019
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
3020
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
3021
- }
3022
-
3023
- /**
3024
- * Creates a clone of `map`.
3025
- *
3026
- * @private
3027
- * @param {Object} map The map to clone.
3028
- * @param {Function} cloneFunc The function to clone values.
3029
- * @param {boolean} [isDeep] Specify a deep clone.
3030
- * @returns {Object} Returns the cloned map.
3031
- */
3032
- function cloneMap(map, isDeep, cloneFunc) {
3033
- var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
3034
- return arrayReduce(array, addMapEntry, new map.constructor);
3035
- }
3036
-
3037
- /**
3038
- * Creates a clone of `regexp`.
3039
- *
3040
- * @private
3041
- * @param {Object} regexp The regexp to clone.
3042
- * @returns {Object} Returns the cloned regexp.
3043
- */
3044
- function cloneRegExp(regexp) {
3045
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
3046
- result.lastIndex = regexp.lastIndex;
3047
- return result;
3048
- }
3049
-
3050
- /**
3051
- * Creates a clone of `set`.
3052
- *
3053
- * @private
3054
- * @param {Object} set The set to clone.
3055
- * @param {Function} cloneFunc The function to clone values.
3056
- * @param {boolean} [isDeep] Specify a deep clone.
3057
- * @returns {Object} Returns the cloned set.
3058
- */
3059
- function cloneSet(set, isDeep, cloneFunc) {
3060
- var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
3061
- return arrayReduce(array, addSetEntry, new set.constructor);
3062
- }
3063
-
3064
- /**
3065
- * Creates a clone of the `symbol` object.
3066
- *
3067
- * @private
3068
- * @param {Object} symbol The symbol object to clone.
3069
- * @returns {Object} Returns the cloned symbol object.
3070
- */
3071
- function cloneSymbol(symbol) {
3072
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
3073
- }
3074
-
3075
- /**
3076
- * Creates a clone of `typedArray`.
3077
- *
3078
- * @private
3079
- * @param {Object} typedArray The typed array to clone.
3080
- * @param {boolean} [isDeep] Specify a deep clone.
3081
- * @returns {Object} Returns the cloned typed array.
3082
- */
3083
- function cloneTypedArray(typedArray, isDeep) {
3084
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3085
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3086
- }
3087
-
3088
- /**
3089
- * Copies the values of `source` to `array`.
3090
- *
3091
- * @private
3092
- * @param {Array} source The array to copy values from.
3093
- * @param {Array} [array=[]] The array to copy values to.
3094
- * @returns {Array} Returns `array`.
3095
- */
3096
- function copyArray(source, array) {
3097
- var index = -1,
3098
- length = source.length;
3099
-
3100
- array || (array = Array(length));
3101
- while (++index < length) {
3102
- array[index] = source[index];
3103
- }
3104
- return array;
3105
- }
3106
-
3107
- /**
3108
- * Copies properties of `source` to `object`.
3109
- *
3110
- * @private
3111
- * @param {Object} source The object to copy properties from.
3112
- * @param {Array} props The property identifiers to copy.
3113
- * @param {Object} [object={}] The object to copy properties to.
3114
- * @param {Function} [customizer] The function to customize copied values.
3115
- * @returns {Object} Returns `object`.
3116
- */
3117
- function copyObject(source, props, object, customizer) {
3118
- object || (object = {});
3119
-
3120
- var index = -1,
3121
- length = props.length;
3122
-
3123
- while (++index < length) {
3124
- var key = props[index];
3125
-
3126
- var newValue = customizer
3127
- ? customizer(object[key], source[key], key, object, source)
3128
- : undefined;
3129
-
3130
- assignValue(object, key, newValue === undefined ? source[key] : newValue);
3131
- }
3132
- return object;
3133
- }
3134
-
3135
- /**
3136
- * Copies own symbol properties of `source` to `object`.
3137
- *
3138
- * @private
3139
- * @param {Object} source The object to copy symbols from.
3140
- * @param {Object} [object={}] The object to copy symbols to.
3141
- * @returns {Object} Returns `object`.
3142
- */
3143
- function copySymbols(source, object) {
3144
- return copyObject(source, getSymbols(source), object);
3145
- }
3146
-
3147
- /**
3148
- * Creates an array of own enumerable property names and symbols of `object`.
3149
- *
3150
- * @private
3151
- * @param {Object} object The object to query.
3152
- * @returns {Array} Returns the array of property names and symbols.
3153
- */
3154
- function getAllKeys(object) {
3155
- return baseGetAllKeys(object, keys, getSymbols);
3156
- }
3157
-
3158
- /**
3159
- * Gets the data for `map`.
3160
- *
3161
- * @private
3162
- * @param {Object} map The map to query.
3163
- * @param {string} key The reference key.
3164
- * @returns {*} Returns the map data.
3165
- */
3166
- function getMapData(map, key) {
3167
- var data = map.__data__;
3168
- return isKeyable(key)
3169
- ? data[typeof key == 'string' ? 'string' : 'hash']
3170
- : data.map;
3171
- }
3172
-
3173
- /**
3174
- * Gets the native function at `key` of `object`.
3175
- *
3176
- * @private
3177
- * @param {Object} object The object to query.
3178
- * @param {string} key The key of the method to get.
3179
- * @returns {*} Returns the function if it's native, else `undefined`.
3180
- */
3181
- function getNative(object, key) {
3182
- var value = getValue(object, key);
3183
- return baseIsNative(value) ? value : undefined;
3184
- }
3185
-
3186
- /**
3187
- * Creates an array of the own enumerable symbol properties of `object`.
3188
- *
3189
- * @private
3190
- * @param {Object} object The object to query.
3191
- * @returns {Array} Returns the array of symbols.
3192
- */
3193
- var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
3194
-
3195
- /**
3196
- * Gets the `toStringTag` of `value`.
3197
- *
3198
- * @private
3199
- * @param {*} value The value to query.
3200
- * @returns {string} Returns the `toStringTag`.
3201
- */
3202
- var getTag = baseGetTag;
3203
-
3204
- // Fallback for data views, maps, sets, and weak maps in IE 11,
3205
- // for data views in Edge < 14, and promises in Node.js.
3206
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
3207
- (Map && getTag(new Map) != mapTag) ||
3208
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
3209
- (Set && getTag(new Set) != setTag) ||
3210
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
3211
- getTag = function(value) {
3212
- var result = objectToString.call(value),
3213
- Ctor = result == objectTag ? value.constructor : undefined,
3214
- ctorString = Ctor ? toSource(Ctor) : undefined;
3215
-
3216
- if (ctorString) {
3217
- switch (ctorString) {
3218
- case dataViewCtorString: return dataViewTag;
3219
- case mapCtorString: return mapTag;
3220
- case promiseCtorString: return promiseTag;
3221
- case setCtorString: return setTag;
3222
- case weakMapCtorString: return weakMapTag;
3223
- }
3224
- }
3225
- return result;
3226
- };
3227
- }
3228
-
3229
- /**
3230
- * Initializes an array clone.
3231
- *
3232
- * @private
3233
- * @param {Array} array The array to clone.
3234
- * @returns {Array} Returns the initialized clone.
3235
- */
3236
- function initCloneArray(array) {
3237
- var length = array.length,
3238
- result = array.constructor(length);
3239
-
3240
- // Add properties assigned by `RegExp#exec`.
3241
- if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
3242
- result.index = array.index;
3243
- result.input = array.input;
3244
- }
3245
- return result;
3246
- }
3247
-
3248
- /**
3249
- * Initializes an object clone.
3250
- *
3251
- * @private
3252
- * @param {Object} object The object to clone.
3253
- * @returns {Object} Returns the initialized clone.
3254
- */
3255
- function initCloneObject(object) {
3256
- return (typeof object.constructor == 'function' && !isPrototype(object))
3257
- ? baseCreate(getPrototype(object))
3258
- : {};
3259
- }
3260
-
3261
- /**
3262
- * Initializes an object clone based on its `toStringTag`.
3263
- *
3264
- * **Note:** This function only supports cloning values with tags of
3265
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
3266
- *
3267
- * @private
3268
- * @param {Object} object The object to clone.
3269
- * @param {string} tag The `toStringTag` of the object to clone.
3270
- * @param {Function} cloneFunc The function to clone values.
3271
- * @param {boolean} [isDeep] Specify a deep clone.
3272
- * @returns {Object} Returns the initialized clone.
3273
- */
3274
- function initCloneByTag(object, tag, cloneFunc, isDeep) {
3275
- var Ctor = object.constructor;
3276
- switch (tag) {
3277
- case arrayBufferTag:
3278
- return cloneArrayBuffer(object);
3279
-
3280
- case boolTag:
3281
- case dateTag:
3282
- return new Ctor(+object);
3283
-
3284
- case dataViewTag:
3285
- return cloneDataView(object, isDeep);
3286
-
3287
- case float32Tag: case float64Tag:
3288
- case int8Tag: case int16Tag: case int32Tag:
3289
- case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
3290
- return cloneTypedArray(object, isDeep);
3291
-
3292
- case mapTag:
3293
- return cloneMap(object, isDeep, cloneFunc);
3294
-
3295
- case numberTag:
3296
- case stringTag:
3297
- return new Ctor(object);
3298
-
3299
- case regexpTag:
3300
- return cloneRegExp(object);
3301
-
3302
- case setTag:
3303
- return cloneSet(object, isDeep, cloneFunc);
3304
-
3305
- case symbolTag:
3306
- return cloneSymbol(object);
3307
- }
3308
- }
3309
-
3310
- /**
3311
- * Checks if `value` is a valid array-like index.
3312
- *
3313
- * @private
3314
- * @param {*} value The value to check.
3315
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
3316
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
3317
- */
3318
- function isIndex(value, length) {
3319
- length = length == null ? MAX_SAFE_INTEGER : length;
3320
- return !!length &&
3321
- (typeof value == 'number' || reIsUint.test(value)) &&
3322
- (value > -1 && value % 1 == 0 && value < length);
3323
- }
3324
-
3325
- /**
3326
- * Checks if `value` is suitable for use as unique object key.
3327
- *
3328
- * @private
3329
- * @param {*} value The value to check.
3330
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
3331
- */
3332
- function isKeyable(value) {
3333
- var type = typeof value;
3334
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
3335
- ? (value !== '__proto__')
3336
- : (value === null);
3337
- }
3338
-
3339
- /**
3340
- * Checks if `func` has its source masked.
3341
- *
3342
- * @private
3343
- * @param {Function} func The function to check.
3344
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
3345
- */
3346
- function isMasked(func) {
3347
- return !!maskSrcKey && (maskSrcKey in func);
3348
- }
3349
-
3350
- /**
3351
- * Checks if `value` is likely a prototype object.
3352
- *
3353
- * @private
3354
- * @param {*} value The value to check.
3355
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
3356
- */
3357
- function isPrototype(value) {
3358
- var Ctor = value && value.constructor,
3359
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
3360
-
3361
- return value === proto;
3362
- }
3363
-
3364
- /**
3365
- * Converts `func` to its source code.
3366
- *
3367
- * @private
3368
- * @param {Function} func The function to process.
3369
- * @returns {string} Returns the source code.
3370
- */
3371
- function toSource(func) {
3372
- if (func != null) {
3373
- try {
3374
- return funcToString.call(func);
3375
- } catch (e) {}
3376
- try {
3377
- return (func + '');
3378
- } catch (e) {}
3379
- }
3380
- return '';
3381
- }
3382
-
3383
- /**
3384
- * This method is like `_.clone` except that it recursively clones `value`.
3385
- *
3386
- * @static
3387
- * @memberOf _
3388
- * @since 1.0.0
3389
- * @category Lang
3390
- * @param {*} value The value to recursively clone.
3391
- * @returns {*} Returns the deep cloned value.
3392
- * @see _.clone
3393
- * @example
3394
- *
3395
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
3396
- *
3397
- * var deep = _.cloneDeep(objects);
3398
- * console.log(deep[0] === objects[0]);
3399
- * // => false
3400
- */
3401
- function cloneDeep(value) {
3402
- return baseClone(value, true, true);
3403
- }
3404
-
3405
- /**
3406
- * Performs a
3407
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3408
- * comparison between two values to determine if they are equivalent.
3409
- *
3410
- * @static
3411
- * @memberOf _
3412
- * @since 4.0.0
3413
- * @category Lang
3414
- * @param {*} value The value to compare.
3415
- * @param {*} other The other value to compare.
3416
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3417
- * @example
3418
- *
3419
- * var object = { 'a': 1 };
3420
- * var other = { 'a': 1 };
3421
- *
3422
- * _.eq(object, object);
3423
- * // => true
3424
- *
3425
- * _.eq(object, other);
3426
- * // => false
3427
- *
3428
- * _.eq('a', 'a');
3429
- * // => true
3430
- *
3431
- * _.eq('a', Object('a'));
3432
- * // => false
3433
- *
3434
- * _.eq(NaN, NaN);
3435
- * // => true
3436
- */
3437
- function eq(value, other) {
3438
- return value === other || (value !== value && other !== other);
3439
- }
3440
-
3441
- /**
3442
- * Checks if `value` is likely an `arguments` object.
3443
- *
3444
- * @static
3445
- * @memberOf _
3446
- * @since 0.1.0
3447
- * @category Lang
3448
- * @param {*} value The value to check.
3449
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3450
- * else `false`.
3451
- * @example
3452
- *
3453
- * _.isArguments(function() { return arguments; }());
3454
- * // => true
3455
- *
3456
- * _.isArguments([1, 2, 3]);
3457
- * // => false
3458
- */
3459
- function isArguments(value) {
3460
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
3461
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
3462
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
3463
- }
3464
-
3465
- /**
3466
- * Checks if `value` is classified as an `Array` object.
3467
- *
3468
- * @static
3469
- * @memberOf _
3470
- * @since 0.1.0
3471
- * @category Lang
3472
- * @param {*} value The value to check.
3473
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
3474
- * @example
3475
- *
3476
- * _.isArray([1, 2, 3]);
3477
- * // => true
3478
- *
3479
- * _.isArray(document.body.children);
3480
- * // => false
3481
- *
3482
- * _.isArray('abc');
3483
- * // => false
3484
- *
3485
- * _.isArray(_.noop);
3486
- * // => false
3487
- */
3488
- var isArray = Array.isArray;
3489
-
3490
- /**
3491
- * Checks if `value` is array-like. A value is considered array-like if it's
3492
- * not a function and has a `value.length` that's an integer greater than or
3493
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
3494
- *
3495
- * @static
3496
- * @memberOf _
3497
- * @since 4.0.0
3498
- * @category Lang
3499
- * @param {*} value The value to check.
3500
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
3501
- * @example
3502
- *
3503
- * _.isArrayLike([1, 2, 3]);
3504
- * // => true
3505
- *
3506
- * _.isArrayLike(document.body.children);
3507
- * // => true
3508
- *
3509
- * _.isArrayLike('abc');
3510
- * // => true
3511
- *
3512
- * _.isArrayLike(_.noop);
3513
- * // => false
3514
- */
3515
- function isArrayLike(value) {
3516
- return value != null && isLength(value.length) && !isFunction(value);
3517
- }
3518
-
3519
- /**
3520
- * This method is like `_.isArrayLike` except that it also checks if `value`
3521
- * is an object.
3522
- *
3523
- * @static
3524
- * @memberOf _
3525
- * @since 4.0.0
3526
- * @category Lang
3527
- * @param {*} value The value to check.
3528
- * @returns {boolean} Returns `true` if `value` is an array-like object,
3529
- * else `false`.
3530
- * @example
3531
- *
3532
- * _.isArrayLikeObject([1, 2, 3]);
3533
- * // => true
3534
- *
3535
- * _.isArrayLikeObject(document.body.children);
3536
- * // => true
3537
- *
3538
- * _.isArrayLikeObject('abc');
3539
- * // => false
3540
- *
3541
- * _.isArrayLikeObject(_.noop);
3542
- * // => false
3543
- */
3544
- function isArrayLikeObject(value) {
3545
- return isObjectLike(value) && isArrayLike(value);
3546
- }
3547
-
3548
- /**
3549
- * Checks if `value` is a buffer.
3550
- *
3551
- * @static
3552
- * @memberOf _
3553
- * @since 4.3.0
3554
- * @category Lang
3555
- * @param {*} value The value to check.
3556
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
3557
- * @example
3558
- *
3559
- * _.isBuffer(new Buffer(2));
3560
- * // => true
3561
- *
3562
- * _.isBuffer(new Uint8Array(2));
3563
- * // => false
3564
- */
3565
- var isBuffer = nativeIsBuffer || stubFalse;
3566
-
3567
- /**
3568
- * Checks if `value` is classified as a `Function` object.
3569
- *
3570
- * @static
3571
- * @memberOf _
3572
- * @since 0.1.0
3573
- * @category Lang
3574
- * @param {*} value The value to check.
3575
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
3576
- * @example
3577
- *
3578
- * _.isFunction(_);
3579
- * // => true
3580
- *
3581
- * _.isFunction(/abc/);
3582
- * // => false
3583
- */
3584
- function isFunction(value) {
3585
- // The use of `Object#toString` avoids issues with the `typeof` operator
3586
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
3587
- var tag = isObject(value) ? objectToString.call(value) : '';
3588
- return tag == funcTag || tag == genTag;
3589
- }
3590
-
3591
- /**
3592
- * Checks if `value` is a valid array-like length.
3593
- *
3594
- * **Note:** This method is loosely based on
3595
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
3596
- *
3597
- * @static
3598
- * @memberOf _
3599
- * @since 4.0.0
3600
- * @category Lang
3601
- * @param {*} value The value to check.
3602
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
3603
- * @example
3604
- *
3605
- * _.isLength(3);
3606
- * // => true
3607
- *
3608
- * _.isLength(Number.MIN_VALUE);
3609
- * // => false
3610
- *
3611
- * _.isLength(Infinity);
3612
- * // => false
3613
- *
3614
- * _.isLength('3');
3615
- * // => false
3616
- */
3617
- function isLength(value) {
3618
- return typeof value == 'number' &&
3619
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3620
- }
3621
-
3622
- /**
3623
- * Checks if `value` is the
3624
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3625
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3626
- *
3627
- * @static
3628
- * @memberOf _
3629
- * @since 0.1.0
3630
- * @category Lang
3631
- * @param {*} value The value to check.
3632
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3633
- * @example
3634
- *
3635
- * _.isObject({});
3636
- * // => true
3637
- *
3638
- * _.isObject([1, 2, 3]);
3639
- * // => true
3640
- *
3641
- * _.isObject(_.noop);
3642
- * // => true
3643
- *
3644
- * _.isObject(null);
3645
- * // => false
3646
- */
3647
- function isObject(value) {
3648
- var type = typeof value;
3649
- return !!value && (type == 'object' || type == 'function');
3650
- }
3651
-
3652
- /**
3653
- * Checks if `value` is object-like. A value is object-like if it's not `null`
3654
- * and has a `typeof` result of "object".
3655
- *
3656
- * @static
3657
- * @memberOf _
3658
- * @since 4.0.0
3659
- * @category Lang
3660
- * @param {*} value The value to check.
3661
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3662
- * @example
3663
- *
3664
- * _.isObjectLike({});
3665
- * // => true
3666
- *
3667
- * _.isObjectLike([1, 2, 3]);
3668
- * // => true
3669
- *
3670
- * _.isObjectLike(_.noop);
3671
- * // => false
3672
- *
3673
- * _.isObjectLike(null);
3674
- * // => false
3675
- */
3676
- function isObjectLike(value) {
3677
- return !!value && typeof value == 'object';
3678
- }
3679
-
3680
- /**
3681
- * Creates an array of the own enumerable property names of `object`.
3682
- *
3683
- * **Note:** Non-object values are coerced to objects. See the
3684
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
3685
- * for more details.
3686
- *
3687
- * @static
3688
- * @since 0.1.0
3689
- * @memberOf _
3690
- * @category Object
3691
- * @param {Object} object The object to query.
3692
- * @returns {Array} Returns the array of property names.
3693
- * @example
3694
- *
3695
- * function Foo() {
3696
- * this.a = 1;
3697
- * this.b = 2;
3698
- * }
3699
- *
3700
- * Foo.prototype.c = 3;
3701
- *
3702
- * _.keys(new Foo);
3703
- * // => ['a', 'b'] (iteration order is not guaranteed)
3704
- *
3705
- * _.keys('hi');
3706
- * // => ['0', '1']
3707
- */
3708
- function keys(object) {
3709
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
3710
- }
3711
-
3712
- /**
3713
- * This method returns a new empty array.
3714
- *
3715
- * @static
3716
- * @memberOf _
3717
- * @since 4.13.0
3718
- * @category Util
3719
- * @returns {Array} Returns the new empty array.
3720
- * @example
3721
- *
3722
- * var arrays = _.times(2, _.stubArray);
3723
- *
3724
- * console.log(arrays);
3725
- * // => [[], []]
3726
- *
3727
- * console.log(arrays[0] === arrays[1]);
3728
- * // => false
3729
- */
3730
- function stubArray() {
3731
- return [];
3732
- }
3733
-
3734
- /**
3735
- * This method returns `false`.
3736
- *
3737
- * @static
3738
- * @memberOf _
3739
- * @since 4.13.0
3740
- * @category Util
3741
- * @returns {boolean} Returns `false`.
3742
- * @example
3743
- *
3744
- * _.times(2, _.stubFalse);
3745
- * // => [false, false]
3746
- */
3747
- function stubFalse() {
3748
- return false;
3749
- }
3750
-
3751
- module.exports = cloneDeep;
3752
- });
3753
-
3754
- /**
3755
- * lodash (Custom Build) <https://lodash.com/>
3756
- * Build: `lodash modularize exports="npm" -o ./`
3757
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
3758
- * Released under MIT license <https://lodash.com/license>
3759
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3760
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3761
- */
3762
- /** `Object#toString` result references. */
3763
- var objectTag = '[object Object]';
3764
-
3765
- /**
3766
- * Checks if `value` is a host object in IE < 9.
3767
- *
3768
- * @private
3769
- * @param {*} value The value to check.
3770
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
3771
- */
3772
- function isHostObject(value) {
3773
- // Many host objects are `Object` objects that can coerce to strings
3774
- // despite having improperly defined `toString` methods.
3775
- var result = false;
3776
- if (value != null && typeof value.toString != 'function') {
3777
- try {
3778
- result = !!(value + '');
3779
- } catch (e) {}
3780
- }
3781
- return result;
3782
- }
3783
-
3784
- /**
3785
- * Creates a unary function that invokes `func` with its argument transformed.
3786
- *
3787
- * @private
3788
- * @param {Function} func The function to wrap.
3789
- * @param {Function} transform The argument transform.
3790
- * @returns {Function} Returns the new function.
3791
- */
3792
- function overArg(func, transform) {
3793
- return function(arg) {
3794
- return func(transform(arg));
3795
- };
3796
- }
3797
-
3798
- /** Used for built-in method references. */
3799
- var funcProto = Function.prototype,
3800
- objectProto = Object.prototype;
3801
-
3802
- /** Used to resolve the decompiled source of functions. */
3803
- var funcToString = funcProto.toString;
3804
-
3805
- /** Used to check objects for own properties. */
3806
- var hasOwnProperty = objectProto.hasOwnProperty;
3807
-
3808
- /** Used to infer the `Object` constructor. */
3809
- var objectCtorString = funcToString.call(Object);
3810
-
3811
- /**
3812
- * Used to resolve the
3813
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3814
- * of values.
3815
- */
3816
- var objectToString = objectProto.toString;
3817
-
3818
- /** Built-in value references. */
3819
- var getPrototype = overArg(Object.getPrototypeOf, Object);
3820
-
3821
- /**
3822
- * Checks if `value` is object-like. A value is object-like if it's not `null`
3823
- * and has a `typeof` result of "object".
3824
- *
3825
- * @static
3826
- * @memberOf _
3827
- * @since 4.0.0
3828
- * @category Lang
3829
- * @param {*} value The value to check.
3830
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3831
- * @example
3832
- *
3833
- * _.isObjectLike({});
3834
- * // => true
3835
- *
3836
- * _.isObjectLike([1, 2, 3]);
3837
- * // => true
3838
- *
3839
- * _.isObjectLike(_.noop);
3840
- * // => false
3841
- *
3842
- * _.isObjectLike(null);
3843
- * // => false
3844
- */
3845
- function isObjectLike(value) {
3846
- return !!value && typeof value == 'object';
3847
- }
3848
-
3849
- /**
3850
- * Checks if `value` is a plain object, that is, an object created by the
3851
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
3852
- *
3853
- * @static
3854
- * @memberOf _
3855
- * @since 0.8.0
3856
- * @category Lang
3857
- * @param {*} value The value to check.
3858
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
3859
- * @example
3860
- *
3861
- * function Foo() {
3862
- * this.a = 1;
3863
- * }
3864
- *
3865
- * _.isPlainObject(new Foo);
3866
- * // => false
3867
- *
3868
- * _.isPlainObject([1, 2, 3]);
3869
- * // => false
3870
- *
3871
- * _.isPlainObject({ 'x': 0, 'y': 0 });
3872
- * // => true
3873
- *
3874
- * _.isPlainObject(Object.create(null));
3875
- * // => true
3876
- */
3877
- function isPlainObject(value) {
3878
- if (!isObjectLike(value) ||
3879
- objectToString.call(value) != objectTag || isHostObject(value)) {
3880
- return false;
3881
- }
3882
- var proto = getPrototype(value);
3883
- if (proto === null) {
3884
- return true;
3885
- }
3886
- var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
3887
- return (typeof Ctor == 'function' &&
3888
- Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
3889
- }
3890
-
3891
- var lodash_isplainobject = isPlainObject;
3892
-
3893
- var version$1 = "5.0.16";
3894
-
3895
- const version = version$1;
3896
- function flattenAllArrays(originalIncommingObj, originalOpts) {
3897
- //
3898
- // internal functions
3899
- // ==================
3900
- function arrayContainsStr(arr) {
3901
- return arr.some((val) => typeof val === "string");
3902
- }
3903
- // setup
3904
- // =====
3905
- const defaults = {
3906
- flattenArraysContainingStringsToBeEmpty: false,
3907
- };
3908
- const opts = { ...defaults, ...originalOpts };
3909
- const incommingObj = lodash_clonedeep(originalIncommingObj);
3910
- let isFirstObj;
3911
- let combinedObj;
3912
- let firstObjIndex;
3913
- // action
3914
- // ======
3915
- // 1. check current
3916
- if (Array.isArray(incommingObj)) {
3917
- if (opts.flattenArraysContainingStringsToBeEmpty &&
3918
- arrayContainsStr(incommingObj)) {
3919
- return [];
3920
- }
3921
- isFirstObj = null;
3922
- combinedObj = {};
3923
- firstObjIndex = 0;
3924
- for (let i = 0, len = incommingObj.length; i < len; i++) {
3925
- if (lodash_isplainobject(incommingObj[i])) {
3926
- combinedObj = lodash_merge(combinedObj, incommingObj[i]);
3927
- if (isFirstObj === null) {
3928
- isFirstObj = true;
3929
- firstObjIndex = i;
3930
- }
3931
- else {
3932
- incommingObj.splice(i, 1);
3933
- i -= 1;
3934
- }
3935
- }
3936
- }
3937
- if (isFirstObj !== null) {
3938
- incommingObj[firstObjIndex] = lodash_clonedeep(combinedObj);
3939
- }
3940
- }
3941
- // 2. traverse deeper
3942
- if (lodash_isplainobject(incommingObj)) {
3943
- Object.keys(incommingObj).forEach((key) => {
3944
- if (lodash_isplainobject(incommingObj[key]) || Array.isArray(incommingObj[key])) {
3945
- incommingObj[key] = flattenAllArrays(incommingObj[key], opts);
3946
- }
3947
- });
3948
- }
3949
- else if (Array.isArray(incommingObj)) {
3950
- incommingObj.forEach((_el, i) => {
3951
- if (lodash_isplainobject(incommingObj[i]) || Array.isArray(incommingObj[i])) {
3952
- incommingObj[i] = flattenAllArrays(incommingObj[i], opts);
3953
- }
3954
- });
3955
- }
3956
- return incommingObj;
3957
- }
3958
-
3959
- exports.flattenAllArrays = flattenAllArrays;
3960
- exports.version = version;
3961
-
3962
- Object.defineProperty(exports, '__esModule', { value: true });
3963
-
3964
- })));