gant-core 2.0.8 → 2.0.9

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cli/create/module/index.mjs +1 -1
  3. package/lib/core/store/index.js +1 -1
  4. package/package.json +1 -1
  5. package/lib/cli/config/defineConfig.js +0 -104
  6. package/lib/cli/config/index.js +0 -156
  7. package/lib/cli/copyfiles/index.js +0 -34
  8. package/lib/cli/create/config/index.js +0 -1233
  9. package/lib/cli/create/index.js +0 -5
  10. package/lib/cli/create/module/index.js +0 -33215
  11. package/lib/cli/helper/index.d.ts +0 -17
  12. package/lib/cli/i18n/index.js +0 -22186
  13. package/lib/cli/i18n/utils.js +0 -181
  14. package/lib/cli/index.js +0 -3656
  15. package/lib/cli/ms/index.js +0 -23
  16. package/lib/cli/routes/index.js +0 -76
  17. package/lib/cli/template/core.txt +0 -1
  18. package/lib/cli/tsconfig/index.js +0 -71
  19. package/lib/cli/utils/detectPort.js +0 -121
  20. package/lib/cli/utils/getJavascriptfile.js +0 -15
  21. package/lib/cli/utils/index.d.ts +0 -18
  22. package/lib/cli/utils/index.js +0 -4949
  23. package/lib/cli/webpack/Webpack.js +0 -61
  24. package/lib/cli/webpack/config/analyzer.config.js +0 -18
  25. package/lib/cli/webpack/config/browsers.js +0 -14
  26. package/lib/cli/webpack/config/cssRules.js +0 -81
  27. package/lib/cli/webpack/config/default.config.js +0 -180
  28. package/lib/cli/webpack/config/development.config.js +0 -46
  29. package/lib/cli/webpack/config/framework/index.js +0 -26
  30. package/lib/cli/webpack/config/framework/react.js +0 -24
  31. package/lib/cli/webpack/config/framework/vue.js +0 -34
  32. package/lib/cli/webpack/config/index.js +0 -24
  33. package/lib/cli/webpack/config/production.config.js +0 -75
  34. package/lib/cli/webpack/plugins/copy.js +0 -21
  35. package/lib/cli/webpack/plugins/index.js +0 -5
  36. package/lib/core/event/index.js +0 -2
  37. package/lib/core/microservices/index.js +0 -11
  38. package/lib/core/utils/index.js +0 -84
  39. package/lib/helper/acorn-BmLbFX50.js +0 -19
  40. package/lib/helper/angular-DGof4p_D.js +0 -7
  41. package/lib/helper/babel-Nwboghbx.js +0 -22
  42. package/lib/helper/estree-CSMrPe9Y.js +0 -44
  43. package/lib/helper/flow-h7wrzCJb.js +0 -27
  44. package/lib/helper/glimmer-Bew2Vz0Y.js +0 -38
  45. package/lib/helper/graphql-BRv4I30B.js +0 -38
  46. package/lib/helper/html-uZad-YZz.js +0 -28
  47. package/lib/helper/index.js +0 -27848
  48. package/lib/helper/markdown-iwdpU9Ia.js +0 -68
  49. package/lib/helper/meriyah-UktrHj4H.js +0 -11
  50. package/lib/helper/postcss-H_0MYJut.js +0 -58
  51. package/lib/helper/typescript-CqdW0_wW.js +0 -31
  52. package/lib/helper/yaml-DXNEs-hZ.js +0 -170
@@ -1,4949 +0,0 @@
1
- 'use strict';
2
-
3
- var node_url = require('node:url');
4
- var fs = require('fs');
5
- var path = require('path');
6
- var prettier = require('prettier');
7
- require('./getJavascriptfile.js');
8
- require('net');
9
-
10
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
11
- /** Detect free variable `global` from Node.js. */
12
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
13
-
14
- /** Detect free variable `self`. */
15
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
16
-
17
- /** Used as a reference to the global object. */
18
- var root = freeGlobal || freeSelf || Function('return this')();
19
-
20
- /** Built-in value references. */
21
- var Symbol = root.Symbol;
22
-
23
- /** Used for built-in method references. */
24
- var objectProto$i = Object.prototype;
25
-
26
- /** Used to check objects for own properties. */
27
- var hasOwnProperty$f = objectProto$i.hasOwnProperty;
28
-
29
- /**
30
- * Used to resolve the
31
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
32
- * of values.
33
- */
34
- var nativeObjectToString$1 = objectProto$i.toString;
35
-
36
- /** Built-in value references. */
37
- var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
38
-
39
- /**
40
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
41
- *
42
- * @private
43
- * @param {*} value The value to query.
44
- * @returns {string} Returns the raw `toStringTag`.
45
- */
46
- function getRawTag(value) {
47
- var isOwn = hasOwnProperty$f.call(value, symToStringTag$1),
48
- tag = value[symToStringTag$1];
49
-
50
- try {
51
- value[symToStringTag$1] = undefined;
52
- var unmasked = true;
53
- } catch (e) {}
54
-
55
- var result = nativeObjectToString$1.call(value);
56
- if (unmasked) {
57
- if (isOwn) {
58
- value[symToStringTag$1] = tag;
59
- } else {
60
- delete value[symToStringTag$1];
61
- }
62
- }
63
- return result;
64
- }
65
-
66
- /** Used for built-in method references. */
67
- var objectProto$h = Object.prototype;
68
-
69
- /**
70
- * Used to resolve the
71
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
72
- * of values.
73
- */
74
- var nativeObjectToString = objectProto$h.toString;
75
-
76
- /**
77
- * Converts `value` to a string using `Object.prototype.toString`.
78
- *
79
- * @private
80
- * @param {*} value The value to convert.
81
- * @returns {string} Returns the converted string.
82
- */
83
- function objectToString(value) {
84
- return nativeObjectToString.call(value);
85
- }
86
-
87
- /** `Object#toString` result references. */
88
- var nullTag = '[object Null]',
89
- undefinedTag = '[object Undefined]';
90
-
91
- /** Built-in value references. */
92
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
93
-
94
- /**
95
- * The base implementation of `getTag` without fallbacks for buggy environments.
96
- *
97
- * @private
98
- * @param {*} value The value to query.
99
- * @returns {string} Returns the `toStringTag`.
100
- */
101
- function baseGetTag(value) {
102
- if (value == null) {
103
- return value === undefined ? undefinedTag : nullTag;
104
- }
105
- return (symToStringTag && symToStringTag in Object(value))
106
- ? getRawTag(value)
107
- : objectToString(value);
108
- }
109
-
110
- /**
111
- * Checks if `value` is object-like. A value is object-like if it's not `null`
112
- * and has a `typeof` result of "object".
113
- *
114
- * @static
115
- * @memberOf _
116
- * @since 4.0.0
117
- * @category Lang
118
- * @param {*} value The value to check.
119
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
120
- * @example
121
- *
122
- * _.isObjectLike({});
123
- * // => true
124
- *
125
- * _.isObjectLike([1, 2, 3]);
126
- * // => true
127
- *
128
- * _.isObjectLike(_.noop);
129
- * // => false
130
- *
131
- * _.isObjectLike(null);
132
- * // => false
133
- */
134
- function isObjectLike(value) {
135
- return value != null && typeof value == 'object';
136
- }
137
-
138
- /** `Object#toString` result references. */
139
- var symbolTag$3 = '[object Symbol]';
140
-
141
- /**
142
- * Checks if `value` is classified as a `Symbol` primitive or object.
143
- *
144
- * @static
145
- * @memberOf _
146
- * @since 4.0.0
147
- * @category Lang
148
- * @param {*} value The value to check.
149
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
150
- * @example
151
- *
152
- * _.isSymbol(Symbol.iterator);
153
- * // => true
154
- *
155
- * _.isSymbol('abc');
156
- * // => false
157
- */
158
- function isSymbol(value) {
159
- return typeof value == 'symbol' ||
160
- (isObjectLike(value) && baseGetTag(value) == symbolTag$3);
161
- }
162
-
163
- /**
164
- * A specialized version of `_.map` for arrays without support for iteratee
165
- * shorthands.
166
- *
167
- * @private
168
- * @param {Array} [array] The array to iterate over.
169
- * @param {Function} iteratee The function invoked per iteration.
170
- * @returns {Array} Returns the new mapped array.
171
- */
172
- function arrayMap(array, iteratee) {
173
- var index = -1,
174
- length = array == null ? 0 : array.length,
175
- result = Array(length);
176
-
177
- while (++index < length) {
178
- result[index] = iteratee(array[index], index, array);
179
- }
180
- return result;
181
- }
182
-
183
- /**
184
- * Checks if `value` is classified as an `Array` object.
185
- *
186
- * @static
187
- * @memberOf _
188
- * @since 0.1.0
189
- * @category Lang
190
- * @param {*} value The value to check.
191
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
192
- * @example
193
- *
194
- * _.isArray([1, 2, 3]);
195
- * // => true
196
- *
197
- * _.isArray(document.body.children);
198
- * // => false
199
- *
200
- * _.isArray('abc');
201
- * // => false
202
- *
203
- * _.isArray(_.noop);
204
- * // => false
205
- */
206
- var isArray = Array.isArray;
207
-
208
- /** Used to convert symbols to primitives and strings. */
209
- var symbolProto$2 = Symbol ? Symbol.prototype : undefined,
210
- symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
211
-
212
- /**
213
- * The base implementation of `_.toString` which doesn't convert nullish
214
- * values to empty strings.
215
- *
216
- * @private
217
- * @param {*} value The value to process.
218
- * @returns {string} Returns the string.
219
- */
220
- function baseToString(value) {
221
- // Exit early for strings to avoid a performance hit in some environments.
222
- if (typeof value == 'string') {
223
- return value;
224
- }
225
- if (isArray(value)) {
226
- // Recursively convert values (susceptible to call stack limits).
227
- return arrayMap(value, baseToString) + '';
228
- }
229
- if (isSymbol(value)) {
230
- return symbolToString ? symbolToString.call(value) : '';
231
- }
232
- var result = (value + '');
233
- return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
234
- }
235
-
236
- /**
237
- * Checks if `value` is the
238
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
239
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
240
- *
241
- * @static
242
- * @memberOf _
243
- * @since 0.1.0
244
- * @category Lang
245
- * @param {*} value The value to check.
246
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
247
- * @example
248
- *
249
- * _.isObject({});
250
- * // => true
251
- *
252
- * _.isObject([1, 2, 3]);
253
- * // => true
254
- *
255
- * _.isObject(_.noop);
256
- * // => true
257
- *
258
- * _.isObject(null);
259
- * // => false
260
- */
261
- function isObject(value) {
262
- var type = typeof value;
263
- return value != null && (type == 'object' || type == 'function');
264
- }
265
-
266
- /**
267
- * This method returns the first argument it receives.
268
- *
269
- * @static
270
- * @since 0.1.0
271
- * @memberOf _
272
- * @category Util
273
- * @param {*} value Any value.
274
- * @returns {*} Returns `value`.
275
- * @example
276
- *
277
- * var object = { 'a': 1 };
278
- *
279
- * console.log(_.identity(object) === object);
280
- * // => true
281
- */
282
- function identity(value) {
283
- return value;
284
- }
285
-
286
- /** `Object#toString` result references. */
287
- var asyncTag = '[object AsyncFunction]',
288
- funcTag$2 = '[object Function]',
289
- genTag$1 = '[object GeneratorFunction]',
290
- proxyTag = '[object Proxy]';
291
-
292
- /**
293
- * Checks if `value` is classified as a `Function` object.
294
- *
295
- * @static
296
- * @memberOf _
297
- * @since 0.1.0
298
- * @category Lang
299
- * @param {*} value The value to check.
300
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
301
- * @example
302
- *
303
- * _.isFunction(_);
304
- * // => true
305
- *
306
- * _.isFunction(/abc/);
307
- * // => false
308
- */
309
- function isFunction(value) {
310
- if (!isObject(value)) {
311
- return false;
312
- }
313
- // The use of `Object#toString` avoids issues with the `typeof` operator
314
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
315
- var tag = baseGetTag(value);
316
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
317
- }
318
-
319
- /** Used to detect overreaching core-js shims. */
320
- var coreJsData = root['__core-js_shared__'];
321
-
322
- /** Used to detect methods masquerading as native. */
323
- var maskSrcKey = (function() {
324
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
325
- return uid ? ('Symbol(src)_1.' + uid) : '';
326
- }());
327
-
328
- /**
329
- * Checks if `func` has its source masked.
330
- *
331
- * @private
332
- * @param {Function} func The function to check.
333
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
334
- */
335
- function isMasked(func) {
336
- return !!maskSrcKey && (maskSrcKey in func);
337
- }
338
-
339
- /** Used for built-in method references. */
340
- var funcProto$2 = Function.prototype;
341
-
342
- /** Used to resolve the decompiled source of functions. */
343
- var funcToString$2 = funcProto$2.toString;
344
-
345
- /**
346
- * Converts `func` to its source code.
347
- *
348
- * @private
349
- * @param {Function} func The function to convert.
350
- * @returns {string} Returns the source code.
351
- */
352
- function toSource(func) {
353
- if (func != null) {
354
- try {
355
- return funcToString$2.call(func);
356
- } catch (e) {}
357
- try {
358
- return (func + '');
359
- } catch (e) {}
360
- }
361
- return '';
362
- }
363
-
364
- /**
365
- * Used to match `RegExp`
366
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
367
- */
368
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
369
-
370
- /** Used to detect host constructors (Safari). */
371
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
372
-
373
- /** Used for built-in method references. */
374
- var funcProto$1 = Function.prototype,
375
- objectProto$g = Object.prototype;
376
-
377
- /** Used to resolve the decompiled source of functions. */
378
- var funcToString$1 = funcProto$1.toString;
379
-
380
- /** Used to check objects for own properties. */
381
- var hasOwnProperty$e = objectProto$g.hasOwnProperty;
382
-
383
- /** Used to detect if a method is native. */
384
- var reIsNative = RegExp('^' +
385
- funcToString$1.call(hasOwnProperty$e).replace(reRegExpChar, '\\$&')
386
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
387
- );
388
-
389
- /**
390
- * The base implementation of `_.isNative` without bad shim checks.
391
- *
392
- * @private
393
- * @param {*} value The value to check.
394
- * @returns {boolean} Returns `true` if `value` is a native function,
395
- * else `false`.
396
- */
397
- function baseIsNative(value) {
398
- if (!isObject(value) || isMasked(value)) {
399
- return false;
400
- }
401
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
402
- return pattern.test(toSource(value));
403
- }
404
-
405
- /**
406
- * Gets the value at `key` of `object`.
407
- *
408
- * @private
409
- * @param {Object} [object] The object to query.
410
- * @param {string} key The key of the property to get.
411
- * @returns {*} Returns the property value.
412
- */
413
- function getValue(object, key) {
414
- return object == null ? undefined : object[key];
415
- }
416
-
417
- /**
418
- * Gets the native function at `key` of `object`.
419
- *
420
- * @private
421
- * @param {Object} object The object to query.
422
- * @param {string} key The key of the method to get.
423
- * @returns {*} Returns the function if it's native, else `undefined`.
424
- */
425
- function getNative(object, key) {
426
- var value = getValue(object, key);
427
- return baseIsNative(value) ? value : undefined;
428
- }
429
-
430
- /* Built-in method references that are verified to be native. */
431
- var WeakMap = getNative(root, 'WeakMap');
432
-
433
- /** Built-in value references. */
434
- var objectCreate = Object.create;
435
-
436
- /**
437
- * The base implementation of `_.create` without support for assigning
438
- * properties to the created object.
439
- *
440
- * @private
441
- * @param {Object} proto The object to inherit from.
442
- * @returns {Object} Returns the new object.
443
- */
444
- var baseCreate = (function() {
445
- function object() {}
446
- return function(proto) {
447
- if (!isObject(proto)) {
448
- return {};
449
- }
450
- if (objectCreate) {
451
- return objectCreate(proto);
452
- }
453
- object.prototype = proto;
454
- var result = new object;
455
- object.prototype = undefined;
456
- return result;
457
- };
458
- }());
459
-
460
- /**
461
- * A faster alternative to `Function#apply`, this function invokes `func`
462
- * with the `this` binding of `thisArg` and the arguments of `args`.
463
- *
464
- * @private
465
- * @param {Function} func The function to invoke.
466
- * @param {*} thisArg The `this` binding of `func`.
467
- * @param {Array} args The arguments to invoke `func` with.
468
- * @returns {*} Returns the result of `func`.
469
- */
470
- function apply(func, thisArg, args) {
471
- switch (args.length) {
472
- case 0: return func.call(thisArg);
473
- case 1: return func.call(thisArg, args[0]);
474
- case 2: return func.call(thisArg, args[0], args[1]);
475
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
476
- }
477
- return func.apply(thisArg, args);
478
- }
479
-
480
- /**
481
- * This method returns `undefined`.
482
- *
483
- * @static
484
- * @memberOf _
485
- * @since 2.3.0
486
- * @category Util
487
- * @example
488
- *
489
- * _.times(2, _.noop);
490
- * // => [undefined, undefined]
491
- */
492
- function noop() {
493
- // No operation performed.
494
- }
495
-
496
- /**
497
- * Copies the values of `source` to `array`.
498
- *
499
- * @private
500
- * @param {Array} source The array to copy values from.
501
- * @param {Array} [array=[]] The array to copy values to.
502
- * @returns {Array} Returns `array`.
503
- */
504
- function copyArray(source, array) {
505
- var index = -1,
506
- length = source.length;
507
-
508
- array || (array = Array(length));
509
- while (++index < length) {
510
- array[index] = source[index];
511
- }
512
- return array;
513
- }
514
-
515
- /** Used to detect hot functions by number of calls within a span of milliseconds. */
516
- var HOT_COUNT = 800,
517
- HOT_SPAN = 16;
518
-
519
- /* Built-in method references for those with the same name as other `lodash` methods. */
520
- var nativeNow = Date.now;
521
-
522
- /**
523
- * Creates a function that'll short out and invoke `identity` instead
524
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
525
- * milliseconds.
526
- *
527
- * @private
528
- * @param {Function} func The function to restrict.
529
- * @returns {Function} Returns the new shortable function.
530
- */
531
- function shortOut(func) {
532
- var count = 0,
533
- lastCalled = 0;
534
-
535
- return function() {
536
- var stamp = nativeNow(),
537
- remaining = HOT_SPAN - (stamp - lastCalled);
538
-
539
- lastCalled = stamp;
540
- if (remaining > 0) {
541
- if (++count >= HOT_COUNT) {
542
- return arguments[0];
543
- }
544
- } else {
545
- count = 0;
546
- }
547
- return func.apply(undefined, arguments);
548
- };
549
- }
550
-
551
- /**
552
- * Creates a function that returns `value`.
553
- *
554
- * @static
555
- * @memberOf _
556
- * @since 2.4.0
557
- * @category Util
558
- * @param {*} value The value to return from the new function.
559
- * @returns {Function} Returns the new constant function.
560
- * @example
561
- *
562
- * var objects = _.times(2, _.constant({ 'a': 1 }));
563
- *
564
- * console.log(objects);
565
- * // => [{ 'a': 1 }, { 'a': 1 }]
566
- *
567
- * console.log(objects[0] === objects[1]);
568
- * // => true
569
- */
570
- function constant(value) {
571
- return function() {
572
- return value;
573
- };
574
- }
575
-
576
- var defineProperty = (function() {
577
- try {
578
- var func = getNative(Object, 'defineProperty');
579
- func({}, '', {});
580
- return func;
581
- } catch (e) {}
582
- }());
583
-
584
- /**
585
- * The base implementation of `setToString` without support for hot loop shorting.
586
- *
587
- * @private
588
- * @param {Function} func The function to modify.
589
- * @param {Function} string The `toString` result.
590
- * @returns {Function} Returns `func`.
591
- */
592
- var baseSetToString = !defineProperty ? identity : function(func, string) {
593
- return defineProperty(func, 'toString', {
594
- 'configurable': true,
595
- 'enumerable': false,
596
- 'value': constant(string),
597
- 'writable': true
598
- });
599
- };
600
-
601
- /**
602
- * Sets the `toString` method of `func` to return `string`.
603
- *
604
- * @private
605
- * @param {Function} func The function to modify.
606
- * @param {Function} string The `toString` result.
607
- * @returns {Function} Returns `func`.
608
- */
609
- var setToString = shortOut(baseSetToString);
610
-
611
- /**
612
- * A specialized version of `_.forEach` for arrays without support for
613
- * iteratee shorthands.
614
- *
615
- * @private
616
- * @param {Array} [array] The array to iterate over.
617
- * @param {Function} iteratee The function invoked per iteration.
618
- * @returns {Array} Returns `array`.
619
- */
620
- function arrayEach(array, iteratee) {
621
- var index = -1,
622
- length = array == null ? 0 : array.length;
623
-
624
- while (++index < length) {
625
- if (iteratee(array[index], index, array) === false) {
626
- break;
627
- }
628
- }
629
- return array;
630
- }
631
-
632
- /**
633
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
634
- * support for iteratee shorthands.
635
- *
636
- * @private
637
- * @param {Array} array The array to inspect.
638
- * @param {Function} predicate The function invoked per iteration.
639
- * @param {number} fromIndex The index to search from.
640
- * @param {boolean} [fromRight] Specify iterating from right to left.
641
- * @returns {number} Returns the index of the matched value, else `-1`.
642
- */
643
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
644
- var length = array.length,
645
- index = fromIndex + (-1);
646
-
647
- while ((++index < length)) {
648
- if (predicate(array[index], index, array)) {
649
- return index;
650
- }
651
- }
652
- return -1;
653
- }
654
-
655
- /**
656
- * The base implementation of `_.isNaN` without support for number objects.
657
- *
658
- * @private
659
- * @param {*} value The value to check.
660
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
661
- */
662
- function baseIsNaN(value) {
663
- return value !== value;
664
- }
665
-
666
- /**
667
- * A specialized version of `_.indexOf` which performs strict equality
668
- * comparisons of values, i.e. `===`.
669
- *
670
- * @private
671
- * @param {Array} array The array to inspect.
672
- * @param {*} value The value to search for.
673
- * @param {number} fromIndex The index to search from.
674
- * @returns {number} Returns the index of the matched value, else `-1`.
675
- */
676
- function strictIndexOf(array, value, fromIndex) {
677
- var index = fromIndex - 1,
678
- length = array.length;
679
-
680
- while (++index < length) {
681
- if (array[index] === value) {
682
- return index;
683
- }
684
- }
685
- return -1;
686
- }
687
-
688
- /**
689
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
690
- *
691
- * @private
692
- * @param {Array} array The array to inspect.
693
- * @param {*} value The value to search for.
694
- * @param {number} fromIndex The index to search from.
695
- * @returns {number} Returns the index of the matched value, else `-1`.
696
- */
697
- function baseIndexOf(array, value, fromIndex) {
698
- return value === value
699
- ? strictIndexOf(array, value, fromIndex)
700
- : baseFindIndex(array, baseIsNaN, fromIndex);
701
- }
702
-
703
- /**
704
- * A specialized version of `_.includes` for arrays without support for
705
- * specifying an index to search from.
706
- *
707
- * @private
708
- * @param {Array} [array] The array to inspect.
709
- * @param {*} target The value to search for.
710
- * @returns {boolean} Returns `true` if `target` is found, else `false`.
711
- */
712
- function arrayIncludes(array, value) {
713
- var length = array == null ? 0 : array.length;
714
- return !!length && baseIndexOf(array, value, 0) > -1;
715
- }
716
-
717
- /** Used as references for various `Number` constants. */
718
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
719
-
720
- /** Used to detect unsigned integer values. */
721
- var reIsUint = /^(?:0|[1-9]\d*)$/;
722
-
723
- /**
724
- * Checks if `value` is a valid array-like index.
725
- *
726
- * @private
727
- * @param {*} value The value to check.
728
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
729
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
730
- */
731
- function isIndex(value, length) {
732
- var type = typeof value;
733
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
734
-
735
- return !!length &&
736
- (type == 'number' ||
737
- (type != 'symbol' && reIsUint.test(value))) &&
738
- (value > -1 && value % 1 == 0 && value < length);
739
- }
740
-
741
- /**
742
- * The base implementation of `assignValue` and `assignMergeValue` without
743
- * value checks.
744
- *
745
- * @private
746
- * @param {Object} object The object to modify.
747
- * @param {string} key The key of the property to assign.
748
- * @param {*} value The value to assign.
749
- */
750
- function baseAssignValue(object, key, value) {
751
- if (key == '__proto__' && defineProperty) {
752
- defineProperty(object, key, {
753
- 'configurable': true,
754
- 'enumerable': true,
755
- 'value': value,
756
- 'writable': true
757
- });
758
- } else {
759
- object[key] = value;
760
- }
761
- }
762
-
763
- /**
764
- * Performs a
765
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
766
- * comparison between two values to determine if they are equivalent.
767
- *
768
- * @static
769
- * @memberOf _
770
- * @since 4.0.0
771
- * @category Lang
772
- * @param {*} value The value to compare.
773
- * @param {*} other The other value to compare.
774
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
775
- * @example
776
- *
777
- * var object = { 'a': 1 };
778
- * var other = { 'a': 1 };
779
- *
780
- * _.eq(object, object);
781
- * // => true
782
- *
783
- * _.eq(object, other);
784
- * // => false
785
- *
786
- * _.eq('a', 'a');
787
- * // => true
788
- *
789
- * _.eq('a', Object('a'));
790
- * // => false
791
- *
792
- * _.eq(NaN, NaN);
793
- * // => true
794
- */
795
- function eq(value, other) {
796
- return value === other || (value !== value && other !== other);
797
- }
798
-
799
- /** Used for built-in method references. */
800
- var objectProto$f = Object.prototype;
801
-
802
- /** Used to check objects for own properties. */
803
- var hasOwnProperty$d = objectProto$f.hasOwnProperty;
804
-
805
- /**
806
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
807
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
808
- * for equality comparisons.
809
- *
810
- * @private
811
- * @param {Object} object The object to modify.
812
- * @param {string} key The key of the property to assign.
813
- * @param {*} value The value to assign.
814
- */
815
- function assignValue(object, key, value) {
816
- var objValue = object[key];
817
- if (!(hasOwnProperty$d.call(object, key) && eq(objValue, value)) ||
818
- (value === undefined && !(key in object))) {
819
- baseAssignValue(object, key, value);
820
- }
821
- }
822
-
823
- /**
824
- * Copies properties of `source` to `object`.
825
- *
826
- * @private
827
- * @param {Object} source The object to copy properties from.
828
- * @param {Array} props The property identifiers to copy.
829
- * @param {Object} [object={}] The object to copy properties to.
830
- * @param {Function} [customizer] The function to customize copied values.
831
- * @returns {Object} Returns `object`.
832
- */
833
- function copyObject(source, props, object, customizer) {
834
- var isNew = !object;
835
- object || (object = {});
836
-
837
- var index = -1,
838
- length = props.length;
839
-
840
- while (++index < length) {
841
- var key = props[index];
842
-
843
- var newValue = undefined;
844
-
845
- if (newValue === undefined) {
846
- newValue = source[key];
847
- }
848
- if (isNew) {
849
- baseAssignValue(object, key, newValue);
850
- } else {
851
- assignValue(object, key, newValue);
852
- }
853
- }
854
- return object;
855
- }
856
-
857
- /* Built-in method references for those with the same name as other `lodash` methods. */
858
- var nativeMax = Math.max;
859
-
860
- /**
861
- * A specialized version of `baseRest` which transforms the rest array.
862
- *
863
- * @private
864
- * @param {Function} func The function to apply a rest parameter to.
865
- * @param {number} [start=func.length-1] The start position of the rest parameter.
866
- * @param {Function} transform The rest array transform.
867
- * @returns {Function} Returns the new function.
868
- */
869
- function overRest(func, start, transform) {
870
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
871
- return function() {
872
- var args = arguments,
873
- index = -1,
874
- length = nativeMax(args.length - start, 0),
875
- array = Array(length);
876
-
877
- while (++index < length) {
878
- array[index] = args[start + index];
879
- }
880
- index = -1;
881
- var otherArgs = Array(start + 1);
882
- while (++index < start) {
883
- otherArgs[index] = args[index];
884
- }
885
- otherArgs[start] = transform(array);
886
- return apply(func, this, otherArgs);
887
- };
888
- }
889
-
890
- /**
891
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
892
- *
893
- * @private
894
- * @param {Function} func The function to apply a rest parameter to.
895
- * @param {number} [start=func.length-1] The start position of the rest parameter.
896
- * @returns {Function} Returns the new function.
897
- */
898
- function baseRest(func, start) {
899
- return setToString(overRest(func, start, identity), func + '');
900
- }
901
-
902
- /** Used as references for various `Number` constants. */
903
- var MAX_SAFE_INTEGER = 9007199254740991;
904
-
905
- /**
906
- * Checks if `value` is a valid array-like length.
907
- *
908
- * **Note:** This method is loosely based on
909
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
910
- *
911
- * @static
912
- * @memberOf _
913
- * @since 4.0.0
914
- * @category Lang
915
- * @param {*} value The value to check.
916
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
917
- * @example
918
- *
919
- * _.isLength(3);
920
- * // => true
921
- *
922
- * _.isLength(Number.MIN_VALUE);
923
- * // => false
924
- *
925
- * _.isLength(Infinity);
926
- * // => false
927
- *
928
- * _.isLength('3');
929
- * // => false
930
- */
931
- function isLength(value) {
932
- return typeof value == 'number' &&
933
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
934
- }
935
-
936
- /**
937
- * Checks if `value` is array-like. A value is considered array-like if it's
938
- * not a function and has a `value.length` that's an integer greater than or
939
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
940
- *
941
- * @static
942
- * @memberOf _
943
- * @since 4.0.0
944
- * @category Lang
945
- * @param {*} value The value to check.
946
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
947
- * @example
948
- *
949
- * _.isArrayLike([1, 2, 3]);
950
- * // => true
951
- *
952
- * _.isArrayLike(document.body.children);
953
- * // => true
954
- *
955
- * _.isArrayLike('abc');
956
- * // => true
957
- *
958
- * _.isArrayLike(_.noop);
959
- * // => false
960
- */
961
- function isArrayLike(value) {
962
- return value != null && isLength(value.length) && !isFunction(value);
963
- }
964
-
965
- /**
966
- * Checks if the given arguments are from an iteratee call.
967
- *
968
- * @private
969
- * @param {*} value The potential iteratee value argument.
970
- * @param {*} index The potential iteratee index or key argument.
971
- * @param {*} object The potential iteratee object argument.
972
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
973
- * else `false`.
974
- */
975
- function isIterateeCall(value, index, object) {
976
- if (!isObject(object)) {
977
- return false;
978
- }
979
- var type = typeof index;
980
- if (type == 'number'
981
- ? (isArrayLike(object) && isIndex(index, object.length))
982
- : (type == 'string' && index in object)
983
- ) {
984
- return eq(object[index], value);
985
- }
986
- return false;
987
- }
988
-
989
- /**
990
- * Creates a function like `_.assign`.
991
- *
992
- * @private
993
- * @param {Function} assigner The function to assign values.
994
- * @returns {Function} Returns the new assigner function.
995
- */
996
- function createAssigner(assigner) {
997
- return baseRest(function(object, sources) {
998
- var index = -1,
999
- length = sources.length,
1000
- customizer = length > 1 ? sources[length - 1] : undefined,
1001
- guard = length > 2 ? sources[2] : undefined;
1002
-
1003
- customizer = (assigner.length > 3 && typeof customizer == 'function')
1004
- ? (length--, customizer)
1005
- : undefined;
1006
-
1007
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
1008
- customizer = length < 3 ? undefined : customizer;
1009
- length = 1;
1010
- }
1011
- object = Object(object);
1012
- while (++index < length) {
1013
- var source = sources[index];
1014
- if (source) {
1015
- assigner(object, source, index, customizer);
1016
- }
1017
- }
1018
- return object;
1019
- });
1020
- }
1021
-
1022
- /** Used for built-in method references. */
1023
- var objectProto$e = Object.prototype;
1024
-
1025
- /**
1026
- * Checks if `value` is likely a prototype object.
1027
- *
1028
- * @private
1029
- * @param {*} value The value to check.
1030
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1031
- */
1032
- function isPrototype(value) {
1033
- var Ctor = value && value.constructor,
1034
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$e;
1035
-
1036
- return value === proto;
1037
- }
1038
-
1039
- /**
1040
- * The base implementation of `_.times` without support for iteratee shorthands
1041
- * or max array length checks.
1042
- *
1043
- * @private
1044
- * @param {number} n The number of times to invoke `iteratee`.
1045
- * @param {Function} iteratee The function invoked per iteration.
1046
- * @returns {Array} Returns the array of results.
1047
- */
1048
- function baseTimes(n, iteratee) {
1049
- var index = -1,
1050
- result = Array(n);
1051
-
1052
- while (++index < n) {
1053
- result[index] = iteratee(index);
1054
- }
1055
- return result;
1056
- }
1057
-
1058
- /** `Object#toString` result references. */
1059
- var argsTag$3 = '[object Arguments]';
1060
-
1061
- /**
1062
- * The base implementation of `_.isArguments`.
1063
- *
1064
- * @private
1065
- * @param {*} value The value to check.
1066
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1067
- */
1068
- function baseIsArguments(value) {
1069
- return isObjectLike(value) && baseGetTag(value) == argsTag$3;
1070
- }
1071
-
1072
- /** Used for built-in method references. */
1073
- var objectProto$d = Object.prototype;
1074
-
1075
- /** Used to check objects for own properties. */
1076
- var hasOwnProperty$c = objectProto$d.hasOwnProperty;
1077
-
1078
- /** Built-in value references. */
1079
- var propertyIsEnumerable$1 = objectProto$d.propertyIsEnumerable;
1080
-
1081
- /**
1082
- * Checks if `value` is likely an `arguments` object.
1083
- *
1084
- * @static
1085
- * @memberOf _
1086
- * @since 0.1.0
1087
- * @category Lang
1088
- * @param {*} value The value to check.
1089
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1090
- * else `false`.
1091
- * @example
1092
- *
1093
- * _.isArguments(function() { return arguments; }());
1094
- * // => true
1095
- *
1096
- * _.isArguments([1, 2, 3]);
1097
- * // => false
1098
- */
1099
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1100
- return isObjectLike(value) && hasOwnProperty$c.call(value, 'callee') &&
1101
- !propertyIsEnumerable$1.call(value, 'callee');
1102
- };
1103
-
1104
- /**
1105
- * This method returns `false`.
1106
- *
1107
- * @static
1108
- * @memberOf _
1109
- * @since 4.13.0
1110
- * @category Util
1111
- * @returns {boolean} Returns `false`.
1112
- * @example
1113
- *
1114
- * _.times(2, _.stubFalse);
1115
- * // => [false, false]
1116
- */
1117
- function stubFalse() {
1118
- return false;
1119
- }
1120
-
1121
- /** Detect free variable `exports`. */
1122
- var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1123
-
1124
- /** Detect free variable `module`. */
1125
- var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
1126
-
1127
- /** Detect the popular CommonJS extension `module.exports`. */
1128
- var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
1129
-
1130
- /** Built-in value references. */
1131
- var Buffer$1 = moduleExports$2 ? root.Buffer : undefined;
1132
-
1133
- /* Built-in method references for those with the same name as other `lodash` methods. */
1134
- var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
1135
-
1136
- /**
1137
- * Checks if `value` is a buffer.
1138
- *
1139
- * @static
1140
- * @memberOf _
1141
- * @since 4.3.0
1142
- * @category Lang
1143
- * @param {*} value The value to check.
1144
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1145
- * @example
1146
- *
1147
- * _.isBuffer(new Buffer(2));
1148
- * // => true
1149
- *
1150
- * _.isBuffer(new Uint8Array(2));
1151
- * // => false
1152
- */
1153
- var isBuffer = nativeIsBuffer || stubFalse;
1154
-
1155
- /** `Object#toString` result references. */
1156
- var argsTag$2 = '[object Arguments]',
1157
- arrayTag$2 = '[object Array]',
1158
- boolTag$3 = '[object Boolean]',
1159
- dateTag$3 = '[object Date]',
1160
- errorTag$2 = '[object Error]',
1161
- funcTag$1 = '[object Function]',
1162
- mapTag$6 = '[object Map]',
1163
- numberTag$3 = '[object Number]',
1164
- objectTag$4 = '[object Object]',
1165
- regexpTag$3 = '[object RegExp]',
1166
- setTag$6 = '[object Set]',
1167
- stringTag$3 = '[object String]',
1168
- weakMapTag$2 = '[object WeakMap]';
1169
-
1170
- var arrayBufferTag$3 = '[object ArrayBuffer]',
1171
- dataViewTag$4 = '[object DataView]',
1172
- float32Tag$2 = '[object Float32Array]',
1173
- float64Tag$2 = '[object Float64Array]',
1174
- int8Tag$2 = '[object Int8Array]',
1175
- int16Tag$2 = '[object Int16Array]',
1176
- int32Tag$2 = '[object Int32Array]',
1177
- uint8Tag$2 = '[object Uint8Array]',
1178
- uint8ClampedTag$2 = '[object Uint8ClampedArray]',
1179
- uint16Tag$2 = '[object Uint16Array]',
1180
- uint32Tag$2 = '[object Uint32Array]';
1181
-
1182
- /** Used to identify `toStringTag` values of typed arrays. */
1183
- var typedArrayTags = {};
1184
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
1185
- typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
1186
- typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
1187
- typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
1188
- typedArrayTags[uint32Tag$2] = true;
1189
- typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] =
1190
- typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] =
1191
- typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] =
1192
- typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] =
1193
- typedArrayTags[mapTag$6] = typedArrayTags[numberTag$3] =
1194
- typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] =
1195
- typedArrayTags[setTag$6] = typedArrayTags[stringTag$3] =
1196
- typedArrayTags[weakMapTag$2] = false;
1197
-
1198
- /**
1199
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1200
- *
1201
- * @private
1202
- * @param {*} value The value to check.
1203
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1204
- */
1205
- function baseIsTypedArray(value) {
1206
- return isObjectLike(value) &&
1207
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1208
- }
1209
-
1210
- /**
1211
- * The base implementation of `_.unary` without support for storing metadata.
1212
- *
1213
- * @private
1214
- * @param {Function} func The function to cap arguments for.
1215
- * @returns {Function} Returns the new capped function.
1216
- */
1217
- function baseUnary(func) {
1218
- return function(value) {
1219
- return func(value);
1220
- };
1221
- }
1222
-
1223
- /** Detect free variable `exports`. */
1224
- var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1225
-
1226
- /** Detect free variable `module`. */
1227
- var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1228
-
1229
- /** Detect the popular CommonJS extension `module.exports`. */
1230
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1231
-
1232
- /** Detect free variable `process` from Node.js. */
1233
- var freeProcess = moduleExports$1 && freeGlobal.process;
1234
-
1235
- /** Used to access faster Node.js helpers. */
1236
- var nodeUtil = (function() {
1237
- try {
1238
- // Use `util.types` for Node.js 10+.
1239
- var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
1240
-
1241
- if (types) {
1242
- return types;
1243
- }
1244
-
1245
- // Legacy `process.binding('util')` for Node.js < 10.
1246
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1247
- } catch (e) {}
1248
- }());
1249
-
1250
- /* Node.js helper references. */
1251
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1252
-
1253
- /**
1254
- * Checks if `value` is classified as a typed array.
1255
- *
1256
- * @static
1257
- * @memberOf _
1258
- * @since 3.0.0
1259
- * @category Lang
1260
- * @param {*} value The value to check.
1261
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1262
- * @example
1263
- *
1264
- * _.isTypedArray(new Uint8Array);
1265
- * // => true
1266
- *
1267
- * _.isTypedArray([]);
1268
- * // => false
1269
- */
1270
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1271
-
1272
- /** Used for built-in method references. */
1273
- var objectProto$c = Object.prototype;
1274
-
1275
- /** Used to check objects for own properties. */
1276
- var hasOwnProperty$b = objectProto$c.hasOwnProperty;
1277
-
1278
- /**
1279
- * Creates an array of the enumerable property names of the array-like `value`.
1280
- *
1281
- * @private
1282
- * @param {*} value The value to query.
1283
- * @param {boolean} inherited Specify returning inherited property names.
1284
- * @returns {Array} Returns the array of property names.
1285
- */
1286
- function arrayLikeKeys(value, inherited) {
1287
- var isArr = isArray(value),
1288
- isArg = !isArr && isArguments(value),
1289
- isBuff = !isArr && !isArg && isBuffer(value),
1290
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1291
- skipIndexes = isArr || isArg || isBuff || isType,
1292
- result = skipIndexes ? baseTimes(value.length, String) : [],
1293
- length = result.length;
1294
-
1295
- for (var key in value) {
1296
- if ((inherited || hasOwnProperty$b.call(value, key)) &&
1297
- !(skipIndexes && (
1298
- // Safari 9 has enumerable `arguments.length` in strict mode.
1299
- key == 'length' ||
1300
- // Node.js 0.10 has enumerable non-index properties on buffers.
1301
- (isBuff && (key == 'offset' || key == 'parent')) ||
1302
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1303
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1304
- // Skip index properties.
1305
- isIndex(key, length)
1306
- ))) {
1307
- result.push(key);
1308
- }
1309
- }
1310
- return result;
1311
- }
1312
-
1313
- /**
1314
- * Creates a unary function that invokes `func` with its argument transformed.
1315
- *
1316
- * @private
1317
- * @param {Function} func The function to wrap.
1318
- * @param {Function} transform The argument transform.
1319
- * @returns {Function} Returns the new function.
1320
- */
1321
- function overArg(func, transform) {
1322
- return function(arg) {
1323
- return func(transform(arg));
1324
- };
1325
- }
1326
-
1327
- /* Built-in method references for those with the same name as other `lodash` methods. */
1328
- var nativeKeys = overArg(Object.keys, Object);
1329
-
1330
- /** Used for built-in method references. */
1331
- var objectProto$b = Object.prototype;
1332
-
1333
- /** Used to check objects for own properties. */
1334
- var hasOwnProperty$a = objectProto$b.hasOwnProperty;
1335
-
1336
- /**
1337
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1338
- *
1339
- * @private
1340
- * @param {Object} object The object to query.
1341
- * @returns {Array} Returns the array of property names.
1342
- */
1343
- function baseKeys(object) {
1344
- if (!isPrototype(object)) {
1345
- return nativeKeys(object);
1346
- }
1347
- var result = [];
1348
- for (var key in Object(object)) {
1349
- if (hasOwnProperty$a.call(object, key) && key != 'constructor') {
1350
- result.push(key);
1351
- }
1352
- }
1353
- return result;
1354
- }
1355
-
1356
- /**
1357
- * Creates an array of the own enumerable property names of `object`.
1358
- *
1359
- * **Note:** Non-object values are coerced to objects. See the
1360
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1361
- * for more details.
1362
- *
1363
- * @static
1364
- * @since 0.1.0
1365
- * @memberOf _
1366
- * @category Object
1367
- * @param {Object} object The object to query.
1368
- * @returns {Array} Returns the array of property names.
1369
- * @example
1370
- *
1371
- * function Foo() {
1372
- * this.a = 1;
1373
- * this.b = 2;
1374
- * }
1375
- *
1376
- * Foo.prototype.c = 3;
1377
- *
1378
- * _.keys(new Foo);
1379
- * // => ['a', 'b'] (iteration order is not guaranteed)
1380
- *
1381
- * _.keys('hi');
1382
- * // => ['0', '1']
1383
- */
1384
- function keys(object) {
1385
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1386
- }
1387
-
1388
- /**
1389
- * This function is like
1390
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1391
- * except that it includes inherited enumerable properties.
1392
- *
1393
- * @private
1394
- * @param {Object} object The object to query.
1395
- * @returns {Array} Returns the array of property names.
1396
- */
1397
- function nativeKeysIn(object) {
1398
- var result = [];
1399
- if (object != null) {
1400
- for (var key in Object(object)) {
1401
- result.push(key);
1402
- }
1403
- }
1404
- return result;
1405
- }
1406
-
1407
- /** Used for built-in method references. */
1408
- var objectProto$a = Object.prototype;
1409
-
1410
- /** Used to check objects for own properties. */
1411
- var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
1412
-
1413
- /**
1414
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
1415
- *
1416
- * @private
1417
- * @param {Object} object The object to query.
1418
- * @returns {Array} Returns the array of property names.
1419
- */
1420
- function baseKeysIn(object) {
1421
- if (!isObject(object)) {
1422
- return nativeKeysIn(object);
1423
- }
1424
- var isProto = isPrototype(object),
1425
- result = [];
1426
-
1427
- for (var key in object) {
1428
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
1429
- result.push(key);
1430
- }
1431
- }
1432
- return result;
1433
- }
1434
-
1435
- /**
1436
- * Creates an array of the own and inherited enumerable property names of `object`.
1437
- *
1438
- * **Note:** Non-object values are coerced to objects.
1439
- *
1440
- * @static
1441
- * @memberOf _
1442
- * @since 3.0.0
1443
- * @category Object
1444
- * @param {Object} object The object to query.
1445
- * @returns {Array} Returns the array of property names.
1446
- * @example
1447
- *
1448
- * function Foo() {
1449
- * this.a = 1;
1450
- * this.b = 2;
1451
- * }
1452
- *
1453
- * Foo.prototype.c = 3;
1454
- *
1455
- * _.keysIn(new Foo);
1456
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1457
- */
1458
- function keysIn(object) {
1459
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1460
- }
1461
-
1462
- /** Used to match property names within property paths. */
1463
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
1464
- reIsPlainProp = /^\w*$/;
1465
-
1466
- /**
1467
- * Checks if `value` is a property name and not a property path.
1468
- *
1469
- * @private
1470
- * @param {*} value The value to check.
1471
- * @param {Object} [object] The object to query keys on.
1472
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
1473
- */
1474
- function isKey(value, object) {
1475
- if (isArray(value)) {
1476
- return false;
1477
- }
1478
- var type = typeof value;
1479
- if (type == 'number' || type == 'symbol' || type == 'boolean' ||
1480
- value == null || isSymbol(value)) {
1481
- return true;
1482
- }
1483
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
1484
- (object != null && value in Object(object));
1485
- }
1486
-
1487
- /* Built-in method references that are verified to be native. */
1488
- var nativeCreate = getNative(Object, 'create');
1489
-
1490
- /**
1491
- * Removes all key-value entries from the hash.
1492
- *
1493
- * @private
1494
- * @name clear
1495
- * @memberOf Hash
1496
- */
1497
- function hashClear() {
1498
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
1499
- this.size = 0;
1500
- }
1501
-
1502
- /**
1503
- * Removes `key` and its value from the hash.
1504
- *
1505
- * @private
1506
- * @name delete
1507
- * @memberOf Hash
1508
- * @param {Object} hash The hash to modify.
1509
- * @param {string} key The key of the value to remove.
1510
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1511
- */
1512
- function hashDelete(key) {
1513
- var result = this.has(key) && delete this.__data__[key];
1514
- this.size -= result ? 1 : 0;
1515
- return result;
1516
- }
1517
-
1518
- /** Used to stand-in for `undefined` hash values. */
1519
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
1520
-
1521
- /** Used for built-in method references. */
1522
- var objectProto$9 = Object.prototype;
1523
-
1524
- /** Used to check objects for own properties. */
1525
- var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
1526
-
1527
- /**
1528
- * Gets the hash value for `key`.
1529
- *
1530
- * @private
1531
- * @name get
1532
- * @memberOf Hash
1533
- * @param {string} key The key of the value to get.
1534
- * @returns {*} Returns the entry value.
1535
- */
1536
- function hashGet(key) {
1537
- var data = this.__data__;
1538
- if (nativeCreate) {
1539
- var result = data[key];
1540
- return result === HASH_UNDEFINED$2 ? undefined : result;
1541
- }
1542
- return hasOwnProperty$8.call(data, key) ? data[key] : undefined;
1543
- }
1544
-
1545
- /** Used for built-in method references. */
1546
- var objectProto$8 = Object.prototype;
1547
-
1548
- /** Used to check objects for own properties. */
1549
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
1550
-
1551
- /**
1552
- * Checks if a hash value for `key` exists.
1553
- *
1554
- * @private
1555
- * @name has
1556
- * @memberOf Hash
1557
- * @param {string} key The key of the entry to check.
1558
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1559
- */
1560
- function hashHas(key) {
1561
- var data = this.__data__;
1562
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$7.call(data, key);
1563
- }
1564
-
1565
- /** Used to stand-in for `undefined` hash values. */
1566
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1567
-
1568
- /**
1569
- * Sets the hash `key` to `value`.
1570
- *
1571
- * @private
1572
- * @name set
1573
- * @memberOf Hash
1574
- * @param {string} key The key of the value to set.
1575
- * @param {*} value The value to set.
1576
- * @returns {Object} Returns the hash instance.
1577
- */
1578
- function hashSet(key, value) {
1579
- var data = this.__data__;
1580
- this.size += this.has(key) ? 0 : 1;
1581
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
1582
- return this;
1583
- }
1584
-
1585
- /**
1586
- * Creates a hash object.
1587
- *
1588
- * @private
1589
- * @constructor
1590
- * @param {Array} [entries] The key-value pairs to cache.
1591
- */
1592
- function Hash(entries) {
1593
- var index = -1,
1594
- length = entries == null ? 0 : entries.length;
1595
-
1596
- this.clear();
1597
- while (++index < length) {
1598
- var entry = entries[index];
1599
- this.set(entry[0], entry[1]);
1600
- }
1601
- }
1602
-
1603
- // Add methods to `Hash`.
1604
- Hash.prototype.clear = hashClear;
1605
- Hash.prototype['delete'] = hashDelete;
1606
- Hash.prototype.get = hashGet;
1607
- Hash.prototype.has = hashHas;
1608
- Hash.prototype.set = hashSet;
1609
-
1610
- /**
1611
- * Removes all key-value entries from the list cache.
1612
- *
1613
- * @private
1614
- * @name clear
1615
- * @memberOf ListCache
1616
- */
1617
- function listCacheClear() {
1618
- this.__data__ = [];
1619
- this.size = 0;
1620
- }
1621
-
1622
- /**
1623
- * Gets the index at which the `key` is found in `array` of key-value pairs.
1624
- *
1625
- * @private
1626
- * @param {Array} array The array to inspect.
1627
- * @param {*} key The key to search for.
1628
- * @returns {number} Returns the index of the matched value, else `-1`.
1629
- */
1630
- function assocIndexOf(array, key) {
1631
- var length = array.length;
1632
- while (length--) {
1633
- if (eq(array[length][0], key)) {
1634
- return length;
1635
- }
1636
- }
1637
- return -1;
1638
- }
1639
-
1640
- /** Used for built-in method references. */
1641
- var arrayProto = Array.prototype;
1642
-
1643
- /** Built-in value references. */
1644
- var splice = arrayProto.splice;
1645
-
1646
- /**
1647
- * Removes `key` and its value from the list cache.
1648
- *
1649
- * @private
1650
- * @name delete
1651
- * @memberOf ListCache
1652
- * @param {string} key The key of the value to remove.
1653
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1654
- */
1655
- function listCacheDelete(key) {
1656
- var data = this.__data__,
1657
- index = assocIndexOf(data, key);
1658
-
1659
- if (index < 0) {
1660
- return false;
1661
- }
1662
- var lastIndex = data.length - 1;
1663
- if (index == lastIndex) {
1664
- data.pop();
1665
- } else {
1666
- splice.call(data, index, 1);
1667
- }
1668
- --this.size;
1669
- return true;
1670
- }
1671
-
1672
- /**
1673
- * Gets the list cache value for `key`.
1674
- *
1675
- * @private
1676
- * @name get
1677
- * @memberOf ListCache
1678
- * @param {string} key The key of the value to get.
1679
- * @returns {*} Returns the entry value.
1680
- */
1681
- function listCacheGet(key) {
1682
- var data = this.__data__,
1683
- index = assocIndexOf(data, key);
1684
-
1685
- return index < 0 ? undefined : data[index][1];
1686
- }
1687
-
1688
- /**
1689
- * Checks if a list cache value for `key` exists.
1690
- *
1691
- * @private
1692
- * @name has
1693
- * @memberOf ListCache
1694
- * @param {string} key The key of the entry to check.
1695
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1696
- */
1697
- function listCacheHas(key) {
1698
- return assocIndexOf(this.__data__, key) > -1;
1699
- }
1700
-
1701
- /**
1702
- * Sets the list cache `key` to `value`.
1703
- *
1704
- * @private
1705
- * @name set
1706
- * @memberOf ListCache
1707
- * @param {string} key The key of the value to set.
1708
- * @param {*} value The value to set.
1709
- * @returns {Object} Returns the list cache instance.
1710
- */
1711
- function listCacheSet(key, value) {
1712
- var data = this.__data__,
1713
- index = assocIndexOf(data, key);
1714
-
1715
- if (index < 0) {
1716
- ++this.size;
1717
- data.push([key, value]);
1718
- } else {
1719
- data[index][1] = value;
1720
- }
1721
- return this;
1722
- }
1723
-
1724
- /**
1725
- * Creates an list cache object.
1726
- *
1727
- * @private
1728
- * @constructor
1729
- * @param {Array} [entries] The key-value pairs to cache.
1730
- */
1731
- function ListCache(entries) {
1732
- var index = -1,
1733
- length = entries == null ? 0 : entries.length;
1734
-
1735
- this.clear();
1736
- while (++index < length) {
1737
- var entry = entries[index];
1738
- this.set(entry[0], entry[1]);
1739
- }
1740
- }
1741
-
1742
- // Add methods to `ListCache`.
1743
- ListCache.prototype.clear = listCacheClear;
1744
- ListCache.prototype['delete'] = listCacheDelete;
1745
- ListCache.prototype.get = listCacheGet;
1746
- ListCache.prototype.has = listCacheHas;
1747
- ListCache.prototype.set = listCacheSet;
1748
-
1749
- /* Built-in method references that are verified to be native. */
1750
- var Map = getNative(root, 'Map');
1751
-
1752
- /**
1753
- * Removes all key-value entries from the map.
1754
- *
1755
- * @private
1756
- * @name clear
1757
- * @memberOf MapCache
1758
- */
1759
- function mapCacheClear() {
1760
- this.size = 0;
1761
- this.__data__ = {
1762
- 'hash': new Hash,
1763
- 'map': new (Map || ListCache),
1764
- 'string': new Hash
1765
- };
1766
- }
1767
-
1768
- /**
1769
- * Checks if `value` is suitable for use as unique object key.
1770
- *
1771
- * @private
1772
- * @param {*} value The value to check.
1773
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1774
- */
1775
- function isKeyable(value) {
1776
- var type = typeof value;
1777
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1778
- ? (value !== '__proto__')
1779
- : (value === null);
1780
- }
1781
-
1782
- /**
1783
- * Gets the data for `map`.
1784
- *
1785
- * @private
1786
- * @param {Object} map The map to query.
1787
- * @param {string} key The reference key.
1788
- * @returns {*} Returns the map data.
1789
- */
1790
- function getMapData(map, key) {
1791
- var data = map.__data__;
1792
- return isKeyable(key)
1793
- ? data[typeof key == 'string' ? 'string' : 'hash']
1794
- : data.map;
1795
- }
1796
-
1797
- /**
1798
- * Removes `key` and its value from the map.
1799
- *
1800
- * @private
1801
- * @name delete
1802
- * @memberOf MapCache
1803
- * @param {string} key The key of the value to remove.
1804
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1805
- */
1806
- function mapCacheDelete(key) {
1807
- var result = getMapData(this, key)['delete'](key);
1808
- this.size -= result ? 1 : 0;
1809
- return result;
1810
- }
1811
-
1812
- /**
1813
- * Gets the map value for `key`.
1814
- *
1815
- * @private
1816
- * @name get
1817
- * @memberOf MapCache
1818
- * @param {string} key The key of the value to get.
1819
- * @returns {*} Returns the entry value.
1820
- */
1821
- function mapCacheGet(key) {
1822
- return getMapData(this, key).get(key);
1823
- }
1824
-
1825
- /**
1826
- * Checks if a map value for `key` exists.
1827
- *
1828
- * @private
1829
- * @name has
1830
- * @memberOf MapCache
1831
- * @param {string} key The key of the entry to check.
1832
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1833
- */
1834
- function mapCacheHas(key) {
1835
- return getMapData(this, key).has(key);
1836
- }
1837
-
1838
- /**
1839
- * Sets the map `key` to `value`.
1840
- *
1841
- * @private
1842
- * @name set
1843
- * @memberOf MapCache
1844
- * @param {string} key The key of the value to set.
1845
- * @param {*} value The value to set.
1846
- * @returns {Object} Returns the map cache instance.
1847
- */
1848
- function mapCacheSet(key, value) {
1849
- var data = getMapData(this, key),
1850
- size = data.size;
1851
-
1852
- data.set(key, value);
1853
- this.size += data.size == size ? 0 : 1;
1854
- return this;
1855
- }
1856
-
1857
- /**
1858
- * Creates a map cache object to store key-value pairs.
1859
- *
1860
- * @private
1861
- * @constructor
1862
- * @param {Array} [entries] The key-value pairs to cache.
1863
- */
1864
- function MapCache(entries) {
1865
- var index = -1,
1866
- length = entries == null ? 0 : entries.length;
1867
-
1868
- this.clear();
1869
- while (++index < length) {
1870
- var entry = entries[index];
1871
- this.set(entry[0], entry[1]);
1872
- }
1873
- }
1874
-
1875
- // Add methods to `MapCache`.
1876
- MapCache.prototype.clear = mapCacheClear;
1877
- MapCache.prototype['delete'] = mapCacheDelete;
1878
- MapCache.prototype.get = mapCacheGet;
1879
- MapCache.prototype.has = mapCacheHas;
1880
- MapCache.prototype.set = mapCacheSet;
1881
-
1882
- /** Error message constants. */
1883
- var FUNC_ERROR_TEXT = 'Expected a function';
1884
-
1885
- /**
1886
- * Creates a function that memoizes the result of `func`. If `resolver` is
1887
- * provided, it determines the cache key for storing the result based on the
1888
- * arguments provided to the memoized function. By default, the first argument
1889
- * provided to the memoized function is used as the map cache key. The `func`
1890
- * is invoked with the `this` binding of the memoized function.
1891
- *
1892
- * **Note:** The cache is exposed as the `cache` property on the memoized
1893
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
1894
- * constructor with one whose instances implement the
1895
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
1896
- * method interface of `clear`, `delete`, `get`, `has`, and `set`.
1897
- *
1898
- * @static
1899
- * @memberOf _
1900
- * @since 0.1.0
1901
- * @category Function
1902
- * @param {Function} func The function to have its output memoized.
1903
- * @param {Function} [resolver] The function to resolve the cache key.
1904
- * @returns {Function} Returns the new memoized function.
1905
- * @example
1906
- *
1907
- * var object = { 'a': 1, 'b': 2 };
1908
- * var other = { 'c': 3, 'd': 4 };
1909
- *
1910
- * var values = _.memoize(_.values);
1911
- * values(object);
1912
- * // => [1, 2]
1913
- *
1914
- * values(other);
1915
- * // => [3, 4]
1916
- *
1917
- * object.a = 2;
1918
- * values(object);
1919
- * // => [1, 2]
1920
- *
1921
- * // Modify the result cache.
1922
- * values.cache.set(object, ['a', 'b']);
1923
- * values(object);
1924
- * // => ['a', 'b']
1925
- *
1926
- * // Replace `_.memoize.Cache`.
1927
- * _.memoize.Cache = WeakMap;
1928
- */
1929
- function memoize(func, resolver) {
1930
- if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
1931
- throw new TypeError(FUNC_ERROR_TEXT);
1932
- }
1933
- var memoized = function() {
1934
- var args = arguments,
1935
- key = resolver ? resolver.apply(this, args) : args[0],
1936
- cache = memoized.cache;
1937
-
1938
- if (cache.has(key)) {
1939
- return cache.get(key);
1940
- }
1941
- var result = func.apply(this, args);
1942
- memoized.cache = cache.set(key, result) || cache;
1943
- return result;
1944
- };
1945
- memoized.cache = new (memoize.Cache || MapCache);
1946
- return memoized;
1947
- }
1948
-
1949
- // Expose `MapCache`.
1950
- memoize.Cache = MapCache;
1951
-
1952
- /** Used as the maximum memoize cache size. */
1953
- var MAX_MEMOIZE_SIZE = 500;
1954
-
1955
- /**
1956
- * A specialized version of `_.memoize` which clears the memoized function's
1957
- * cache when it exceeds `MAX_MEMOIZE_SIZE`.
1958
- *
1959
- * @private
1960
- * @param {Function} func The function to have its output memoized.
1961
- * @returns {Function} Returns the new memoized function.
1962
- */
1963
- function memoizeCapped(func) {
1964
- var result = memoize(func, function(key) {
1965
- if (cache.size === MAX_MEMOIZE_SIZE) {
1966
- cache.clear();
1967
- }
1968
- return key;
1969
- });
1970
-
1971
- var cache = result.cache;
1972
- return result;
1973
- }
1974
-
1975
- /** Used to match property names within property paths. */
1976
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1977
-
1978
- /** Used to match backslashes in property paths. */
1979
- var reEscapeChar = /\\(\\)?/g;
1980
-
1981
- /**
1982
- * Converts `string` to a property path array.
1983
- *
1984
- * @private
1985
- * @param {string} string The string to convert.
1986
- * @returns {Array} Returns the property path array.
1987
- */
1988
- var stringToPath = memoizeCapped(function(string) {
1989
- var result = [];
1990
- if (string.charCodeAt(0) === 46 /* . */) {
1991
- result.push('');
1992
- }
1993
- string.replace(rePropName, function(match, number, quote, subString) {
1994
- result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
1995
- });
1996
- return result;
1997
- });
1998
-
1999
- /**
2000
- * Converts `value` to a string. An empty string is returned for `null`
2001
- * and `undefined` values. The sign of `-0` is preserved.
2002
- *
2003
- * @static
2004
- * @memberOf _
2005
- * @since 4.0.0
2006
- * @category Lang
2007
- * @param {*} value The value to convert.
2008
- * @returns {string} Returns the converted string.
2009
- * @example
2010
- *
2011
- * _.toString(null);
2012
- * // => ''
2013
- *
2014
- * _.toString(-0);
2015
- * // => '-0'
2016
- *
2017
- * _.toString([1, 2, 3]);
2018
- * // => '1,2,3'
2019
- */
2020
- function toString(value) {
2021
- return value == null ? '' : baseToString(value);
2022
- }
2023
-
2024
- /**
2025
- * Casts `value` to a path array if it's not one.
2026
- *
2027
- * @private
2028
- * @param {*} value The value to inspect.
2029
- * @param {Object} [object] The object to query keys on.
2030
- * @returns {Array} Returns the cast property path array.
2031
- */
2032
- function castPath(value, object) {
2033
- if (isArray(value)) {
2034
- return value;
2035
- }
2036
- return isKey(value, object) ? [value] : stringToPath(toString(value));
2037
- }
2038
-
2039
- /**
2040
- * Converts `value` to a string key if it's not a string or symbol.
2041
- *
2042
- * @private
2043
- * @param {*} value The value to inspect.
2044
- * @returns {string|symbol} Returns the key.
2045
- */
2046
- function toKey(value) {
2047
- if (typeof value == 'string' || isSymbol(value)) {
2048
- return value;
2049
- }
2050
- var result = (value + '');
2051
- return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
2052
- }
2053
-
2054
- /**
2055
- * The base implementation of `_.get` without support for default values.
2056
- *
2057
- * @private
2058
- * @param {Object} object The object to query.
2059
- * @param {Array|string} path The path of the property to get.
2060
- * @returns {*} Returns the resolved value.
2061
- */
2062
- function baseGet(object, path) {
2063
- path = castPath(path, object);
2064
-
2065
- var index = 0,
2066
- length = path.length;
2067
-
2068
- while (object != null && index < length) {
2069
- object = object[toKey(path[index++])];
2070
- }
2071
- return (index && index == length) ? object : undefined;
2072
- }
2073
-
2074
- /**
2075
- * Gets the value at `path` of `object`. If the resolved value is
2076
- * `undefined`, the `defaultValue` is returned in its place.
2077
- *
2078
- * @static
2079
- * @memberOf _
2080
- * @since 3.7.0
2081
- * @category Object
2082
- * @param {Object} object The object to query.
2083
- * @param {Array|string} path The path of the property to get.
2084
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
2085
- * @returns {*} Returns the resolved value.
2086
- * @example
2087
- *
2088
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2089
- *
2090
- * _.get(object, 'a[0].b.c');
2091
- * // => 3
2092
- *
2093
- * _.get(object, ['a', '0', 'b', 'c']);
2094
- * // => 3
2095
- *
2096
- * _.get(object, 'a.b.c', 'default');
2097
- * // => 'default'
2098
- */
2099
- function get(object, path, defaultValue) {
2100
- var result = object == null ? undefined : baseGet(object, path);
2101
- return result === undefined ? defaultValue : result;
2102
- }
2103
-
2104
- /**
2105
- * Appends the elements of `values` to `array`.
2106
- *
2107
- * @private
2108
- * @param {Array} array The array to modify.
2109
- * @param {Array} values The values to append.
2110
- * @returns {Array} Returns `array`.
2111
- */
2112
- function arrayPush(array, values) {
2113
- var index = -1,
2114
- length = values.length,
2115
- offset = array.length;
2116
-
2117
- while (++index < length) {
2118
- array[offset + index] = values[index];
2119
- }
2120
- return array;
2121
- }
2122
-
2123
- /** Built-in value references. */
2124
- var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
2125
-
2126
- /**
2127
- * Checks if `value` is a flattenable `arguments` object or array.
2128
- *
2129
- * @private
2130
- * @param {*} value The value to check.
2131
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
2132
- */
2133
- function isFlattenable(value) {
2134
- return isArray(value) || isArguments(value) ||
2135
- !!(spreadableSymbol && value && value[spreadableSymbol]);
2136
- }
2137
-
2138
- /**
2139
- * The base implementation of `_.flatten` with support for restricting flattening.
2140
- *
2141
- * @private
2142
- * @param {Array} array The array to flatten.
2143
- * @param {number} depth The maximum recursion depth.
2144
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2145
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2146
- * @param {Array} [result=[]] The initial result value.
2147
- * @returns {Array} Returns the new flattened array.
2148
- */
2149
- function baseFlatten(array, depth, predicate, isStrict, result) {
2150
- var index = -1,
2151
- length = array.length;
2152
-
2153
- predicate || (predicate = isFlattenable);
2154
- result || (result = []);
2155
-
2156
- while (++index < length) {
2157
- var value = array[index];
2158
- if (predicate(value)) {
2159
- {
2160
- arrayPush(result, value);
2161
- }
2162
- } else if (!isStrict) {
2163
- result[result.length] = value;
2164
- }
2165
- }
2166
- return result;
2167
- }
2168
-
2169
- /**
2170
- * Flattens `array` a single level deep.
2171
- *
2172
- * @static
2173
- * @memberOf _
2174
- * @since 0.1.0
2175
- * @category Array
2176
- * @param {Array} array The array to flatten.
2177
- * @returns {Array} Returns the new flattened array.
2178
- * @example
2179
- *
2180
- * _.flatten([1, [2, [3, [4]], 5]]);
2181
- * // => [1, 2, [3, [4]], 5]
2182
- */
2183
- function flatten(array) {
2184
- var length = array == null ? 0 : array.length;
2185
- return length ? baseFlatten(array) : [];
2186
- }
2187
-
2188
- /**
2189
- * A specialized version of `baseRest` which flattens the rest array.
2190
- *
2191
- * @private
2192
- * @param {Function} func The function to apply a rest parameter to.
2193
- * @returns {Function} Returns the new function.
2194
- */
2195
- function flatRest(func) {
2196
- return setToString(overRest(func, undefined, flatten), func + '');
2197
- }
2198
-
2199
- /** Built-in value references. */
2200
- var getPrototype = overArg(Object.getPrototypeOf, Object);
2201
-
2202
- /** `Object#toString` result references. */
2203
- var objectTag$3 = '[object Object]';
2204
-
2205
- /** Used for built-in method references. */
2206
- var funcProto = Function.prototype,
2207
- objectProto$7 = Object.prototype;
2208
-
2209
- /** Used to resolve the decompiled source of functions. */
2210
- var funcToString = funcProto.toString;
2211
-
2212
- /** Used to check objects for own properties. */
2213
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
2214
-
2215
- /** Used to infer the `Object` constructor. */
2216
- var objectCtorString = funcToString.call(Object);
2217
-
2218
- /**
2219
- * Checks if `value` is a plain object, that is, an object created by the
2220
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
2221
- *
2222
- * @static
2223
- * @memberOf _
2224
- * @since 0.8.0
2225
- * @category Lang
2226
- * @param {*} value The value to check.
2227
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
2228
- * @example
2229
- *
2230
- * function Foo() {
2231
- * this.a = 1;
2232
- * }
2233
- *
2234
- * _.isPlainObject(new Foo);
2235
- * // => false
2236
- *
2237
- * _.isPlainObject([1, 2, 3]);
2238
- * // => false
2239
- *
2240
- * _.isPlainObject({ 'x': 0, 'y': 0 });
2241
- * // => true
2242
- *
2243
- * _.isPlainObject(Object.create(null));
2244
- * // => true
2245
- */
2246
- function isPlainObject(value) {
2247
- if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
2248
- return false;
2249
- }
2250
- var proto = getPrototype(value);
2251
- if (proto === null) {
2252
- return true;
2253
- }
2254
- var Ctor = hasOwnProperty$6.call(proto, 'constructor') && proto.constructor;
2255
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
2256
- funcToString.call(Ctor) == objectCtorString;
2257
- }
2258
-
2259
- /**
2260
- * The base implementation of `_.slice` without an iteratee call guard.
2261
- *
2262
- * @private
2263
- * @param {Array} array The array to slice.
2264
- * @param {number} [start=0] The start position.
2265
- * @param {number} [end=array.length] The end position.
2266
- * @returns {Array} Returns the slice of `array`.
2267
- */
2268
- function baseSlice(array, start, end) {
2269
- var index = -1,
2270
- length = array.length;
2271
-
2272
- if (start < 0) {
2273
- start = -start > length ? 0 : (length + start);
2274
- }
2275
- end = end > length ? length : end;
2276
- if (end < 0) {
2277
- end += length;
2278
- }
2279
- length = start > end ? 0 : ((end - start) >>> 0);
2280
- start >>>= 0;
2281
-
2282
- var result = Array(length);
2283
- while (++index < length) {
2284
- result[index] = array[index + start];
2285
- }
2286
- return result;
2287
- }
2288
-
2289
- /**
2290
- * Removes all key-value entries from the stack.
2291
- *
2292
- * @private
2293
- * @name clear
2294
- * @memberOf Stack
2295
- */
2296
- function stackClear() {
2297
- this.__data__ = new ListCache;
2298
- this.size = 0;
2299
- }
2300
-
2301
- /**
2302
- * Removes `key` and its value from the stack.
2303
- *
2304
- * @private
2305
- * @name delete
2306
- * @memberOf Stack
2307
- * @param {string} key The key of the value to remove.
2308
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2309
- */
2310
- function stackDelete(key) {
2311
- var data = this.__data__,
2312
- result = data['delete'](key);
2313
-
2314
- this.size = data.size;
2315
- return result;
2316
- }
2317
-
2318
- /**
2319
- * Gets the stack value for `key`.
2320
- *
2321
- * @private
2322
- * @name get
2323
- * @memberOf Stack
2324
- * @param {string} key The key of the value to get.
2325
- * @returns {*} Returns the entry value.
2326
- */
2327
- function stackGet(key) {
2328
- return this.__data__.get(key);
2329
- }
2330
-
2331
- /**
2332
- * Checks if a stack value for `key` exists.
2333
- *
2334
- * @private
2335
- * @name has
2336
- * @memberOf Stack
2337
- * @param {string} key The key of the entry to check.
2338
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2339
- */
2340
- function stackHas(key) {
2341
- return this.__data__.has(key);
2342
- }
2343
-
2344
- /** Used as the size to enable large array optimizations. */
2345
- var LARGE_ARRAY_SIZE$1 = 200;
2346
-
2347
- /**
2348
- * Sets the stack `key` to `value`.
2349
- *
2350
- * @private
2351
- * @name set
2352
- * @memberOf Stack
2353
- * @param {string} key The key of the value to set.
2354
- * @param {*} value The value to set.
2355
- * @returns {Object} Returns the stack cache instance.
2356
- */
2357
- function stackSet(key, value) {
2358
- var data = this.__data__;
2359
- if (data instanceof ListCache) {
2360
- var pairs = data.__data__;
2361
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE$1 - 1)) {
2362
- pairs.push([key, value]);
2363
- this.size = ++data.size;
2364
- return this;
2365
- }
2366
- data = this.__data__ = new MapCache(pairs);
2367
- }
2368
- data.set(key, value);
2369
- this.size = data.size;
2370
- return this;
2371
- }
2372
-
2373
- /**
2374
- * Creates a stack cache object to store key-value pairs.
2375
- *
2376
- * @private
2377
- * @constructor
2378
- * @param {Array} [entries] The key-value pairs to cache.
2379
- */
2380
- function Stack(entries) {
2381
- var data = this.__data__ = new ListCache(entries);
2382
- this.size = data.size;
2383
- }
2384
-
2385
- // Add methods to `Stack`.
2386
- Stack.prototype.clear = stackClear;
2387
- Stack.prototype['delete'] = stackDelete;
2388
- Stack.prototype.get = stackGet;
2389
- Stack.prototype.has = stackHas;
2390
- Stack.prototype.set = stackSet;
2391
-
2392
- /**
2393
- * The base implementation of `_.assign` without support for multiple sources
2394
- * or `customizer` functions.
2395
- *
2396
- * @private
2397
- * @param {Object} object The destination object.
2398
- * @param {Object} source The source object.
2399
- * @returns {Object} Returns `object`.
2400
- */
2401
- function baseAssign(object, source) {
2402
- return object && copyObject(source, keys(source), object);
2403
- }
2404
-
2405
- /**
2406
- * The base implementation of `_.assignIn` without support for multiple sources
2407
- * or `customizer` functions.
2408
- *
2409
- * @private
2410
- * @param {Object} object The destination object.
2411
- * @param {Object} source The source object.
2412
- * @returns {Object} Returns `object`.
2413
- */
2414
- function baseAssignIn(object, source) {
2415
- return object && copyObject(source, keysIn(source), object);
2416
- }
2417
-
2418
- /** Detect free variable `exports`. */
2419
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
2420
-
2421
- /** Detect free variable `module`. */
2422
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
2423
-
2424
- /** Detect the popular CommonJS extension `module.exports`. */
2425
- var moduleExports = freeModule && freeModule.exports === freeExports;
2426
-
2427
- /** Built-in value references. */
2428
- var Buffer = moduleExports ? root.Buffer : undefined,
2429
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
2430
-
2431
- /**
2432
- * Creates a clone of `buffer`.
2433
- *
2434
- * @private
2435
- * @param {Buffer} buffer The buffer to clone.
2436
- * @param {boolean} [isDeep] Specify a deep clone.
2437
- * @returns {Buffer} Returns the cloned buffer.
2438
- */
2439
- function cloneBuffer(buffer, isDeep) {
2440
- if (isDeep) {
2441
- return buffer.slice();
2442
- }
2443
- var length = buffer.length,
2444
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2445
-
2446
- buffer.copy(result);
2447
- return result;
2448
- }
2449
-
2450
- /**
2451
- * A specialized version of `_.filter` for arrays without support for
2452
- * iteratee shorthands.
2453
- *
2454
- * @private
2455
- * @param {Array} [array] The array to iterate over.
2456
- * @param {Function} predicate The function invoked per iteration.
2457
- * @returns {Array} Returns the new filtered array.
2458
- */
2459
- function arrayFilter(array, predicate) {
2460
- var index = -1,
2461
- length = array == null ? 0 : array.length,
2462
- resIndex = 0,
2463
- result = [];
2464
-
2465
- while (++index < length) {
2466
- var value = array[index];
2467
- if (predicate(value, index, array)) {
2468
- result[resIndex++] = value;
2469
- }
2470
- }
2471
- return result;
2472
- }
2473
-
2474
- /**
2475
- * This method returns a new empty array.
2476
- *
2477
- * @static
2478
- * @memberOf _
2479
- * @since 4.13.0
2480
- * @category Util
2481
- * @returns {Array} Returns the new empty array.
2482
- * @example
2483
- *
2484
- * var arrays = _.times(2, _.stubArray);
2485
- *
2486
- * console.log(arrays);
2487
- * // => [[], []]
2488
- *
2489
- * console.log(arrays[0] === arrays[1]);
2490
- * // => false
2491
- */
2492
- function stubArray() {
2493
- return [];
2494
- }
2495
-
2496
- /** Used for built-in method references. */
2497
- var objectProto$6 = Object.prototype;
2498
-
2499
- /** Built-in value references. */
2500
- var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
2501
-
2502
- /* Built-in method references for those with the same name as other `lodash` methods. */
2503
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2504
-
2505
- /**
2506
- * Creates an array of the own enumerable symbols of `object`.
2507
- *
2508
- * @private
2509
- * @param {Object} object The object to query.
2510
- * @returns {Array} Returns the array of symbols.
2511
- */
2512
- var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
2513
- if (object == null) {
2514
- return [];
2515
- }
2516
- object = Object(object);
2517
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2518
- return propertyIsEnumerable.call(object, symbol);
2519
- });
2520
- };
2521
-
2522
- /**
2523
- * Copies own symbols of `source` to `object`.
2524
- *
2525
- * @private
2526
- * @param {Object} source The object to copy symbols from.
2527
- * @param {Object} [object={}] The object to copy symbols to.
2528
- * @returns {Object} Returns `object`.
2529
- */
2530
- function copySymbols(source, object) {
2531
- return copyObject(source, getSymbols(source), object);
2532
- }
2533
-
2534
- /* Built-in method references for those with the same name as other `lodash` methods. */
2535
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2536
-
2537
- /**
2538
- * Creates an array of the own and inherited enumerable symbols of `object`.
2539
- *
2540
- * @private
2541
- * @param {Object} object The object to query.
2542
- * @returns {Array} Returns the array of symbols.
2543
- */
2544
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
2545
- var result = [];
2546
- while (object) {
2547
- arrayPush(result, getSymbols(object));
2548
- object = getPrototype(object);
2549
- }
2550
- return result;
2551
- };
2552
-
2553
- /**
2554
- * Copies own and inherited symbols of `source` to `object`.
2555
- *
2556
- * @private
2557
- * @param {Object} source The object to copy symbols from.
2558
- * @param {Object} [object={}] The object to copy symbols to.
2559
- * @returns {Object} Returns `object`.
2560
- */
2561
- function copySymbolsIn(source, object) {
2562
- return copyObject(source, getSymbolsIn(source), object);
2563
- }
2564
-
2565
- /**
2566
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2567
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2568
- * symbols of `object`.
2569
- *
2570
- * @private
2571
- * @param {Object} object The object to query.
2572
- * @param {Function} keysFunc The function to get the keys of `object`.
2573
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
2574
- * @returns {Array} Returns the array of property names and symbols.
2575
- */
2576
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
2577
- var result = keysFunc(object);
2578
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
2579
- }
2580
-
2581
- /**
2582
- * Creates an array of own enumerable property names and symbols of `object`.
2583
- *
2584
- * @private
2585
- * @param {Object} object The object to query.
2586
- * @returns {Array} Returns the array of property names and symbols.
2587
- */
2588
- function getAllKeys(object) {
2589
- return baseGetAllKeys(object, keys, getSymbols);
2590
- }
2591
-
2592
- /**
2593
- * Creates an array of own and inherited enumerable property names and
2594
- * symbols of `object`.
2595
- *
2596
- * @private
2597
- * @param {Object} object The object to query.
2598
- * @returns {Array} Returns the array of property names and symbols.
2599
- */
2600
- function getAllKeysIn(object) {
2601
- return baseGetAllKeys(object, keysIn, getSymbolsIn);
2602
- }
2603
-
2604
- /* Built-in method references that are verified to be native. */
2605
- var DataView = getNative(root, 'DataView');
2606
-
2607
- /* Built-in method references that are verified to be native. */
2608
- var Promise$1 = getNative(root, 'Promise');
2609
-
2610
- /* Built-in method references that are verified to be native. */
2611
- var Set = getNative(root, 'Set');
2612
-
2613
- /** `Object#toString` result references. */
2614
- var mapTag$5 = '[object Map]',
2615
- objectTag$2 = '[object Object]',
2616
- promiseTag = '[object Promise]',
2617
- setTag$5 = '[object Set]',
2618
- weakMapTag$1 = '[object WeakMap]';
2619
-
2620
- var dataViewTag$3 = '[object DataView]';
2621
-
2622
- /** Used to detect maps, sets, and weakmaps. */
2623
- var dataViewCtorString = toSource(DataView),
2624
- mapCtorString = toSource(Map),
2625
- promiseCtorString = toSource(Promise$1),
2626
- setCtorString = toSource(Set),
2627
- weakMapCtorString = toSource(WeakMap);
2628
-
2629
- /**
2630
- * Gets the `toStringTag` of `value`.
2631
- *
2632
- * @private
2633
- * @param {*} value The value to query.
2634
- * @returns {string} Returns the `toStringTag`.
2635
- */
2636
- var getTag = baseGetTag;
2637
-
2638
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2639
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3) ||
2640
- (Map && getTag(new Map) != mapTag$5) ||
2641
- (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
2642
- (Set && getTag(new Set) != setTag$5) ||
2643
- (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
2644
- getTag = function(value) {
2645
- var result = baseGetTag(value),
2646
- Ctor = result == objectTag$2 ? value.constructor : undefined,
2647
- ctorString = Ctor ? toSource(Ctor) : '';
2648
-
2649
- if (ctorString) {
2650
- switch (ctorString) {
2651
- case dataViewCtorString: return dataViewTag$3;
2652
- case mapCtorString: return mapTag$5;
2653
- case promiseCtorString: return promiseTag;
2654
- case setCtorString: return setTag$5;
2655
- case weakMapCtorString: return weakMapTag$1;
2656
- }
2657
- }
2658
- return result;
2659
- };
2660
- }
2661
-
2662
- /** Used for built-in method references. */
2663
- var objectProto$5 = Object.prototype;
2664
-
2665
- /** Used to check objects for own properties. */
2666
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
2667
-
2668
- /**
2669
- * Initializes an array clone.
2670
- *
2671
- * @private
2672
- * @param {Array} array The array to clone.
2673
- * @returns {Array} Returns the initialized clone.
2674
- */
2675
- function initCloneArray(array) {
2676
- var length = array.length,
2677
- result = new array.constructor(length);
2678
-
2679
- // Add properties assigned by `RegExp#exec`.
2680
- if (length && typeof array[0] == 'string' && hasOwnProperty$5.call(array, 'index')) {
2681
- result.index = array.index;
2682
- result.input = array.input;
2683
- }
2684
- return result;
2685
- }
2686
-
2687
- /** Built-in value references. */
2688
- var Uint8Array = root.Uint8Array;
2689
-
2690
- /**
2691
- * Creates a clone of `arrayBuffer`.
2692
- *
2693
- * @private
2694
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2695
- * @returns {ArrayBuffer} Returns the cloned array buffer.
2696
- */
2697
- function cloneArrayBuffer(arrayBuffer) {
2698
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2699
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2700
- return result;
2701
- }
2702
-
2703
- /**
2704
- * Creates a clone of `dataView`.
2705
- *
2706
- * @private
2707
- * @param {Object} dataView The data view to clone.
2708
- * @param {boolean} [isDeep] Specify a deep clone.
2709
- * @returns {Object} Returns the cloned data view.
2710
- */
2711
- function cloneDataView(dataView, isDeep) {
2712
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
2713
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2714
- }
2715
-
2716
- /** Used to match `RegExp` flags from their coerced string values. */
2717
- var reFlags = /\w*$/;
2718
-
2719
- /**
2720
- * Creates a clone of `regexp`.
2721
- *
2722
- * @private
2723
- * @param {Object} regexp The regexp to clone.
2724
- * @returns {Object} Returns the cloned regexp.
2725
- */
2726
- function cloneRegExp(regexp) {
2727
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2728
- result.lastIndex = regexp.lastIndex;
2729
- return result;
2730
- }
2731
-
2732
- /** Used to convert symbols to primitives and strings. */
2733
- var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
2734
- symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
2735
-
2736
- /**
2737
- * Creates a clone of the `symbol` object.
2738
- *
2739
- * @private
2740
- * @param {Object} symbol The symbol object to clone.
2741
- * @returns {Object} Returns the cloned symbol object.
2742
- */
2743
- function cloneSymbol(symbol) {
2744
- return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
2745
- }
2746
-
2747
- /**
2748
- * Creates a clone of `typedArray`.
2749
- *
2750
- * @private
2751
- * @param {Object} typedArray The typed array to clone.
2752
- * @param {boolean} [isDeep] Specify a deep clone.
2753
- * @returns {Object} Returns the cloned typed array.
2754
- */
2755
- function cloneTypedArray(typedArray, isDeep) {
2756
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
2757
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2758
- }
2759
-
2760
- /** `Object#toString` result references. */
2761
- var boolTag$2 = '[object Boolean]',
2762
- dateTag$2 = '[object Date]',
2763
- mapTag$4 = '[object Map]',
2764
- numberTag$2 = '[object Number]',
2765
- regexpTag$2 = '[object RegExp]',
2766
- setTag$4 = '[object Set]',
2767
- stringTag$2 = '[object String]',
2768
- symbolTag$2 = '[object Symbol]';
2769
-
2770
- var arrayBufferTag$2 = '[object ArrayBuffer]',
2771
- dataViewTag$2 = '[object DataView]',
2772
- float32Tag$1 = '[object Float32Array]',
2773
- float64Tag$1 = '[object Float64Array]',
2774
- int8Tag$1 = '[object Int8Array]',
2775
- int16Tag$1 = '[object Int16Array]',
2776
- int32Tag$1 = '[object Int32Array]',
2777
- uint8Tag$1 = '[object Uint8Array]',
2778
- uint8ClampedTag$1 = '[object Uint8ClampedArray]',
2779
- uint16Tag$1 = '[object Uint16Array]',
2780
- uint32Tag$1 = '[object Uint32Array]';
2781
-
2782
- /**
2783
- * Initializes an object clone based on its `toStringTag`.
2784
- *
2785
- * **Note:** This function only supports cloning values with tags of
2786
- * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
2787
- *
2788
- * @private
2789
- * @param {Object} object The object to clone.
2790
- * @param {string} tag The `toStringTag` of the object to clone.
2791
- * @param {boolean} [isDeep] Specify a deep clone.
2792
- * @returns {Object} Returns the initialized clone.
2793
- */
2794
- function initCloneByTag(object, tag, isDeep) {
2795
- var Ctor = object.constructor;
2796
- switch (tag) {
2797
- case arrayBufferTag$2:
2798
- return cloneArrayBuffer(object);
2799
-
2800
- case boolTag$2:
2801
- case dateTag$2:
2802
- return new Ctor(+object);
2803
-
2804
- case dataViewTag$2:
2805
- return cloneDataView(object, isDeep);
2806
-
2807
- case float32Tag$1: case float64Tag$1:
2808
- case int8Tag$1: case int16Tag$1: case int32Tag$1:
2809
- case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
2810
- return cloneTypedArray(object, isDeep);
2811
-
2812
- case mapTag$4:
2813
- return new Ctor;
2814
-
2815
- case numberTag$2:
2816
- case stringTag$2:
2817
- return new Ctor(object);
2818
-
2819
- case regexpTag$2:
2820
- return cloneRegExp(object);
2821
-
2822
- case setTag$4:
2823
- return new Ctor;
2824
-
2825
- case symbolTag$2:
2826
- return cloneSymbol(object);
2827
- }
2828
- }
2829
-
2830
- /**
2831
- * Initializes an object clone.
2832
- *
2833
- * @private
2834
- * @param {Object} object The object to clone.
2835
- * @returns {Object} Returns the initialized clone.
2836
- */
2837
- function initCloneObject(object) {
2838
- return (typeof object.constructor == 'function' && !isPrototype(object))
2839
- ? baseCreate(getPrototype(object))
2840
- : {};
2841
- }
2842
-
2843
- /** `Object#toString` result references. */
2844
- var mapTag$3 = '[object Map]';
2845
-
2846
- /**
2847
- * The base implementation of `_.isMap` without Node.js optimizations.
2848
- *
2849
- * @private
2850
- * @param {*} value The value to check.
2851
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
2852
- */
2853
- function baseIsMap(value) {
2854
- return isObjectLike(value) && getTag(value) == mapTag$3;
2855
- }
2856
-
2857
- /* Node.js helper references. */
2858
- var nodeIsMap = nodeUtil && nodeUtil.isMap;
2859
-
2860
- /**
2861
- * Checks if `value` is classified as a `Map` object.
2862
- *
2863
- * @static
2864
- * @memberOf _
2865
- * @since 4.3.0
2866
- * @category Lang
2867
- * @param {*} value The value to check.
2868
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
2869
- * @example
2870
- *
2871
- * _.isMap(new Map);
2872
- * // => true
2873
- *
2874
- * _.isMap(new WeakMap);
2875
- * // => false
2876
- */
2877
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
2878
-
2879
- /** `Object#toString` result references. */
2880
- var setTag$3 = '[object Set]';
2881
-
2882
- /**
2883
- * The base implementation of `_.isSet` without Node.js optimizations.
2884
- *
2885
- * @private
2886
- * @param {*} value The value to check.
2887
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
2888
- */
2889
- function baseIsSet(value) {
2890
- return isObjectLike(value) && getTag(value) == setTag$3;
2891
- }
2892
-
2893
- /* Node.js helper references. */
2894
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
2895
-
2896
- /**
2897
- * Checks if `value` is classified as a `Set` object.
2898
- *
2899
- * @static
2900
- * @memberOf _
2901
- * @since 4.3.0
2902
- * @category Lang
2903
- * @param {*} value The value to check.
2904
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
2905
- * @example
2906
- *
2907
- * _.isSet(new Set);
2908
- * // => true
2909
- *
2910
- * _.isSet(new WeakSet);
2911
- * // => false
2912
- */
2913
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
2914
-
2915
- /** Used to compose bitmasks for cloning. */
2916
- var CLONE_DEEP_FLAG$2 = 1,
2917
- CLONE_FLAT_FLAG$1 = 2,
2918
- CLONE_SYMBOLS_FLAG$2 = 4;
2919
-
2920
- /** `Object#toString` result references. */
2921
- var argsTag$1 = '[object Arguments]',
2922
- arrayTag$1 = '[object Array]',
2923
- boolTag$1 = '[object Boolean]',
2924
- dateTag$1 = '[object Date]',
2925
- errorTag$1 = '[object Error]',
2926
- funcTag = '[object Function]',
2927
- genTag = '[object GeneratorFunction]',
2928
- mapTag$2 = '[object Map]',
2929
- numberTag$1 = '[object Number]',
2930
- objectTag$1 = '[object Object]',
2931
- regexpTag$1 = '[object RegExp]',
2932
- setTag$2 = '[object Set]',
2933
- stringTag$1 = '[object String]',
2934
- symbolTag$1 = '[object Symbol]',
2935
- weakMapTag = '[object WeakMap]';
2936
-
2937
- var arrayBufferTag$1 = '[object ArrayBuffer]',
2938
- dataViewTag$1 = '[object DataView]',
2939
- float32Tag = '[object Float32Array]',
2940
- float64Tag = '[object Float64Array]',
2941
- int8Tag = '[object Int8Array]',
2942
- int16Tag = '[object Int16Array]',
2943
- int32Tag = '[object Int32Array]',
2944
- uint8Tag = '[object Uint8Array]',
2945
- uint8ClampedTag = '[object Uint8ClampedArray]',
2946
- uint16Tag = '[object Uint16Array]',
2947
- uint32Tag = '[object Uint32Array]';
2948
-
2949
- /** Used to identify `toStringTag` values supported by `_.clone`. */
2950
- var cloneableTags = {};
2951
- cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] =
2952
- cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] =
2953
- cloneableTags[boolTag$1] = cloneableTags[dateTag$1] =
2954
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
2955
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
2956
- cloneableTags[int32Tag] = cloneableTags[mapTag$2] =
2957
- cloneableTags[numberTag$1] = cloneableTags[objectTag$1] =
2958
- cloneableTags[regexpTag$1] = cloneableTags[setTag$2] =
2959
- cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] =
2960
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
2961
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
2962
- cloneableTags[errorTag$1] = cloneableTags[funcTag] =
2963
- cloneableTags[weakMapTag] = false;
2964
-
2965
- /**
2966
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
2967
- * traversed objects.
2968
- *
2969
- * @private
2970
- * @param {*} value The value to clone.
2971
- * @param {boolean} bitmask The bitmask flags.
2972
- * 1 - Deep clone
2973
- * 2 - Flatten inherited properties
2974
- * 4 - Clone symbols
2975
- * @param {Function} [customizer] The function to customize cloning.
2976
- * @param {string} [key] The key of `value`.
2977
- * @param {Object} [object] The parent object of `value`.
2978
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
2979
- * @returns {*} Returns the cloned value.
2980
- */
2981
- function baseClone(value, bitmask, customizer, key, object, stack) {
2982
- var result,
2983
- isDeep = bitmask & CLONE_DEEP_FLAG$2,
2984
- isFlat = bitmask & CLONE_FLAT_FLAG$1,
2985
- isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
2986
-
2987
- if (customizer) {
2988
- result = object ? customizer(value, key, object, stack) : customizer(value);
2989
- }
2990
- if (result !== undefined) {
2991
- return result;
2992
- }
2993
- if (!isObject(value)) {
2994
- return value;
2995
- }
2996
- var isArr = isArray(value);
2997
- if (isArr) {
2998
- result = initCloneArray(value);
2999
- if (!isDeep) {
3000
- return copyArray(value, result);
3001
- }
3002
- } else {
3003
- var tag = getTag(value),
3004
- isFunc = tag == funcTag || tag == genTag;
3005
-
3006
- if (isBuffer(value)) {
3007
- return cloneBuffer(value, isDeep);
3008
- }
3009
- if (tag == objectTag$1 || tag == argsTag$1 || (isFunc && !object)) {
3010
- result = (isFlat || isFunc) ? {} : initCloneObject(value);
3011
- if (!isDeep) {
3012
- return isFlat
3013
- ? copySymbolsIn(value, baseAssignIn(result, value))
3014
- : copySymbols(value, baseAssign(result, value));
3015
- }
3016
- } else {
3017
- if (!cloneableTags[tag]) {
3018
- return object ? value : {};
3019
- }
3020
- result = initCloneByTag(value, tag, isDeep);
3021
- }
3022
- }
3023
- // Check for circular references and return its corresponding clone.
3024
- stack || (stack = new Stack);
3025
- var stacked = stack.get(value);
3026
- if (stacked) {
3027
- return stacked;
3028
- }
3029
- stack.set(value, result);
3030
-
3031
- if (isSet(value)) {
3032
- value.forEach(function(subValue) {
3033
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
3034
- });
3035
- } else if (isMap(value)) {
3036
- value.forEach(function(subValue, key) {
3037
- result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
3038
- });
3039
- }
3040
-
3041
- var keysFunc = isFull
3042
- ? (isFlat ? getAllKeysIn : getAllKeys)
3043
- : (isFlat ? keysIn : keys);
3044
-
3045
- var props = isArr ? undefined : keysFunc(value);
3046
- arrayEach(props || value, function(subValue, key) {
3047
- if (props) {
3048
- key = subValue;
3049
- subValue = value[key];
3050
- }
3051
- // Recursively populate clone (susceptible to call stack limits).
3052
- assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
3053
- });
3054
- return result;
3055
- }
3056
-
3057
- /** Used to compose bitmasks for cloning. */
3058
- var CLONE_DEEP_FLAG$1 = 1,
3059
- CLONE_SYMBOLS_FLAG$1 = 4;
3060
-
3061
- /**
3062
- * This method is like `_.clone` except that it recursively clones `value`.
3063
- *
3064
- * @static
3065
- * @memberOf _
3066
- * @since 1.0.0
3067
- * @category Lang
3068
- * @param {*} value The value to recursively clone.
3069
- * @returns {*} Returns the deep cloned value.
3070
- * @see _.clone
3071
- * @example
3072
- *
3073
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
3074
- *
3075
- * var deep = _.cloneDeep(objects);
3076
- * console.log(deep[0] === objects[0]);
3077
- * // => false
3078
- */
3079
- function cloneDeep(value) {
3080
- return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
3081
- }
3082
-
3083
- /** Used to stand-in for `undefined` hash values. */
3084
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
3085
-
3086
- /**
3087
- * Adds `value` to the array cache.
3088
- *
3089
- * @private
3090
- * @name add
3091
- * @memberOf SetCache
3092
- * @alias push
3093
- * @param {*} value The value to cache.
3094
- * @returns {Object} Returns the cache instance.
3095
- */
3096
- function setCacheAdd(value) {
3097
- this.__data__.set(value, HASH_UNDEFINED);
3098
- return this;
3099
- }
3100
-
3101
- /**
3102
- * Checks if `value` is in the array cache.
3103
- *
3104
- * @private
3105
- * @name has
3106
- * @memberOf SetCache
3107
- * @param {*} value The value to search for.
3108
- * @returns {boolean} Returns `true` if `value` is found, else `false`.
3109
- */
3110
- function setCacheHas(value) {
3111
- return this.__data__.has(value);
3112
- }
3113
-
3114
- /**
3115
- *
3116
- * Creates an array cache object to store unique values.
3117
- *
3118
- * @private
3119
- * @constructor
3120
- * @param {Array} [values] The values to cache.
3121
- */
3122
- function SetCache(values) {
3123
- var index = -1,
3124
- length = values == null ? 0 : values.length;
3125
-
3126
- this.__data__ = new MapCache;
3127
- while (++index < length) {
3128
- this.add(values[index]);
3129
- }
3130
- }
3131
-
3132
- // Add methods to `SetCache`.
3133
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
3134
- SetCache.prototype.has = setCacheHas;
3135
-
3136
- /**
3137
- * A specialized version of `_.some` for arrays without support for iteratee
3138
- * shorthands.
3139
- *
3140
- * @private
3141
- * @param {Array} [array] The array to iterate over.
3142
- * @param {Function} predicate The function invoked per iteration.
3143
- * @returns {boolean} Returns `true` if any element passes the predicate check,
3144
- * else `false`.
3145
- */
3146
- function arraySome(array, predicate) {
3147
- var index = -1,
3148
- length = array == null ? 0 : array.length;
3149
-
3150
- while (++index < length) {
3151
- if (predicate(array[index], index, array)) {
3152
- return true;
3153
- }
3154
- }
3155
- return false;
3156
- }
3157
-
3158
- /**
3159
- * Checks if a `cache` value for `key` exists.
3160
- *
3161
- * @private
3162
- * @param {Object} cache The cache to query.
3163
- * @param {string} key The key of the entry to check.
3164
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3165
- */
3166
- function cacheHas(cache, key) {
3167
- return cache.has(key);
3168
- }
3169
-
3170
- /** Used to compose bitmasks for value comparisons. */
3171
- var COMPARE_PARTIAL_FLAG$5 = 1,
3172
- COMPARE_UNORDERED_FLAG$3 = 2;
3173
-
3174
- /**
3175
- * A specialized version of `baseIsEqualDeep` for arrays with support for
3176
- * partial deep comparisons.
3177
- *
3178
- * @private
3179
- * @param {Array} array The array to compare.
3180
- * @param {Array} other The other array to compare.
3181
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3182
- * @param {Function} customizer The function to customize comparisons.
3183
- * @param {Function} equalFunc The function to determine equivalents of values.
3184
- * @param {Object} stack Tracks traversed `array` and `other` objects.
3185
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
3186
- */
3187
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
3188
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
3189
- arrLength = array.length,
3190
- othLength = other.length;
3191
-
3192
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
3193
- return false;
3194
- }
3195
- // Check that cyclic values are equal.
3196
- var arrStacked = stack.get(array);
3197
- var othStacked = stack.get(other);
3198
- if (arrStacked && othStacked) {
3199
- return arrStacked == other && othStacked == array;
3200
- }
3201
- var index = -1,
3202
- result = true,
3203
- seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined;
3204
-
3205
- stack.set(array, other);
3206
- stack.set(other, array);
3207
-
3208
- // Ignore non-index properties.
3209
- while (++index < arrLength) {
3210
- var arrValue = array[index],
3211
- othValue = other[index];
3212
-
3213
- if (customizer) {
3214
- var compared = isPartial
3215
- ? customizer(othValue, arrValue, index, other, array, stack)
3216
- : customizer(arrValue, othValue, index, array, other, stack);
3217
- }
3218
- if (compared !== undefined) {
3219
- if (compared) {
3220
- continue;
3221
- }
3222
- result = false;
3223
- break;
3224
- }
3225
- // Recursively compare arrays (susceptible to call stack limits).
3226
- if (seen) {
3227
- if (!arraySome(other, function(othValue, othIndex) {
3228
- if (!cacheHas(seen, othIndex) &&
3229
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
3230
- return seen.push(othIndex);
3231
- }
3232
- })) {
3233
- result = false;
3234
- break;
3235
- }
3236
- } else if (!(
3237
- arrValue === othValue ||
3238
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
3239
- )) {
3240
- result = false;
3241
- break;
3242
- }
3243
- }
3244
- stack['delete'](array);
3245
- stack['delete'](other);
3246
- return result;
3247
- }
3248
-
3249
- /**
3250
- * Converts `map` to its key-value pairs.
3251
- *
3252
- * @private
3253
- * @param {Object} map The map to convert.
3254
- * @returns {Array} Returns the key-value pairs.
3255
- */
3256
- function mapToArray(map) {
3257
- var index = -1,
3258
- result = Array(map.size);
3259
-
3260
- map.forEach(function(value, key) {
3261
- result[++index] = [key, value];
3262
- });
3263
- return result;
3264
- }
3265
-
3266
- /**
3267
- * Converts `set` to an array of its values.
3268
- *
3269
- * @private
3270
- * @param {Object} set The set to convert.
3271
- * @returns {Array} Returns the values.
3272
- */
3273
- function setToArray(set) {
3274
- var index = -1,
3275
- result = Array(set.size);
3276
-
3277
- set.forEach(function(value) {
3278
- result[++index] = value;
3279
- });
3280
- return result;
3281
- }
3282
-
3283
- /** Used to compose bitmasks for value comparisons. */
3284
- var COMPARE_PARTIAL_FLAG$4 = 1,
3285
- COMPARE_UNORDERED_FLAG$2 = 2;
3286
-
3287
- /** `Object#toString` result references. */
3288
- var boolTag = '[object Boolean]',
3289
- dateTag = '[object Date]',
3290
- errorTag = '[object Error]',
3291
- mapTag$1 = '[object Map]',
3292
- numberTag = '[object Number]',
3293
- regexpTag = '[object RegExp]',
3294
- setTag$1 = '[object Set]',
3295
- stringTag = '[object String]',
3296
- symbolTag = '[object Symbol]';
3297
-
3298
- var arrayBufferTag = '[object ArrayBuffer]',
3299
- dataViewTag = '[object DataView]';
3300
-
3301
- /** Used to convert symbols to primitives and strings. */
3302
- var symbolProto = Symbol ? Symbol.prototype : undefined,
3303
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
3304
-
3305
- /**
3306
- * A specialized version of `baseIsEqualDeep` for comparing objects of
3307
- * the same `toStringTag`.
3308
- *
3309
- * **Note:** This function only supports comparing values with tags of
3310
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
3311
- *
3312
- * @private
3313
- * @param {Object} object The object to compare.
3314
- * @param {Object} other The other object to compare.
3315
- * @param {string} tag The `toStringTag` of the objects to compare.
3316
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3317
- * @param {Function} customizer The function to customize comparisons.
3318
- * @param {Function} equalFunc The function to determine equivalents of values.
3319
- * @param {Object} stack Tracks traversed `object` and `other` objects.
3320
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3321
- */
3322
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
3323
- switch (tag) {
3324
- case dataViewTag:
3325
- if ((object.byteLength != other.byteLength) ||
3326
- (object.byteOffset != other.byteOffset)) {
3327
- return false;
3328
- }
3329
- object = object.buffer;
3330
- other = other.buffer;
3331
-
3332
- case arrayBufferTag:
3333
- if ((object.byteLength != other.byteLength) ||
3334
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
3335
- return false;
3336
- }
3337
- return true;
3338
-
3339
- case boolTag:
3340
- case dateTag:
3341
- case numberTag:
3342
- // Coerce booleans to `1` or `0` and dates to milliseconds.
3343
- // Invalid dates are coerced to `NaN`.
3344
- return eq(+object, +other);
3345
-
3346
- case errorTag:
3347
- return object.name == other.name && object.message == other.message;
3348
-
3349
- case regexpTag:
3350
- case stringTag:
3351
- // Coerce regexes to strings and treat strings, primitives and objects,
3352
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
3353
- // for more details.
3354
- return object == (other + '');
3355
-
3356
- case mapTag$1:
3357
- var convert = mapToArray;
3358
-
3359
- case setTag$1:
3360
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
3361
- convert || (convert = setToArray);
3362
-
3363
- if (object.size != other.size && !isPartial) {
3364
- return false;
3365
- }
3366
- // Assume cyclic values are equal.
3367
- var stacked = stack.get(object);
3368
- if (stacked) {
3369
- return stacked == other;
3370
- }
3371
- bitmask |= COMPARE_UNORDERED_FLAG$2;
3372
-
3373
- // Recursively compare objects (susceptible to call stack limits).
3374
- stack.set(object, other);
3375
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
3376
- stack['delete'](object);
3377
- return result;
3378
-
3379
- case symbolTag:
3380
- if (symbolValueOf) {
3381
- return symbolValueOf.call(object) == symbolValueOf.call(other);
3382
- }
3383
- }
3384
- return false;
3385
- }
3386
-
3387
- /** Used to compose bitmasks for value comparisons. */
3388
- var COMPARE_PARTIAL_FLAG$3 = 1;
3389
-
3390
- /** Used for built-in method references. */
3391
- var objectProto$4 = Object.prototype;
3392
-
3393
- /** Used to check objects for own properties. */
3394
- var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
3395
-
3396
- /**
3397
- * A specialized version of `baseIsEqualDeep` for objects with support for
3398
- * partial deep comparisons.
3399
- *
3400
- * @private
3401
- * @param {Object} object The object to compare.
3402
- * @param {Object} other The other object to compare.
3403
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3404
- * @param {Function} customizer The function to customize comparisons.
3405
- * @param {Function} equalFunc The function to determine equivalents of values.
3406
- * @param {Object} stack Tracks traversed `object` and `other` objects.
3407
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3408
- */
3409
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
3410
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
3411
- objProps = getAllKeys(object),
3412
- objLength = objProps.length,
3413
- othProps = getAllKeys(other),
3414
- othLength = othProps.length;
3415
-
3416
- if (objLength != othLength && !isPartial) {
3417
- return false;
3418
- }
3419
- var index = objLength;
3420
- while (index--) {
3421
- var key = objProps[index];
3422
- if (!(isPartial ? key in other : hasOwnProperty$4.call(other, key))) {
3423
- return false;
3424
- }
3425
- }
3426
- // Check that cyclic values are equal.
3427
- var objStacked = stack.get(object);
3428
- var othStacked = stack.get(other);
3429
- if (objStacked && othStacked) {
3430
- return objStacked == other && othStacked == object;
3431
- }
3432
- var result = true;
3433
- stack.set(object, other);
3434
- stack.set(other, object);
3435
-
3436
- var skipCtor = isPartial;
3437
- while (++index < objLength) {
3438
- key = objProps[index];
3439
- var objValue = object[key],
3440
- othValue = other[key];
3441
-
3442
- if (customizer) {
3443
- var compared = isPartial
3444
- ? customizer(othValue, objValue, key, other, object, stack)
3445
- : customizer(objValue, othValue, key, object, other, stack);
3446
- }
3447
- // Recursively compare objects (susceptible to call stack limits).
3448
- if (!(compared === undefined
3449
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
3450
- : compared
3451
- )) {
3452
- result = false;
3453
- break;
3454
- }
3455
- skipCtor || (skipCtor = key == 'constructor');
3456
- }
3457
- if (result && !skipCtor) {
3458
- var objCtor = object.constructor,
3459
- othCtor = other.constructor;
3460
-
3461
- // Non `Object` object instances with different constructors are not equal.
3462
- if (objCtor != othCtor &&
3463
- ('constructor' in object && 'constructor' in other) &&
3464
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
3465
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
3466
- result = false;
3467
- }
3468
- }
3469
- stack['delete'](object);
3470
- stack['delete'](other);
3471
- return result;
3472
- }
3473
-
3474
- /** Used to compose bitmasks for value comparisons. */
3475
- var COMPARE_PARTIAL_FLAG$2 = 1;
3476
-
3477
- /** `Object#toString` result references. */
3478
- var argsTag = '[object Arguments]',
3479
- arrayTag = '[object Array]',
3480
- objectTag = '[object Object]';
3481
-
3482
- /** Used for built-in method references. */
3483
- var objectProto$3 = Object.prototype;
3484
-
3485
- /** Used to check objects for own properties. */
3486
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
3487
-
3488
- /**
3489
- * A specialized version of `baseIsEqual` for arrays and objects which performs
3490
- * deep comparisons and tracks traversed objects enabling objects with circular
3491
- * references to be compared.
3492
- *
3493
- * @private
3494
- * @param {Object} object The object to compare.
3495
- * @param {Object} other The other object to compare.
3496
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3497
- * @param {Function} customizer The function to customize comparisons.
3498
- * @param {Function} equalFunc The function to determine equivalents of values.
3499
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3500
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3501
- */
3502
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3503
- var objIsArr = isArray(object),
3504
- othIsArr = isArray(other),
3505
- objTag = objIsArr ? arrayTag : getTag(object),
3506
- othTag = othIsArr ? arrayTag : getTag(other);
3507
-
3508
- objTag = objTag == argsTag ? objectTag : objTag;
3509
- othTag = othTag == argsTag ? objectTag : othTag;
3510
-
3511
- var objIsObj = objTag == objectTag,
3512
- othIsObj = othTag == objectTag,
3513
- isSameTag = objTag == othTag;
3514
-
3515
- if (isSameTag && isBuffer(object)) {
3516
- if (!isBuffer(other)) {
3517
- return false;
3518
- }
3519
- objIsArr = true;
3520
- objIsObj = false;
3521
- }
3522
- if (isSameTag && !objIsObj) {
3523
- stack || (stack = new Stack);
3524
- return (objIsArr || isTypedArray(object))
3525
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3526
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3527
- }
3528
- if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
3529
- var objIsWrapped = objIsObj && hasOwnProperty$3.call(object, '__wrapped__'),
3530
- othIsWrapped = othIsObj && hasOwnProperty$3.call(other, '__wrapped__');
3531
-
3532
- if (objIsWrapped || othIsWrapped) {
3533
- var objUnwrapped = objIsWrapped ? object.value() : object,
3534
- othUnwrapped = othIsWrapped ? other.value() : other;
3535
-
3536
- stack || (stack = new Stack);
3537
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3538
- }
3539
- }
3540
- if (!isSameTag) {
3541
- return false;
3542
- }
3543
- stack || (stack = new Stack);
3544
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3545
- }
3546
-
3547
- /**
3548
- * The base implementation of `_.isEqual` which supports partial comparisons
3549
- * and tracks traversed objects.
3550
- *
3551
- * @private
3552
- * @param {*} value The value to compare.
3553
- * @param {*} other The other value to compare.
3554
- * @param {boolean} bitmask The bitmask flags.
3555
- * 1 - Unordered comparison
3556
- * 2 - Partial comparison
3557
- * @param {Function} [customizer] The function to customize comparisons.
3558
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3559
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3560
- */
3561
- function baseIsEqual(value, other, bitmask, customizer, stack) {
3562
- if (value === other) {
3563
- return true;
3564
- }
3565
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
3566
- return value !== value && other !== other;
3567
- }
3568
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
3569
- }
3570
-
3571
- /** Used to compose bitmasks for value comparisons. */
3572
- var COMPARE_PARTIAL_FLAG$1 = 1,
3573
- COMPARE_UNORDERED_FLAG$1 = 2;
3574
-
3575
- /**
3576
- * The base implementation of `_.isMatch` without support for iteratee shorthands.
3577
- *
3578
- * @private
3579
- * @param {Object} object The object to inspect.
3580
- * @param {Object} source The object of property values to match.
3581
- * @param {Array} matchData The property names, values, and compare flags to match.
3582
- * @param {Function} [customizer] The function to customize comparisons.
3583
- * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3584
- */
3585
- function baseIsMatch(object, source, matchData, customizer) {
3586
- var index = matchData.length,
3587
- length = index;
3588
-
3589
- if (object == null) {
3590
- return !length;
3591
- }
3592
- object = Object(object);
3593
- while (index--) {
3594
- var data = matchData[index];
3595
- if ((data[2])
3596
- ? data[1] !== object[data[0]]
3597
- : !(data[0] in object)
3598
- ) {
3599
- return false;
3600
- }
3601
- }
3602
- while (++index < length) {
3603
- data = matchData[index];
3604
- var key = data[0],
3605
- objValue = object[key],
3606
- srcValue = data[1];
3607
-
3608
- if (data[2]) {
3609
- if (objValue === undefined && !(key in object)) {
3610
- return false;
3611
- }
3612
- } else {
3613
- var stack = new Stack;
3614
- var result;
3615
- if (!(result === undefined
3616
- ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
3617
- : result
3618
- )) {
3619
- return false;
3620
- }
3621
- }
3622
- }
3623
- return true;
3624
- }
3625
-
3626
- /**
3627
- * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
3628
- *
3629
- * @private
3630
- * @param {*} value The value to check.
3631
- * @returns {boolean} Returns `true` if `value` if suitable for strict
3632
- * equality comparisons, else `false`.
3633
- */
3634
- function isStrictComparable(value) {
3635
- return value === value && !isObject(value);
3636
- }
3637
-
3638
- /**
3639
- * Gets the property names, values, and compare flags of `object`.
3640
- *
3641
- * @private
3642
- * @param {Object} object The object to query.
3643
- * @returns {Array} Returns the match data of `object`.
3644
- */
3645
- function getMatchData(object) {
3646
- var result = keys(object),
3647
- length = result.length;
3648
-
3649
- while (length--) {
3650
- var key = result[length],
3651
- value = object[key];
3652
-
3653
- result[length] = [key, value, isStrictComparable(value)];
3654
- }
3655
- return result;
3656
- }
3657
-
3658
- /**
3659
- * A specialized version of `matchesProperty` for source values suitable
3660
- * for strict equality comparisons, i.e. `===`.
3661
- *
3662
- * @private
3663
- * @param {string} key The key of the property to get.
3664
- * @param {*} srcValue The value to match.
3665
- * @returns {Function} Returns the new spec function.
3666
- */
3667
- function matchesStrictComparable(key, srcValue) {
3668
- return function(object) {
3669
- if (object == null) {
3670
- return false;
3671
- }
3672
- return object[key] === srcValue &&
3673
- (srcValue !== undefined || (key in Object(object)));
3674
- };
3675
- }
3676
-
3677
- /**
3678
- * The base implementation of `_.matches` which doesn't clone `source`.
3679
- *
3680
- * @private
3681
- * @param {Object} source The object of property values to match.
3682
- * @returns {Function} Returns the new spec function.
3683
- */
3684
- function baseMatches(source) {
3685
- var matchData = getMatchData(source);
3686
- if (matchData.length == 1 && matchData[0][2]) {
3687
- return matchesStrictComparable(matchData[0][0], matchData[0][1]);
3688
- }
3689
- return function(object) {
3690
- return object === source || baseIsMatch(object, source, matchData);
3691
- };
3692
- }
3693
-
3694
- /**
3695
- * The base implementation of `_.hasIn` without support for deep paths.
3696
- *
3697
- * @private
3698
- * @param {Object} [object] The object to query.
3699
- * @param {Array|string} key The key to check.
3700
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
3701
- */
3702
- function baseHasIn(object, key) {
3703
- return object != null && key in Object(object);
3704
- }
3705
-
3706
- /**
3707
- * Checks if `path` exists on `object`.
3708
- *
3709
- * @private
3710
- * @param {Object} object The object to query.
3711
- * @param {Array|string} path The path to check.
3712
- * @param {Function} hasFunc The function to check properties.
3713
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
3714
- */
3715
- function hasPath(object, path, hasFunc) {
3716
- path = castPath(path, object);
3717
-
3718
- var index = -1,
3719
- length = path.length,
3720
- result = false;
3721
-
3722
- while (++index < length) {
3723
- var key = toKey(path[index]);
3724
- if (!(result = object != null && hasFunc(object, key))) {
3725
- break;
3726
- }
3727
- object = object[key];
3728
- }
3729
- if (result || ++index != length) {
3730
- return result;
3731
- }
3732
- length = object == null ? 0 : object.length;
3733
- return !!length && isLength(length) && isIndex(key, length) &&
3734
- (isArray(object) || isArguments(object));
3735
- }
3736
-
3737
- /**
3738
- * Checks if `path` is a direct or inherited property of `object`.
3739
- *
3740
- * @static
3741
- * @memberOf _
3742
- * @since 4.0.0
3743
- * @category Object
3744
- * @param {Object} object The object to query.
3745
- * @param {Array|string} path The path to check.
3746
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
3747
- * @example
3748
- *
3749
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
3750
- *
3751
- * _.hasIn(object, 'a');
3752
- * // => true
3753
- *
3754
- * _.hasIn(object, 'a.b');
3755
- * // => true
3756
- *
3757
- * _.hasIn(object, ['a', 'b']);
3758
- * // => true
3759
- *
3760
- * _.hasIn(object, 'b');
3761
- * // => false
3762
- */
3763
- function hasIn(object, path) {
3764
- return object != null && hasPath(object, path, baseHasIn);
3765
- }
3766
-
3767
- /** Used to compose bitmasks for value comparisons. */
3768
- var COMPARE_PARTIAL_FLAG = 1,
3769
- COMPARE_UNORDERED_FLAG = 2;
3770
-
3771
- /**
3772
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
3773
- *
3774
- * @private
3775
- * @param {string} path The path of the property to get.
3776
- * @param {*} srcValue The value to match.
3777
- * @returns {Function} Returns the new spec function.
3778
- */
3779
- function baseMatchesProperty(path, srcValue) {
3780
- if (isKey(path) && isStrictComparable(srcValue)) {
3781
- return matchesStrictComparable(toKey(path), srcValue);
3782
- }
3783
- return function(object) {
3784
- var objValue = get(object, path);
3785
- return (objValue === undefined && objValue === srcValue)
3786
- ? hasIn(object, path)
3787
- : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
3788
- };
3789
- }
3790
-
3791
- /**
3792
- * The base implementation of `_.property` without support for deep paths.
3793
- *
3794
- * @private
3795
- * @param {string} key The key of the property to get.
3796
- * @returns {Function} Returns the new accessor function.
3797
- */
3798
- function baseProperty(key) {
3799
- return function(object) {
3800
- return object == null ? undefined : object[key];
3801
- };
3802
- }
3803
-
3804
- /**
3805
- * A specialized version of `baseProperty` which supports deep paths.
3806
- *
3807
- * @private
3808
- * @param {Array|string} path The path of the property to get.
3809
- * @returns {Function} Returns the new accessor function.
3810
- */
3811
- function basePropertyDeep(path) {
3812
- return function(object) {
3813
- return baseGet(object, path);
3814
- };
3815
- }
3816
-
3817
- /**
3818
- * Creates a function that returns the value at `path` of a given object.
3819
- *
3820
- * @static
3821
- * @memberOf _
3822
- * @since 2.4.0
3823
- * @category Util
3824
- * @param {Array|string} path The path of the property to get.
3825
- * @returns {Function} Returns the new accessor function.
3826
- * @example
3827
- *
3828
- * var objects = [
3829
- * { 'a': { 'b': 2 } },
3830
- * { 'a': { 'b': 1 } }
3831
- * ];
3832
- *
3833
- * _.map(objects, _.property('a.b'));
3834
- * // => [2, 1]
3835
- *
3836
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
3837
- * // => [1, 2]
3838
- */
3839
- function property(path) {
3840
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
3841
- }
3842
-
3843
- /**
3844
- * The base implementation of `_.iteratee`.
3845
- *
3846
- * @private
3847
- * @param {*} [value=_.identity] The value to convert to an iteratee.
3848
- * @returns {Function} Returns the iteratee.
3849
- */
3850
- function baseIteratee(value) {
3851
- // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3852
- // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3853
- if (typeof value == 'function') {
3854
- return value;
3855
- }
3856
- if (value == null) {
3857
- return identity;
3858
- }
3859
- if (typeof value == 'object') {
3860
- return isArray(value)
3861
- ? baseMatchesProperty(value[0], value[1])
3862
- : baseMatches(value);
3863
- }
3864
- return property(value);
3865
- }
3866
-
3867
- /**
3868
- * A specialized version of `baseAggregator` for arrays.
3869
- *
3870
- * @private
3871
- * @param {Array} [array] The array to iterate over.
3872
- * @param {Function} setter The function to set `accumulator` values.
3873
- * @param {Function} iteratee The iteratee to transform keys.
3874
- * @param {Object} accumulator The initial aggregated object.
3875
- * @returns {Function} Returns `accumulator`.
3876
- */
3877
- function arrayAggregator(array, setter, iteratee, accumulator) {
3878
- var index = -1,
3879
- length = array == null ? 0 : array.length;
3880
-
3881
- while (++index < length) {
3882
- var value = array[index];
3883
- setter(accumulator, value, iteratee(value), array);
3884
- }
3885
- return accumulator;
3886
- }
3887
-
3888
- /**
3889
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3890
- *
3891
- * @private
3892
- * @param {boolean} [fromRight] Specify iterating from right to left.
3893
- * @returns {Function} Returns the new base function.
3894
- */
3895
- function createBaseFor(fromRight) {
3896
- return function(object, iteratee, keysFunc) {
3897
- var index = -1,
3898
- iterable = Object(object),
3899
- props = keysFunc(object),
3900
- length = props.length;
3901
-
3902
- while (length--) {
3903
- var key = props[++index];
3904
- if (iteratee(iterable[key], key, iterable) === false) {
3905
- break;
3906
- }
3907
- }
3908
- return object;
3909
- };
3910
- }
3911
-
3912
- /**
3913
- * The base implementation of `baseForOwn` which iterates over `object`
3914
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
3915
- * Iteratee functions may exit iteration early by explicitly returning `false`.
3916
- *
3917
- * @private
3918
- * @param {Object} object The object to iterate over.
3919
- * @param {Function} iteratee The function invoked per iteration.
3920
- * @param {Function} keysFunc The function to get the keys of `object`.
3921
- * @returns {Object} Returns `object`.
3922
- */
3923
- var baseFor = createBaseFor();
3924
-
3925
- /**
3926
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
3927
- *
3928
- * @private
3929
- * @param {Object} object The object to iterate over.
3930
- * @param {Function} iteratee The function invoked per iteration.
3931
- * @returns {Object} Returns `object`.
3932
- */
3933
- function baseForOwn(object, iteratee) {
3934
- return object && baseFor(object, iteratee, keys);
3935
- }
3936
-
3937
- /**
3938
- * Creates a `baseEach` or `baseEachRight` function.
3939
- *
3940
- * @private
3941
- * @param {Function} eachFunc The function to iterate over a collection.
3942
- * @param {boolean} [fromRight] Specify iterating from right to left.
3943
- * @returns {Function} Returns the new base function.
3944
- */
3945
- function createBaseEach(eachFunc, fromRight) {
3946
- return function(collection, iteratee) {
3947
- if (collection == null) {
3948
- return collection;
3949
- }
3950
- if (!isArrayLike(collection)) {
3951
- return eachFunc(collection, iteratee);
3952
- }
3953
- var length = collection.length,
3954
- index = -1,
3955
- iterable = Object(collection);
3956
-
3957
- while ((++index < length)) {
3958
- if (iteratee(iterable[index], index, iterable) === false) {
3959
- break;
3960
- }
3961
- }
3962
- return collection;
3963
- };
3964
- }
3965
-
3966
- /**
3967
- * The base implementation of `_.forEach` without support for iteratee shorthands.
3968
- *
3969
- * @private
3970
- * @param {Array|Object} collection The collection to iterate over.
3971
- * @param {Function} iteratee The function invoked per iteration.
3972
- * @returns {Array|Object} Returns `collection`.
3973
- */
3974
- var baseEach = createBaseEach(baseForOwn);
3975
-
3976
- /**
3977
- * Aggregates elements of `collection` on `accumulator` with keys transformed
3978
- * by `iteratee` and values set by `setter`.
3979
- *
3980
- * @private
3981
- * @param {Array|Object} collection The collection to iterate over.
3982
- * @param {Function} setter The function to set `accumulator` values.
3983
- * @param {Function} iteratee The iteratee to transform keys.
3984
- * @param {Object} accumulator The initial aggregated object.
3985
- * @returns {Function} Returns `accumulator`.
3986
- */
3987
- function baseAggregator(collection, setter, iteratee, accumulator) {
3988
- baseEach(collection, function(value, key, collection) {
3989
- setter(accumulator, value, iteratee(value), collection);
3990
- });
3991
- return accumulator;
3992
- }
3993
-
3994
- /**
3995
- * Creates a function like `_.groupBy`.
3996
- *
3997
- * @private
3998
- * @param {Function} setter The function to set accumulator values.
3999
- * @param {Function} [initializer] The accumulator object initializer.
4000
- * @returns {Function} Returns the new aggregator function.
4001
- */
4002
- function createAggregator(setter, initializer) {
4003
- return function(collection, iteratee) {
4004
- var func = isArray(collection) ? arrayAggregator : baseAggregator,
4005
- accumulator = initializer ? initializer() : {};
4006
-
4007
- return func(collection, setter, baseIteratee(iteratee), accumulator);
4008
- };
4009
- }
4010
-
4011
- /**
4012
- * This function is like `assignValue` except that it doesn't assign
4013
- * `undefined` values.
4014
- *
4015
- * @private
4016
- * @param {Object} object The object to modify.
4017
- * @param {string} key The key of the property to assign.
4018
- * @param {*} value The value to assign.
4019
- */
4020
- function assignMergeValue(object, key, value) {
4021
- if ((value !== undefined && !eq(object[key], value)) ||
4022
- (value === undefined && !(key in object))) {
4023
- baseAssignValue(object, key, value);
4024
- }
4025
- }
4026
-
4027
- /**
4028
- * This method is like `_.isArrayLike` except that it also checks if `value`
4029
- * is an object.
4030
- *
4031
- * @static
4032
- * @memberOf _
4033
- * @since 4.0.0
4034
- * @category Lang
4035
- * @param {*} value The value to check.
4036
- * @returns {boolean} Returns `true` if `value` is an array-like object,
4037
- * else `false`.
4038
- * @example
4039
- *
4040
- * _.isArrayLikeObject([1, 2, 3]);
4041
- * // => true
4042
- *
4043
- * _.isArrayLikeObject(document.body.children);
4044
- * // => true
4045
- *
4046
- * _.isArrayLikeObject('abc');
4047
- * // => false
4048
- *
4049
- * _.isArrayLikeObject(_.noop);
4050
- * // => false
4051
- */
4052
- function isArrayLikeObject(value) {
4053
- return isObjectLike(value) && isArrayLike(value);
4054
- }
4055
-
4056
- /**
4057
- * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
4058
- *
4059
- * @private
4060
- * @param {Object} object The object to query.
4061
- * @param {string} key The key of the property to get.
4062
- * @returns {*} Returns the property value.
4063
- */
4064
- function safeGet(object, key) {
4065
- if (key === 'constructor' && typeof object[key] === 'function') {
4066
- return;
4067
- }
4068
-
4069
- if (key == '__proto__') {
4070
- return;
4071
- }
4072
-
4073
- return object[key];
4074
- }
4075
-
4076
- /**
4077
- * Converts `value` to a plain object flattening inherited enumerable string
4078
- * keyed properties of `value` to own properties of the plain object.
4079
- *
4080
- * @static
4081
- * @memberOf _
4082
- * @since 3.0.0
4083
- * @category Lang
4084
- * @param {*} value The value to convert.
4085
- * @returns {Object} Returns the converted plain object.
4086
- * @example
4087
- *
4088
- * function Foo() {
4089
- * this.b = 2;
4090
- * }
4091
- *
4092
- * Foo.prototype.c = 3;
4093
- *
4094
- * _.assign({ 'a': 1 }, new Foo);
4095
- * // => { 'a': 1, 'b': 2 }
4096
- *
4097
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
4098
- * // => { 'a': 1, 'b': 2, 'c': 3 }
4099
- */
4100
- function toPlainObject(value) {
4101
- return copyObject(value, keysIn(value));
4102
- }
4103
-
4104
- /**
4105
- * A specialized version of `baseMerge` for arrays and objects which performs
4106
- * deep merges and tracks traversed objects enabling objects with circular
4107
- * references to be merged.
4108
- *
4109
- * @private
4110
- * @param {Object} object The destination object.
4111
- * @param {Object} source The source object.
4112
- * @param {string} key The key of the value to merge.
4113
- * @param {number} srcIndex The index of `source`.
4114
- * @param {Function} mergeFunc The function to merge values.
4115
- * @param {Function} [customizer] The function to customize assigned values.
4116
- * @param {Object} [stack] Tracks traversed source values and their merged
4117
- * counterparts.
4118
- */
4119
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
4120
- var objValue = safeGet(object, key),
4121
- srcValue = safeGet(source, key),
4122
- stacked = stack.get(srcValue);
4123
-
4124
- if (stacked) {
4125
- assignMergeValue(object, key, stacked);
4126
- return;
4127
- }
4128
- var newValue = customizer
4129
- ? customizer(objValue, srcValue, (key + ''), object, source, stack)
4130
- : undefined;
4131
-
4132
- var isCommon = newValue === undefined;
4133
-
4134
- if (isCommon) {
4135
- var isArr = isArray(srcValue),
4136
- isBuff = !isArr && isBuffer(srcValue),
4137
- isTyped = !isArr && !isBuff && isTypedArray(srcValue);
4138
-
4139
- newValue = srcValue;
4140
- if (isArr || isBuff || isTyped) {
4141
- if (isArray(objValue)) {
4142
- newValue = objValue;
4143
- }
4144
- else if (isArrayLikeObject(objValue)) {
4145
- newValue = copyArray(objValue);
4146
- }
4147
- else if (isBuff) {
4148
- isCommon = false;
4149
- newValue = cloneBuffer(srcValue, true);
4150
- }
4151
- else if (isTyped) {
4152
- isCommon = false;
4153
- newValue = cloneTypedArray(srcValue, true);
4154
- }
4155
- else {
4156
- newValue = [];
4157
- }
4158
- }
4159
- else if (isPlainObject(srcValue) || isArguments(srcValue)) {
4160
- newValue = objValue;
4161
- if (isArguments(objValue)) {
4162
- newValue = toPlainObject(objValue);
4163
- }
4164
- else if (!isObject(objValue) || isFunction(objValue)) {
4165
- newValue = initCloneObject(srcValue);
4166
- }
4167
- }
4168
- else {
4169
- isCommon = false;
4170
- }
4171
- }
4172
- if (isCommon) {
4173
- // Recursively merge objects and arrays (susceptible to call stack limits).
4174
- stack.set(srcValue, newValue);
4175
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
4176
- stack['delete'](srcValue);
4177
- }
4178
- assignMergeValue(object, key, newValue);
4179
- }
4180
-
4181
- /**
4182
- * The base implementation of `_.merge` without support for multiple sources.
4183
- *
4184
- * @private
4185
- * @param {Object} object The destination object.
4186
- * @param {Object} source The source object.
4187
- * @param {number} srcIndex The index of `source`.
4188
- * @param {Function} [customizer] The function to customize merged values.
4189
- * @param {Object} [stack] Tracks traversed source values and their merged
4190
- * counterparts.
4191
- */
4192
- function baseMerge(object, source, srcIndex, customizer, stack) {
4193
- if (object === source) {
4194
- return;
4195
- }
4196
- baseFor(source, function(srcValue, key) {
4197
- stack || (stack = new Stack);
4198
- if (isObject(srcValue)) {
4199
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
4200
- }
4201
- else {
4202
- var newValue = customizer
4203
- ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
4204
- : undefined;
4205
-
4206
- if (newValue === undefined) {
4207
- newValue = srcValue;
4208
- }
4209
- assignMergeValue(object, key, newValue);
4210
- }
4211
- }, keysIn);
4212
- }
4213
-
4214
- /**
4215
- * This method is like `_.merge` except that it accepts `customizer` which
4216
- * is invoked to produce the merged values of the destination and source
4217
- * properties. If `customizer` returns `undefined`, merging is handled by the
4218
- * method instead. The `customizer` is invoked with six arguments:
4219
- * (objValue, srcValue, key, object, source, stack).
4220
- *
4221
- * **Note:** This method mutates `object`.
4222
- *
4223
- * @static
4224
- * @memberOf _
4225
- * @since 4.0.0
4226
- * @category Object
4227
- * @param {Object} object The destination object.
4228
- * @param {...Object} sources The source objects.
4229
- * @param {Function} customizer The function to customize assigned values.
4230
- * @returns {Object} Returns `object`.
4231
- * @example
4232
- *
4233
- * function customizer(objValue, srcValue) {
4234
- * if (_.isArray(objValue)) {
4235
- * return objValue.concat(srcValue);
4236
- * }
4237
- * }
4238
- *
4239
- * var object = { 'a': [1], 'b': [2] };
4240
- * var other = { 'a': [3], 'b': [4] };
4241
- *
4242
- * _.mergeWith(object, other, customizer);
4243
- * // => { 'a': [1, 3], 'b': [2, 4] }
4244
- */
4245
- var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
4246
- baseMerge(object, source, srcIndex, customizer);
4247
- });
4248
-
4249
- /**
4250
- * Gets the last element of `array`.
4251
- *
4252
- * @static
4253
- * @memberOf _
4254
- * @since 0.1.0
4255
- * @category Array
4256
- * @param {Array} array The array to query.
4257
- * @returns {*} Returns the last element of `array`.
4258
- * @example
4259
- *
4260
- * _.last([1, 2, 3]);
4261
- * // => 3
4262
- */
4263
- function last(array) {
4264
- var length = array == null ? 0 : array.length;
4265
- return length ? array[length - 1] : undefined;
4266
- }
4267
-
4268
- /** Used for built-in method references. */
4269
- var objectProto$2 = Object.prototype;
4270
-
4271
- /** Used to check objects for own properties. */
4272
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
4273
-
4274
- /**
4275
- * The base implementation of `_.has` without support for deep paths.
4276
- *
4277
- * @private
4278
- * @param {Object} [object] The object to query.
4279
- * @param {Array|string} key The key to check.
4280
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
4281
- */
4282
- function baseHas(object, key) {
4283
- return object != null && hasOwnProperty$2.call(object, key);
4284
- }
4285
-
4286
- /**
4287
- * Checks if `path` is a direct property of `object`.
4288
- *
4289
- * @static
4290
- * @since 0.1.0
4291
- * @memberOf _
4292
- * @category Object
4293
- * @param {Object} object The object to query.
4294
- * @param {Array|string} path The path to check.
4295
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
4296
- * @example
4297
- *
4298
- * var object = { 'a': { 'b': 2 } };
4299
- * var other = _.create({ 'a': _.create({ 'b': 2 }) });
4300
- *
4301
- * _.has(object, 'a');
4302
- * // => true
4303
- *
4304
- * _.has(object, 'a.b');
4305
- * // => true
4306
- *
4307
- * _.has(object, ['a', 'b']);
4308
- * // => true
4309
- *
4310
- * _.has(other, 'a');
4311
- * // => false
4312
- */
4313
- function has(object, path) {
4314
- return object != null && hasPath(object, path, baseHas);
4315
- }
4316
-
4317
- /**
4318
- * The base implementation of `_.values` and `_.valuesIn` which creates an
4319
- * array of `object` property values corresponding to the property names
4320
- * of `props`.
4321
- *
4322
- * @private
4323
- * @param {Object} object The object to query.
4324
- * @param {Array} props The property names to get values for.
4325
- * @returns {Object} Returns the array of property values.
4326
- */
4327
- function baseValues(object, props) {
4328
- return arrayMap(props, function(key) {
4329
- return object[key];
4330
- });
4331
- }
4332
-
4333
- /**
4334
- * Creates an array of the own enumerable string keyed property values of `object`.
4335
- *
4336
- * **Note:** Non-object values are coerced to objects.
4337
- *
4338
- * @static
4339
- * @since 0.1.0
4340
- * @memberOf _
4341
- * @category Object
4342
- * @param {Object} object The object to query.
4343
- * @returns {Array} Returns the array of property values.
4344
- * @example
4345
- *
4346
- * function Foo() {
4347
- * this.a = 1;
4348
- * this.b = 2;
4349
- * }
4350
- *
4351
- * Foo.prototype.c = 3;
4352
- *
4353
- * _.values(new Foo);
4354
- * // => [1, 2] (iteration order is not guaranteed)
4355
- *
4356
- * _.values('hi');
4357
- * // => ['h', 'i']
4358
- */
4359
- function values(object) {
4360
- return object == null ? [] : baseValues(object, keys(object));
4361
- }
4362
-
4363
- /**
4364
- * Gets the parent value at `path` of `object`.
4365
- *
4366
- * @private
4367
- * @param {Object} object The object to query.
4368
- * @param {Array} path The path to get the parent value of.
4369
- * @returns {*} Returns the parent value.
4370
- */
4371
- function parent(object, path) {
4372
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
4373
- }
4374
-
4375
- /** `Object#toString` result references. */
4376
- var mapTag = '[object Map]',
4377
- setTag = '[object Set]';
4378
-
4379
- /** Used for built-in method references. */
4380
- var objectProto$1 = Object.prototype;
4381
-
4382
- /** Used to check objects for own properties. */
4383
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
4384
-
4385
- /**
4386
- * Checks if `value` is an empty object, collection, map, or set.
4387
- *
4388
- * Objects are considered empty if they have no own enumerable string keyed
4389
- * properties.
4390
- *
4391
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
4392
- * jQuery-like collections are considered empty if they have a `length` of `0`.
4393
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
4394
- *
4395
- * @static
4396
- * @memberOf _
4397
- * @since 0.1.0
4398
- * @category Lang
4399
- * @param {*} value The value to check.
4400
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
4401
- * @example
4402
- *
4403
- * _.isEmpty(null);
4404
- * // => true
4405
- *
4406
- * _.isEmpty(true);
4407
- * // => true
4408
- *
4409
- * _.isEmpty(1);
4410
- * // => true
4411
- *
4412
- * _.isEmpty([1, 2, 3]);
4413
- * // => false
4414
- *
4415
- * _.isEmpty({ 'a': 1 });
4416
- * // => false
4417
- */
4418
- function isEmpty(value) {
4419
- if (value == null) {
4420
- return true;
4421
- }
4422
- if (isArrayLike(value) &&
4423
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
4424
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
4425
- return !value.length;
4426
- }
4427
- var tag = getTag(value);
4428
- if (tag == mapTag || tag == setTag) {
4429
- return !value.size;
4430
- }
4431
- if (isPrototype(value)) {
4432
- return !baseKeys(value).length;
4433
- }
4434
- for (var key in value) {
4435
- if (hasOwnProperty$1.call(value, key)) {
4436
- return false;
4437
- }
4438
- }
4439
- return true;
4440
- }
4441
-
4442
- /**
4443
- * Checks if `value` is `null`.
4444
- *
4445
- * @static
4446
- * @memberOf _
4447
- * @since 0.1.0
4448
- * @category Lang
4449
- * @param {*} value The value to check.
4450
- * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
4451
- * @example
4452
- *
4453
- * _.isNull(null);
4454
- * // => true
4455
- *
4456
- * _.isNull(void 0);
4457
- * // => false
4458
- */
4459
- function isNull(value) {
4460
- return value === null;
4461
- }
4462
-
4463
- /**
4464
- * Checks if `value` is `undefined`.
4465
- *
4466
- * @static
4467
- * @since 0.1.0
4468
- * @memberOf _
4469
- * @category Lang
4470
- * @param {*} value The value to check.
4471
- * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
4472
- * @example
4473
- *
4474
- * _.isUndefined(void 0);
4475
- * // => true
4476
- *
4477
- * _.isUndefined(null);
4478
- * // => false
4479
- */
4480
- function isUndefined(value) {
4481
- return value === undefined;
4482
- }
4483
-
4484
- /**
4485
- * Creates an object composed of keys generated from the results of running
4486
- * each element of `collection` thru `iteratee`. The corresponding value of
4487
- * each key is the last element responsible for generating the key. The
4488
- * iteratee is invoked with one argument: (value).
4489
- *
4490
- * @static
4491
- * @memberOf _
4492
- * @since 4.0.0
4493
- * @category Collection
4494
- * @param {Array|Object} collection The collection to iterate over.
4495
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
4496
- * @returns {Object} Returns the composed aggregate object.
4497
- * @example
4498
- *
4499
- * var array = [
4500
- * { 'dir': 'left', 'code': 97 },
4501
- * { 'dir': 'right', 'code': 100 }
4502
- * ];
4503
- *
4504
- * _.keyBy(array, function(o) {
4505
- * return String.fromCharCode(o.code);
4506
- * });
4507
- * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
4508
- *
4509
- * _.keyBy(array, 'dir');
4510
- * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
4511
- */
4512
- var keyBy = createAggregator(function(result, value, key) {
4513
- baseAssignValue(result, key, value);
4514
- });
4515
-
4516
- /**
4517
- * Creates an object with the same keys as `object` and values generated
4518
- * by running each own enumerable string keyed property of `object` thru
4519
- * `iteratee`. The iteratee is invoked with three arguments:
4520
- * (value, key, object).
4521
- *
4522
- * @static
4523
- * @memberOf _
4524
- * @since 2.4.0
4525
- * @category Object
4526
- * @param {Object} object The object to iterate over.
4527
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
4528
- * @returns {Object} Returns the new mapped object.
4529
- * @see _.mapKeys
4530
- * @example
4531
- *
4532
- * var users = {
4533
- * 'fred': { 'user': 'fred', 'age': 40 },
4534
- * 'pebbles': { 'user': 'pebbles', 'age': 1 }
4535
- * };
4536
- *
4537
- * _.mapValues(users, function(o) { return o.age; });
4538
- * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
4539
- *
4540
- * // The `_.property` iteratee shorthand.
4541
- * _.mapValues(users, 'age');
4542
- * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
4543
- */
4544
- function mapValues(object, iteratee) {
4545
- var result = {};
4546
- iteratee = baseIteratee(iteratee);
4547
-
4548
- baseForOwn(object, function(value, key, object) {
4549
- baseAssignValue(result, key, iteratee(value, key, object));
4550
- });
4551
- return result;
4552
- }
4553
-
4554
- /** Used for built-in method references. */
4555
- var objectProto = Object.prototype;
4556
-
4557
- /** Used to check objects for own properties. */
4558
- var hasOwnProperty = objectProto.hasOwnProperty;
4559
-
4560
- /**
4561
- * The base implementation of `_.unset`.
4562
- *
4563
- * @private
4564
- * @param {Object} object The object to modify.
4565
- * @param {Array|string} path The property path to unset.
4566
- * @returns {boolean} Returns `true` if the property is deleted, else `false`.
4567
- */
4568
- function baseUnset(object, path) {
4569
- path = castPath(path, object);
4570
-
4571
- // Prevent prototype pollution:
4572
- // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
4573
- // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
4574
- var index = -1,
4575
- length = path.length;
4576
-
4577
- if (!length) {
4578
- return true;
4579
- }
4580
-
4581
- while (++index < length) {
4582
- var key = toKey(path[index]);
4583
-
4584
- // Always block "__proto__" anywhere in the path if it's not expected
4585
- if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
4586
- return false;
4587
- }
4588
-
4589
- // Block constructor/prototype as non-terminal traversal keys to prevent
4590
- // escaping the object graph into built-in constructors and prototypes.
4591
- if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
4592
- return false;
4593
- }
4594
- }
4595
-
4596
- var obj = parent(object, path);
4597
- return obj == null || delete obj[toKey(last(path))];
4598
- }
4599
-
4600
- /**
4601
- * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
4602
- * objects.
4603
- *
4604
- * @private
4605
- * @param {*} value The value to inspect.
4606
- * @param {string} key The key of the property to inspect.
4607
- * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
4608
- */
4609
- function customOmitClone(value) {
4610
- return isPlainObject(value) ? undefined : value;
4611
- }
4612
-
4613
- /** Used to compose bitmasks for cloning. */
4614
- var CLONE_DEEP_FLAG = 1,
4615
- CLONE_FLAT_FLAG = 2,
4616
- CLONE_SYMBOLS_FLAG = 4;
4617
-
4618
- /**
4619
- * The opposite of `_.pick`; this method creates an object composed of the
4620
- * own and inherited enumerable property paths of `object` that are not omitted.
4621
- *
4622
- * **Note:** This method is considerably slower than `_.pick`.
4623
- *
4624
- * @static
4625
- * @since 0.1.0
4626
- * @memberOf _
4627
- * @category Object
4628
- * @param {Object} object The source object.
4629
- * @param {...(string|string[])} [paths] The property paths to omit.
4630
- * @returns {Object} Returns the new object.
4631
- * @example
4632
- *
4633
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
4634
- *
4635
- * _.omit(object, ['a', 'c']);
4636
- * // => { 'b': '2' }
4637
- */
4638
- var omit = flatRest(function(object, paths) {
4639
- var result = {};
4640
- if (object == null) {
4641
- return result;
4642
- }
4643
- var isDeep = false;
4644
- paths = arrayMap(paths, function(path) {
4645
- path = castPath(path, object);
4646
- isDeep || (isDeep = path.length > 1);
4647
- return path;
4648
- });
4649
- copyObject(object, getAllKeysIn(object), result);
4650
- if (isDeep) {
4651
- result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
4652
- }
4653
- var length = paths.length;
4654
- while (length--) {
4655
- baseUnset(result, paths[length]);
4656
- }
4657
- return result;
4658
- });
4659
-
4660
- /**
4661
- * The base implementation of `_.set`.
4662
- *
4663
- * @private
4664
- * @param {Object} object The object to modify.
4665
- * @param {Array|string} path The path of the property to set.
4666
- * @param {*} value The value to set.
4667
- * @param {Function} [customizer] The function to customize path creation.
4668
- * @returns {Object} Returns `object`.
4669
- */
4670
- function baseSet(object, path, value, customizer) {
4671
- if (!isObject(object)) {
4672
- return object;
4673
- }
4674
- path = castPath(path, object);
4675
-
4676
- var index = -1,
4677
- length = path.length,
4678
- lastIndex = length - 1,
4679
- nested = object;
4680
-
4681
- while (nested != null && ++index < length) {
4682
- var key = toKey(path[index]),
4683
- newValue = value;
4684
-
4685
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
4686
- return object;
4687
- }
4688
-
4689
- if (index != lastIndex) {
4690
- var objValue = nested[key];
4691
- newValue = undefined;
4692
- if (newValue === undefined) {
4693
- newValue = isObject(objValue)
4694
- ? objValue
4695
- : (isIndex(path[index + 1]) ? [] : {});
4696
- }
4697
- }
4698
- assignValue(nested, key, newValue);
4699
- nested = nested[key];
4700
- }
4701
- return object;
4702
- }
4703
-
4704
- /**
4705
- * The base implementation of `_.pickBy` without support for iteratee shorthands.
4706
- *
4707
- * @private
4708
- * @param {Object} object The source object.
4709
- * @param {string[]} paths The property paths to pick.
4710
- * @param {Function} predicate The function invoked per property.
4711
- * @returns {Object} Returns the new object.
4712
- */
4713
- function basePickBy(object, paths, predicate) {
4714
- var index = -1,
4715
- length = paths.length,
4716
- result = {};
4717
-
4718
- while (++index < length) {
4719
- var path = paths[index],
4720
- value = baseGet(object, path);
4721
-
4722
- if (predicate(value, path)) {
4723
- baseSet(result, castPath(path, object), value);
4724
- }
4725
- }
4726
- return result;
4727
- }
4728
-
4729
- /**
4730
- * The base implementation of `_.pick` without support for individual
4731
- * property identifiers.
4732
- *
4733
- * @private
4734
- * @param {Object} object The source object.
4735
- * @param {string[]} paths The property paths to pick.
4736
- * @returns {Object} Returns the new object.
4737
- */
4738
- function basePick(object, paths) {
4739
- return basePickBy(object, paths, function(value, path) {
4740
- return hasIn(object, path);
4741
- });
4742
- }
4743
-
4744
- /**
4745
- * Creates an object composed of the picked `object` properties.
4746
- *
4747
- * @static
4748
- * @since 0.1.0
4749
- * @memberOf _
4750
- * @category Object
4751
- * @param {Object} object The source object.
4752
- * @param {...(string|string[])} [paths] The property paths to pick.
4753
- * @returns {Object} Returns the new object.
4754
- * @example
4755
- *
4756
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
4757
- *
4758
- * _.pick(object, ['a', 'c']);
4759
- * // => { 'a': 1, 'c': 3 }
4760
- */
4761
- var pick = flatRest(function(object, paths) {
4762
- return object == null ? {} : basePick(object, paths);
4763
- });
4764
-
4765
- /** Used as references for various `Number` constants. */
4766
- var INFINITY = 1 / 0;
4767
-
4768
- /**
4769
- * Creates a set object of `values`.
4770
- *
4771
- * @private
4772
- * @param {Array} values The values to add to the set.
4773
- * @returns {Object} Returns the new set.
4774
- */
4775
- var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
4776
- return new Set(values);
4777
- };
4778
-
4779
- /** Used as the size to enable large array optimizations. */
4780
- var LARGE_ARRAY_SIZE = 200;
4781
-
4782
- /**
4783
- * The base implementation of `_.uniqBy` without support for iteratee shorthands.
4784
- *
4785
- * @private
4786
- * @param {Array} array The array to inspect.
4787
- * @param {Function} [iteratee] The iteratee invoked per element.
4788
- * @param {Function} [comparator] The comparator invoked per element.
4789
- * @returns {Array} Returns the new duplicate free array.
4790
- */
4791
- function baseUniq(array, iteratee, comparator) {
4792
- var index = -1,
4793
- includes = arrayIncludes,
4794
- length = array.length,
4795
- isCommon = true,
4796
- result = [],
4797
- seen = result;
4798
-
4799
- if (length >= LARGE_ARRAY_SIZE) {
4800
- var set = createSet(array);
4801
- if (set) {
4802
- return setToArray(set);
4803
- }
4804
- isCommon = false;
4805
- includes = cacheHas;
4806
- seen = new SetCache;
4807
- }
4808
- else {
4809
- seen = result;
4810
- }
4811
- outer:
4812
- while (++index < length) {
4813
- var value = array[index],
4814
- computed = value;
4815
-
4816
- value = (value !== 0) ? value : 0;
4817
- if (isCommon && computed === computed) {
4818
- var seenIndex = seen.length;
4819
- while (seenIndex--) {
4820
- if (seen[seenIndex] === computed) {
4821
- continue outer;
4822
- }
4823
- }
4824
- result.push(value);
4825
- }
4826
- else if (!includes(seen, computed, comparator)) {
4827
- if (seen !== result) {
4828
- seen.push(computed);
4829
- }
4830
- result.push(value);
4831
- }
4832
- }
4833
- return result;
4834
- }
4835
-
4836
- /**
4837
- * Creates an array of unique values, in order, from all given arrays using
4838
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4839
- * for equality comparisons.
4840
- *
4841
- * @static
4842
- * @memberOf _
4843
- * @since 0.1.0
4844
- * @category Array
4845
- * @param {...Array} [arrays] The arrays to inspect.
4846
- * @returns {Array} Returns the new array of combined values.
4847
- * @example
4848
- *
4849
- * _.union([2], [1, 2]);
4850
- * // => [2, 1]
4851
- */
4852
- var union = baseRest(function(arrays) {
4853
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
4854
- });
4855
-
4856
- const __dirname$1 = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('utils/index.js', document.baseURI).href))));
4857
- function loadJSON(filePath) {
4858
- const response = fs.readFileSync(filePath, 'utf-8');
4859
- return JSON.parse(response);
4860
- }
4861
- function getAbsFile(file, cwd) {
4862
- return path.isAbsolute(file) ? file : path.join(cwd, file);
4863
- }
4864
- function generateDir(tempPath) {
4865
- if (fs.existsSync(tempPath)) {
4866
- fs.rmdirSync(tempPath, { recursive: true });
4867
- }
4868
- fs.mkdirSync(tempPath, { recursive: true });
4869
- }
4870
- function customizer(objValue, srcValue) {
4871
- if (isArray(objValue) && isArray(srcValue)) {
4872
- // 如果 objValue 和 srcValue 都是数组,则进行合并
4873
- return union(objValue, srcValue);
4874
- }
4875
- if (isObject(objValue) && isObject(srcValue)) {
4876
- // 如果 objValue 和 srcValue 都是对象,则递归地调用 mergeObjects 函数进行合并
4877
- return mergeWith(objValue, srcValue, customizer);
4878
- }
4879
- // 其他情况下,使用 srcValue 覆盖 objValue
4880
- return srcValue;
4881
- }
4882
- const mergeConfig = (object1, object2) => {
4883
- return { ...mergeWith(object1, object2, customizer) };
4884
- };
4885
- function copyFolder(sourceFolder, destinationFolder) {
4886
- if (!fs.existsSync(destinationFolder)) {
4887
- fs.mkdirSync(destinationFolder);
4888
- }
4889
- if (!fs.existsSync(sourceFolder))
4890
- return;
4891
- const files = fs.readdirSync(sourceFolder);
4892
- files.forEach(file => {
4893
- const sourcePath = path.join(sourceFolder, file);
4894
- const destinationPath = path.join(destinationFolder, file);
4895
- if (fs.lstatSync(sourcePath).isDirectory()) {
4896
- copyFolder(sourcePath, destinationPath);
4897
- }
4898
- else {
4899
- fs.copyFileSync(sourcePath, destinationPath);
4900
- }
4901
- });
4902
- }
4903
- function getMpasPageHtml(templatePath) {
4904
- if (!templatePath || !fs.existsSync(templatePath)) {
4905
- return path.resolve(__dirname$1, '../template/index.html');
4906
- }
4907
- return templatePath;
4908
- }
4909
- const writeFileToJS = async (filepath, content) => {
4910
- const jsContent = await prettier.format(content, {
4911
- semi: true,
4912
- singleQuote: true,
4913
- parser: 'babel-ts',
4914
- });
4915
- return fs.writeFileSync(filepath, jsContent, 'utf-8');
4916
- };
4917
- const writeFileToJSON = async (filepath, content) => {
4918
- const jsContent = await prettier.format(content, {
4919
- parser: 'json',
4920
- });
4921
- return fs.writeFileSync(filepath, jsContent, 'utf-8');
4922
- };
4923
- const getSrcPath = () => {
4924
- return process.env.SRC === 'true' ? 'src/' : './';
4925
- };
4926
-
4927
- exports.cloneDeep = cloneDeep;
4928
- exports.copyFolder = copyFolder;
4929
- exports.generateDir = generateDir;
4930
- exports.get = get;
4931
- exports.getAbsFile = getAbsFile;
4932
- exports.getMpasPageHtml = getMpasPageHtml;
4933
- exports.getSrcPath = getSrcPath;
4934
- exports.has = has;
4935
- exports.isEmpty = isEmpty;
4936
- exports.isNull = isNull;
4937
- exports.isPlainObject = isPlainObject;
4938
- exports.isUndefined = isUndefined;
4939
- exports.keyBy = keyBy;
4940
- exports.keys = keys;
4941
- exports.loadJSON = loadJSON;
4942
- exports.mapValues = mapValues;
4943
- exports.mergeConfig = mergeConfig;
4944
- exports.omit = omit;
4945
- exports.pick = pick;
4946
- exports.values = values;
4947
- exports.writeFileToJS = writeFileToJS;
4948
- exports.writeFileToJSON = writeFileToJSON;
4949
- //# sourceMappingURL=index.js.map