@hi-ui/check-cascader 4.0.0-alpha.2 → 4.0.0-alpha.23

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 (70) hide show
  1. package/lib/cjs/CheckCascader.js +28 -11
  2. package/lib/cjs/CheckCascader.js.map +1 -1
  3. package/lib/cjs/CheckCascaderMenu.js +10 -3
  4. package/lib/cjs/CheckCascaderMenu.js.map +1 -1
  5. package/lib/cjs/CheckCascaderMenus.js +24 -10
  6. package/lib/cjs/CheckCascaderMenus.js.map +1 -1
  7. package/lib/cjs/CheckCascaderPanel.js +40 -13
  8. package/lib/cjs/CheckCascaderPanel.js.map +1 -1
  9. package/lib/cjs/TagInput.js +82 -21
  10. package/lib/cjs/TagInput.js.map +1 -1
  11. package/lib/cjs/context.js +1 -1
  12. package/lib/cjs/hooks/use-async-switch.js +4 -6
  13. package/lib/cjs/hooks/use-async-switch.js.map +1 -1
  14. package/lib/cjs/hooks/use-cache.js +1 -1
  15. package/lib/cjs/hooks/use-check.js +41 -22
  16. package/lib/cjs/hooks/use-check.js.map +1 -1
  17. package/lib/cjs/hooks/use-search.js +28 -16
  18. package/lib/cjs/hooks/use-search.js.map +1 -1
  19. package/lib/cjs/hooks/use-select.js +1 -1
  20. package/lib/cjs/hooks/use-tag-input.js +1 -1
  21. package/lib/cjs/icons/index.js +1 -1
  22. package/lib/cjs/index.js +1 -1
  23. package/lib/cjs/styles/index.scss.js +2 -2
  24. package/lib/cjs/utils/index.js +1 -26
  25. package/lib/cjs/utils/index.js.map +1 -1
  26. package/lib/esm/CheckCascader.js +24 -11
  27. package/lib/esm/CheckCascader.js.map +1 -1
  28. package/lib/esm/CheckCascaderMenu.js +10 -3
  29. package/lib/esm/CheckCascaderMenu.js.map +1 -1
  30. package/lib/esm/CheckCascaderMenus.js +23 -9
  31. package/lib/esm/CheckCascaderMenus.js.map +1 -1
  32. package/lib/esm/CheckCascaderPanel.js +40 -14
  33. package/lib/esm/CheckCascaderPanel.js.map +1 -1
  34. package/lib/esm/TagInput.js +80 -21
  35. package/lib/esm/TagInput.js.map +1 -1
  36. package/lib/esm/context.js +1 -1
  37. package/lib/esm/hooks/use-async-switch.js +3 -4
  38. package/lib/esm/hooks/use-async-switch.js.map +1 -1
  39. package/lib/esm/hooks/use-cache.js +1 -1
  40. package/lib/esm/hooks/use-check.js +38 -22
  41. package/lib/esm/hooks/use-check.js.map +1 -1
  42. package/lib/esm/hooks/use-search.js +27 -17
  43. package/lib/esm/hooks/use-search.js.map +1 -1
  44. package/lib/esm/hooks/use-select.js +1 -1
  45. package/lib/esm/hooks/use-tag-input.js +1 -1
  46. package/lib/esm/icons/index.js +1 -1
  47. package/lib/esm/index.js +1 -1
  48. package/lib/esm/styles/index.scss.js +2 -2
  49. package/lib/esm/utils/index.js +2 -26
  50. package/lib/esm/utils/index.js.map +1 -1
  51. package/lib/types/CheckCascader.d.ts +7 -1
  52. package/lib/types/CheckCascaderMenus.d.ts +1 -1
  53. package/lib/types/CheckCascaderPanel.d.ts +1 -1
  54. package/lib/types/TagInput.d.ts +6 -8
  55. package/lib/types/hooks/use-check.d.ts +5 -2
  56. package/lib/types/hooks/use-search.d.ts +4 -0
  57. package/lib/types/utils/index.d.ts +0 -8
  58. package/package.json +18 -17
  59. package/lib/cjs/_virtual/_commonjsHelpers.js +0 -17
  60. package/lib/cjs/_virtual/_commonjsHelpers.js.map +0 -1
  61. package/lib/cjs/_virtual/index.js_commonjs-module +0 -19
  62. package/lib/cjs/_virtual/index.js_commonjs-module.map +0 -1
  63. package/lib/cjs/node_modules/lodash.clonedeep/index.js +0 -1872
  64. package/lib/cjs/node_modules/lodash.clonedeep/index.js.map +0 -1
  65. package/lib/esm/_virtual/_commonjsHelpers.js +0 -12
  66. package/lib/esm/_virtual/_commonjsHelpers.js.map +0 -1
  67. package/lib/esm/_virtual/index.js_commonjs-module +0 -14
  68. package/lib/esm/_virtual/index.js_commonjs-module.map +0 -1
  69. package/lib/esm/node_modules/lodash.clonedeep/index.js +0 -1863
  70. package/lib/esm/node_modules/lodash.clonedeep/index.js.map +0 -1
@@ -1,1863 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/esm/typeof";
2
-
3
- /** @LICENSE
4
- * @hi-ui/check-cascader v4.0.0-alpha.1
5
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/check-cascader#readme
6
- *
7
- * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- import { commonjsGlobal } from '../../_virtual/_commonjsHelpers.js';
13
- import { l as lodash_clonedeep } from '../../_virtual/index.js_commonjs-module';
14
- /**
15
- * lodash (Custom Build) <https://lodash.com/>
16
- * Build: `lodash modularize exports="npm" -o ./`
17
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
18
- * Released under MIT license <https://lodash.com/license>
19
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
20
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
21
- */
22
-
23
- (function (module, exports) {
24
- /** Used as the size to enable large array optimizations. */
25
- var LARGE_ARRAY_SIZE = 200;
26
- /** Used to stand-in for `undefined` hash values. */
27
-
28
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
29
- /** Used as references for various `Number` constants. */
30
-
31
- var MAX_SAFE_INTEGER = 9007199254740991;
32
- /** `Object#toString` result references. */
33
-
34
- var argsTag = '[object Arguments]',
35
- arrayTag = '[object Array]',
36
- boolTag = '[object Boolean]',
37
- dateTag = '[object Date]',
38
- errorTag = '[object Error]',
39
- funcTag = '[object Function]',
40
- genTag = '[object GeneratorFunction]',
41
- mapTag = '[object Map]',
42
- numberTag = '[object Number]',
43
- objectTag = '[object Object]',
44
- promiseTag = '[object Promise]',
45
- regexpTag = '[object RegExp]',
46
- setTag = '[object Set]',
47
- stringTag = '[object String]',
48
- symbolTag = '[object Symbol]',
49
- weakMapTag = '[object WeakMap]';
50
- var arrayBufferTag = '[object ArrayBuffer]',
51
- dataViewTag = '[object DataView]',
52
- float32Tag = '[object Float32Array]',
53
- float64Tag = '[object Float64Array]',
54
- int8Tag = '[object Int8Array]',
55
- int16Tag = '[object Int16Array]',
56
- int32Tag = '[object Int32Array]',
57
- uint8Tag = '[object Uint8Array]',
58
- uint8ClampedTag = '[object Uint8ClampedArray]',
59
- uint16Tag = '[object Uint16Array]',
60
- uint32Tag = '[object Uint32Array]';
61
- /**
62
- * Used to match `RegExp`
63
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
64
- */
65
-
66
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
67
- /** Used to match `RegExp` flags from their coerced string values. */
68
-
69
- var reFlags = /\w*$/;
70
- /** Used to detect host constructors (Safari). */
71
-
72
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
73
- /** Used to detect unsigned integer values. */
74
-
75
- var reIsUint = /^(?:0|[1-9]\d*)$/;
76
- /** Used to identify `toStringTag` values supported by `_.clone`. */
77
-
78
- var cloneableTags = {};
79
- cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
80
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
81
- /** Detect free variable `global` from Node.js. */
82
-
83
- var freeGlobal = _typeof(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
84
- /** Detect free variable `self`. */
85
-
86
- var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
87
- /** Used as a reference to the global object. */
88
-
89
- var root = freeGlobal || freeSelf || Function('return this')();
90
- /** Detect free variable `exports`. */
91
-
92
- var freeExports = exports && !exports.nodeType && exports;
93
- /** Detect free variable `module`. */
94
-
95
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
96
- /** Detect the popular CommonJS extension `module.exports`. */
97
-
98
- var moduleExports = freeModule && freeModule.exports === freeExports;
99
- /**
100
- * Adds the key-value `pair` to `map`.
101
- *
102
- * @private
103
- * @param {Object} map The map to modify.
104
- * @param {Array} pair The key-value pair to add.
105
- * @returns {Object} Returns `map`.
106
- */
107
-
108
- function addMapEntry(map, pair) {
109
- // Don't return `map.set` because it's not chainable in IE 11.
110
- map.set(pair[0], pair[1]);
111
- return map;
112
- }
113
- /**
114
- * Adds `value` to `set`.
115
- *
116
- * @private
117
- * @param {Object} set The set to modify.
118
- * @param {*} value The value to add.
119
- * @returns {Object} Returns `set`.
120
- */
121
-
122
-
123
- function addSetEntry(set, value) {
124
- // Don't return `set.add` because it's not chainable in IE 11.
125
- set.add(value);
126
- return set;
127
- }
128
- /**
129
- * A specialized version of `_.forEach` for arrays without support for
130
- * iteratee shorthands.
131
- *
132
- * @private
133
- * @param {Array} [array] The array to iterate over.
134
- * @param {Function} iteratee The function invoked per iteration.
135
- * @returns {Array} Returns `array`.
136
- */
137
-
138
-
139
- function arrayEach(array, iteratee) {
140
- var index = -1,
141
- length = array ? array.length : 0;
142
-
143
- while (++index < length) {
144
- if (iteratee(array[index], index, array) === false) {
145
- break;
146
- }
147
- }
148
-
149
- return array;
150
- }
151
- /**
152
- * Appends the elements of `values` to `array`.
153
- *
154
- * @private
155
- * @param {Array} array The array to modify.
156
- * @param {Array} values The values to append.
157
- * @returns {Array} Returns `array`.
158
- */
159
-
160
-
161
- function arrayPush(array, values) {
162
- var index = -1,
163
- length = values.length,
164
- offset = array.length;
165
-
166
- while (++index < length) {
167
- array[offset + index] = values[index];
168
- }
169
-
170
- return array;
171
- }
172
- /**
173
- * A specialized version of `_.reduce` for arrays without support for
174
- * iteratee shorthands.
175
- *
176
- * @private
177
- * @param {Array} [array] The array to iterate over.
178
- * @param {Function} iteratee The function invoked per iteration.
179
- * @param {*} [accumulator] The initial value.
180
- * @param {boolean} [initAccum] Specify using the first element of `array` as
181
- * the initial value.
182
- * @returns {*} Returns the accumulated value.
183
- */
184
-
185
-
186
- function arrayReduce(array, iteratee, accumulator, initAccum) {
187
- var index = -1,
188
- length = array ? array.length : 0;
189
-
190
- if (initAccum && length) {
191
- accumulator = array[++index];
192
- }
193
-
194
- while (++index < length) {
195
- accumulator = iteratee(accumulator, array[index], index, array);
196
- }
197
-
198
- return accumulator;
199
- }
200
- /**
201
- * The base implementation of `_.times` without support for iteratee shorthands
202
- * or max array length checks.
203
- *
204
- * @private
205
- * @param {number} n The number of times to invoke `iteratee`.
206
- * @param {Function} iteratee The function invoked per iteration.
207
- * @returns {Array} Returns the array of results.
208
- */
209
-
210
-
211
- function baseTimes(n, iteratee) {
212
- var index = -1,
213
- result = Array(n);
214
-
215
- while (++index < n) {
216
- result[index] = iteratee(index);
217
- }
218
-
219
- return result;
220
- }
221
- /**
222
- * Gets the value at `key` of `object`.
223
- *
224
- * @private
225
- * @param {Object} [object] The object to query.
226
- * @param {string} key The key of the property to get.
227
- * @returns {*} Returns the property value.
228
- */
229
-
230
-
231
- function getValue(object, key) {
232
- return object == null ? undefined : object[key];
233
- }
234
- /**
235
- * Checks if `value` is a host object in IE < 9.
236
- *
237
- * @private
238
- * @param {*} value The value to check.
239
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
240
- */
241
-
242
-
243
- function isHostObject(value) {
244
- // Many host objects are `Object` objects that can coerce to strings
245
- // despite having improperly defined `toString` methods.
246
- var result = false;
247
-
248
- if (value != null && typeof value.toString != 'function') {
249
- try {
250
- result = !!(value + '');
251
- } catch (e) {}
252
- }
253
-
254
- return result;
255
- }
256
- /**
257
- * Converts `map` to its key-value pairs.
258
- *
259
- * @private
260
- * @param {Object} map The map to convert.
261
- * @returns {Array} Returns the key-value pairs.
262
- */
263
-
264
-
265
- function mapToArray(map) {
266
- var index = -1,
267
- result = Array(map.size);
268
- map.forEach(function (value, key) {
269
- result[++index] = [key, value];
270
- });
271
- return result;
272
- }
273
- /**
274
- * Creates a unary function that invokes `func` with its argument transformed.
275
- *
276
- * @private
277
- * @param {Function} func The function to wrap.
278
- * @param {Function} transform The argument transform.
279
- * @returns {Function} Returns the new function.
280
- */
281
-
282
-
283
- function overArg(func, transform) {
284
- return function (arg) {
285
- return func(transform(arg));
286
- };
287
- }
288
- /**
289
- * Converts `set` to an array of its values.
290
- *
291
- * @private
292
- * @param {Object} set The set to convert.
293
- * @returns {Array} Returns the values.
294
- */
295
-
296
-
297
- function setToArray(set) {
298
- var index = -1,
299
- result = Array(set.size);
300
- set.forEach(function (value) {
301
- result[++index] = value;
302
- });
303
- return result;
304
- }
305
- /** Used for built-in method references. */
306
-
307
-
308
- var arrayProto = Array.prototype,
309
- funcProto = Function.prototype,
310
- objectProto = Object.prototype;
311
- /** Used to detect overreaching core-js shims. */
312
-
313
- var coreJsData = root['__core-js_shared__'];
314
- /** Used to detect methods masquerading as native. */
315
-
316
- var maskSrcKey = function () {
317
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
318
- return uid ? 'Symbol(src)_1.' + uid : '';
319
- }();
320
- /** Used to resolve the decompiled source of functions. */
321
-
322
-
323
- var funcToString = funcProto.toString;
324
- /** Used to check objects for own properties. */
325
-
326
- var hasOwnProperty = objectProto.hasOwnProperty;
327
- /**
328
- * Used to resolve the
329
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
330
- * of values.
331
- */
332
-
333
- var objectToString = objectProto.toString;
334
- /** Used to detect if a method is native. */
335
-
336
- var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
337
- /** Built-in value references. */
338
-
339
- var Buffer = moduleExports ? root.Buffer : undefined,
340
- _Symbol = root.Symbol,
341
- Uint8Array = root.Uint8Array,
342
- getPrototype = overArg(Object.getPrototypeOf, Object),
343
- objectCreate = Object.create,
344
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
345
- splice = arrayProto.splice;
346
- /* Built-in method references for those with the same name as other `lodash` methods. */
347
-
348
- var nativeGetSymbols = Object.getOwnPropertySymbols,
349
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
350
- nativeKeys = overArg(Object.keys, Object);
351
- /* Built-in method references that are verified to be native. */
352
-
353
- var DataView = getNative(root, 'DataView'),
354
- Map = getNative(root, 'Map'),
355
- Promise = getNative(root, 'Promise'),
356
- Set = getNative(root, 'Set'),
357
- WeakMap = getNative(root, 'WeakMap'),
358
- nativeCreate = getNative(Object, 'create');
359
- /** Used to detect maps, sets, and weakmaps. */
360
-
361
- var dataViewCtorString = toSource(DataView),
362
- mapCtorString = toSource(Map),
363
- promiseCtorString = toSource(Promise),
364
- setCtorString = toSource(Set),
365
- weakMapCtorString = toSource(WeakMap);
366
- /** Used to convert symbols to primitives and strings. */
367
-
368
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
369
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
370
- /**
371
- * Creates a hash object.
372
- *
373
- * @private
374
- * @constructor
375
- * @param {Array} [entries] The key-value pairs to cache.
376
- */
377
-
378
- function Hash(entries) {
379
- var index = -1,
380
- length = entries ? entries.length : 0;
381
- this.clear();
382
-
383
- while (++index < length) {
384
- var entry = entries[index];
385
- this.set(entry[0], entry[1]);
386
- }
387
- }
388
- /**
389
- * Removes all key-value entries from the hash.
390
- *
391
- * @private
392
- * @name clear
393
- * @memberOf Hash
394
- */
395
-
396
-
397
- function hashClear() {
398
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
399
- }
400
- /**
401
- * Removes `key` and its value from the hash.
402
- *
403
- * @private
404
- * @name delete
405
- * @memberOf Hash
406
- * @param {Object} hash The hash to modify.
407
- * @param {string} key The key of the value to remove.
408
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
409
- */
410
-
411
-
412
- function hashDelete(key) {
413
- return this.has(key) && delete this.__data__[key];
414
- }
415
- /**
416
- * Gets the hash value for `key`.
417
- *
418
- * @private
419
- * @name get
420
- * @memberOf Hash
421
- * @param {string} key The key of the value to get.
422
- * @returns {*} Returns the entry value.
423
- */
424
-
425
-
426
- function hashGet(key) {
427
- var data = this.__data__;
428
-
429
- if (nativeCreate) {
430
- var result = data[key];
431
- return result === HASH_UNDEFINED ? undefined : result;
432
- }
433
-
434
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
435
- }
436
- /**
437
- * Checks if a hash value for `key` exists.
438
- *
439
- * @private
440
- * @name has
441
- * @memberOf Hash
442
- * @param {string} key The key of the entry to check.
443
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
444
- */
445
-
446
-
447
- function hashHas(key) {
448
- var data = this.__data__;
449
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
450
- }
451
- /**
452
- * Sets the hash `key` to `value`.
453
- *
454
- * @private
455
- * @name set
456
- * @memberOf Hash
457
- * @param {string} key The key of the value to set.
458
- * @param {*} value The value to set.
459
- * @returns {Object} Returns the hash instance.
460
- */
461
-
462
-
463
- function hashSet(key, value) {
464
- var data = this.__data__;
465
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
466
- return this;
467
- } // Add methods to `Hash`.
468
-
469
-
470
- Hash.prototype.clear = hashClear;
471
- Hash.prototype['delete'] = hashDelete;
472
- Hash.prototype.get = hashGet;
473
- Hash.prototype.has = hashHas;
474
- Hash.prototype.set = hashSet;
475
- /**
476
- * Creates an list cache object.
477
- *
478
- * @private
479
- * @constructor
480
- * @param {Array} [entries] The key-value pairs to cache.
481
- */
482
-
483
- function ListCache(entries) {
484
- var index = -1,
485
- length = entries ? entries.length : 0;
486
- this.clear();
487
-
488
- while (++index < length) {
489
- var entry = entries[index];
490
- this.set(entry[0], entry[1]);
491
- }
492
- }
493
- /**
494
- * Removes all key-value entries from the list cache.
495
- *
496
- * @private
497
- * @name clear
498
- * @memberOf ListCache
499
- */
500
-
501
-
502
- function listCacheClear() {
503
- this.__data__ = [];
504
- }
505
- /**
506
- * Removes `key` and its value from the list cache.
507
- *
508
- * @private
509
- * @name delete
510
- * @memberOf ListCache
511
- * @param {string} key The key of the value to remove.
512
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
513
- */
514
-
515
-
516
- function listCacheDelete(key) {
517
- var data = this.__data__,
518
- index = assocIndexOf(data, key);
519
-
520
- if (index < 0) {
521
- return false;
522
- }
523
-
524
- var lastIndex = data.length - 1;
525
-
526
- if (index == lastIndex) {
527
- data.pop();
528
- } else {
529
- splice.call(data, index, 1);
530
- }
531
-
532
- return true;
533
- }
534
- /**
535
- * Gets the list cache value for `key`.
536
- *
537
- * @private
538
- * @name get
539
- * @memberOf ListCache
540
- * @param {string} key The key of the value to get.
541
- * @returns {*} Returns the entry value.
542
- */
543
-
544
-
545
- function listCacheGet(key) {
546
- var data = this.__data__,
547
- index = assocIndexOf(data, key);
548
- return index < 0 ? undefined : data[index][1];
549
- }
550
- /**
551
- * Checks if a list cache value for `key` exists.
552
- *
553
- * @private
554
- * @name has
555
- * @memberOf ListCache
556
- * @param {string} key The key of the entry to check.
557
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
558
- */
559
-
560
-
561
- function listCacheHas(key) {
562
- return assocIndexOf(this.__data__, key) > -1;
563
- }
564
- /**
565
- * Sets the list cache `key` to `value`.
566
- *
567
- * @private
568
- * @name set
569
- * @memberOf ListCache
570
- * @param {string} key The key of the value to set.
571
- * @param {*} value The value to set.
572
- * @returns {Object} Returns the list cache instance.
573
- */
574
-
575
-
576
- function listCacheSet(key, value) {
577
- var data = this.__data__,
578
- index = assocIndexOf(data, key);
579
-
580
- if (index < 0) {
581
- data.push([key, value]);
582
- } else {
583
- data[index][1] = value;
584
- }
585
-
586
- return this;
587
- } // Add methods to `ListCache`.
588
-
589
-
590
- ListCache.prototype.clear = listCacheClear;
591
- ListCache.prototype['delete'] = listCacheDelete;
592
- ListCache.prototype.get = listCacheGet;
593
- ListCache.prototype.has = listCacheHas;
594
- ListCache.prototype.set = listCacheSet;
595
- /**
596
- * Creates a map cache object to store key-value pairs.
597
- *
598
- * @private
599
- * @constructor
600
- * @param {Array} [entries] The key-value pairs to cache.
601
- */
602
-
603
- function MapCache(entries) {
604
- var index = -1,
605
- length = entries ? entries.length : 0;
606
- this.clear();
607
-
608
- while (++index < length) {
609
- var entry = entries[index];
610
- this.set(entry[0], entry[1]);
611
- }
612
- }
613
- /**
614
- * Removes all key-value entries from the map.
615
- *
616
- * @private
617
- * @name clear
618
- * @memberOf MapCache
619
- */
620
-
621
-
622
- function mapCacheClear() {
623
- this.__data__ = {
624
- 'hash': new Hash(),
625
- 'map': new (Map || ListCache)(),
626
- 'string': new Hash()
627
- };
628
- }
629
- /**
630
- * Removes `key` and its value from the map.
631
- *
632
- * @private
633
- * @name delete
634
- * @memberOf MapCache
635
- * @param {string} key The key of the value to remove.
636
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
637
- */
638
-
639
-
640
- function mapCacheDelete(key) {
641
- return getMapData(this, key)['delete'](key);
642
- }
643
- /**
644
- * Gets the map value for `key`.
645
- *
646
- * @private
647
- * @name get
648
- * @memberOf MapCache
649
- * @param {string} key The key of the value to get.
650
- * @returns {*} Returns the entry value.
651
- */
652
-
653
-
654
- function mapCacheGet(key) {
655
- return getMapData(this, key).get(key);
656
- }
657
- /**
658
- * Checks if a map value for `key` exists.
659
- *
660
- * @private
661
- * @name has
662
- * @memberOf MapCache
663
- * @param {string} key The key of the entry to check.
664
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
665
- */
666
-
667
-
668
- function mapCacheHas(key) {
669
- return getMapData(this, key).has(key);
670
- }
671
- /**
672
- * Sets the map `key` to `value`.
673
- *
674
- * @private
675
- * @name set
676
- * @memberOf MapCache
677
- * @param {string} key The key of the value to set.
678
- * @param {*} value The value to set.
679
- * @returns {Object} Returns the map cache instance.
680
- */
681
-
682
-
683
- function mapCacheSet(key, value) {
684
- getMapData(this, key).set(key, value);
685
- return this;
686
- } // Add methods to `MapCache`.
687
-
688
-
689
- MapCache.prototype.clear = mapCacheClear;
690
- MapCache.prototype['delete'] = mapCacheDelete;
691
- MapCache.prototype.get = mapCacheGet;
692
- MapCache.prototype.has = mapCacheHas;
693
- MapCache.prototype.set = mapCacheSet;
694
- /**
695
- * Creates a stack cache object to store key-value pairs.
696
- *
697
- * @private
698
- * @constructor
699
- * @param {Array} [entries] The key-value pairs to cache.
700
- */
701
-
702
- function Stack(entries) {
703
- this.__data__ = new ListCache(entries);
704
- }
705
- /**
706
- * Removes all key-value entries from the stack.
707
- *
708
- * @private
709
- * @name clear
710
- * @memberOf Stack
711
- */
712
-
713
-
714
- function stackClear() {
715
- this.__data__ = new ListCache();
716
- }
717
- /**
718
- * Removes `key` and its value from the stack.
719
- *
720
- * @private
721
- * @name delete
722
- * @memberOf Stack
723
- * @param {string} key The key of the value to remove.
724
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
725
- */
726
-
727
-
728
- function stackDelete(key) {
729
- return this.__data__['delete'](key);
730
- }
731
- /**
732
- * Gets the stack value for `key`.
733
- *
734
- * @private
735
- * @name get
736
- * @memberOf Stack
737
- * @param {string} key The key of the value to get.
738
- * @returns {*} Returns the entry value.
739
- */
740
-
741
-
742
- function stackGet(key) {
743
- return this.__data__.get(key);
744
- }
745
- /**
746
- * Checks if a stack value for `key` exists.
747
- *
748
- * @private
749
- * @name has
750
- * @memberOf Stack
751
- * @param {string} key The key of the entry to check.
752
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
753
- */
754
-
755
-
756
- function stackHas(key) {
757
- return this.__data__.has(key);
758
- }
759
- /**
760
- * Sets the stack `key` to `value`.
761
- *
762
- * @private
763
- * @name set
764
- * @memberOf Stack
765
- * @param {string} key The key of the value to set.
766
- * @param {*} value The value to set.
767
- * @returns {Object} Returns the stack cache instance.
768
- */
769
-
770
-
771
- function stackSet(key, value) {
772
- var cache = this.__data__;
773
-
774
- if (cache instanceof ListCache) {
775
- var pairs = cache.__data__;
776
-
777
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
778
- pairs.push([key, value]);
779
- return this;
780
- }
781
-
782
- cache = this.__data__ = new MapCache(pairs);
783
- }
784
-
785
- cache.set(key, value);
786
- return this;
787
- } // Add methods to `Stack`.
788
-
789
-
790
- Stack.prototype.clear = stackClear;
791
- Stack.prototype['delete'] = stackDelete;
792
- Stack.prototype.get = stackGet;
793
- Stack.prototype.has = stackHas;
794
- Stack.prototype.set = stackSet;
795
- /**
796
- * Creates an array of the enumerable property names of the array-like `value`.
797
- *
798
- * @private
799
- * @param {*} value The value to query.
800
- * @param {boolean} inherited Specify returning inherited property names.
801
- * @returns {Array} Returns the array of property names.
802
- */
803
-
804
- function arrayLikeKeys(value, inherited) {
805
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
806
- // Safari 9 makes `arguments.length` enumerable in strict mode.
807
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
808
- var length = result.length,
809
- skipIndexes = !!length;
810
-
811
- for (var key in value) {
812
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
813
- result.push(key);
814
- }
815
- }
816
-
817
- return result;
818
- }
819
- /**
820
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
821
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
822
- * for equality comparisons.
823
- *
824
- * @private
825
- * @param {Object} object The object to modify.
826
- * @param {string} key The key of the property to assign.
827
- * @param {*} value The value to assign.
828
- */
829
-
830
-
831
- function assignValue(object, key, value) {
832
- var objValue = object[key];
833
-
834
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
835
- object[key] = value;
836
- }
837
- }
838
- /**
839
- * Gets the index at which the `key` is found in `array` of key-value pairs.
840
- *
841
- * @private
842
- * @param {Array} array The array to inspect.
843
- * @param {*} key The key to search for.
844
- * @returns {number} Returns the index of the matched value, else `-1`.
845
- */
846
-
847
-
848
- function assocIndexOf(array, key) {
849
- var length = array.length;
850
-
851
- while (length--) {
852
- if (eq(array[length][0], key)) {
853
- return length;
854
- }
855
- }
856
-
857
- return -1;
858
- }
859
- /**
860
- * The base implementation of `_.assign` without support for multiple sources
861
- * or `customizer` functions.
862
- *
863
- * @private
864
- * @param {Object} object The destination object.
865
- * @param {Object} source The source object.
866
- * @returns {Object} Returns `object`.
867
- */
868
-
869
-
870
- function baseAssign(object, source) {
871
- return object && copyObject(source, keys(source), object);
872
- }
873
- /**
874
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
875
- * traversed objects.
876
- *
877
- * @private
878
- * @param {*} value The value to clone.
879
- * @param {boolean} [isDeep] Specify a deep clone.
880
- * @param {boolean} [isFull] Specify a clone including symbols.
881
- * @param {Function} [customizer] The function to customize cloning.
882
- * @param {string} [key] The key of `value`.
883
- * @param {Object} [object] The parent object of `value`.
884
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
885
- * @returns {*} Returns the cloned value.
886
- */
887
-
888
-
889
- function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
890
- var result;
891
-
892
- if (customizer) {
893
- result = object ? customizer(value, key, object, stack) : customizer(value);
894
- }
895
-
896
- if (result !== undefined) {
897
- return result;
898
- }
899
-
900
- if (!isObject(value)) {
901
- return value;
902
- }
903
-
904
- var isArr = isArray(value);
905
-
906
- if (isArr) {
907
- result = initCloneArray(value);
908
-
909
- if (!isDeep) {
910
- return copyArray(value, result);
911
- }
912
- } else {
913
- var tag = getTag(value),
914
- isFunc = tag == funcTag || tag == genTag;
915
-
916
- if (isBuffer(value)) {
917
- return cloneBuffer(value, isDeep);
918
- }
919
-
920
- if (tag == objectTag || tag == argsTag || isFunc && !object) {
921
- if (isHostObject(value)) {
922
- return object ? value : {};
923
- }
924
-
925
- result = initCloneObject(isFunc ? {} : value);
926
-
927
- if (!isDeep) {
928
- return copySymbols(value, baseAssign(result, value));
929
- }
930
- } else {
931
- if (!cloneableTags[tag]) {
932
- return object ? value : {};
933
- }
934
-
935
- result = initCloneByTag(value, tag, baseClone, isDeep);
936
- }
937
- } // Check for circular references and return its corresponding clone.
938
-
939
-
940
- stack || (stack = new Stack());
941
- var stacked = stack.get(value);
942
-
943
- if (stacked) {
944
- return stacked;
945
- }
946
-
947
- stack.set(value, result);
948
-
949
- if (!isArr) {
950
- var props = isFull ? getAllKeys(value) : keys(value);
951
- }
952
-
953
- arrayEach(props || value, function (subValue, key) {
954
- if (props) {
955
- key = subValue;
956
- subValue = value[key];
957
- } // Recursively populate clone (susceptible to call stack limits).
958
-
959
-
960
- assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
961
- });
962
- return result;
963
- }
964
- /**
965
- * The base implementation of `_.create` without support for assigning
966
- * properties to the created object.
967
- *
968
- * @private
969
- * @param {Object} prototype The object to inherit from.
970
- * @returns {Object} Returns the new object.
971
- */
972
-
973
-
974
- function baseCreate(proto) {
975
- return isObject(proto) ? objectCreate(proto) : {};
976
- }
977
- /**
978
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
979
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
980
- * symbols of `object`.
981
- *
982
- * @private
983
- * @param {Object} object The object to query.
984
- * @param {Function} keysFunc The function to get the keys of `object`.
985
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
986
- * @returns {Array} Returns the array of property names and symbols.
987
- */
988
-
989
-
990
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
991
- var result = keysFunc(object);
992
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
993
- }
994
- /**
995
- * The base implementation of `getTag`.
996
- *
997
- * @private
998
- * @param {*} value The value to query.
999
- * @returns {string} Returns the `toStringTag`.
1000
- */
1001
-
1002
-
1003
- function baseGetTag(value) {
1004
- return objectToString.call(value);
1005
- }
1006
- /**
1007
- * The base implementation of `_.isNative` without bad shim checks.
1008
- *
1009
- * @private
1010
- * @param {*} value The value to check.
1011
- * @returns {boolean} Returns `true` if `value` is a native function,
1012
- * else `false`.
1013
- */
1014
-
1015
-
1016
- function baseIsNative(value) {
1017
- if (!isObject(value) || isMasked(value)) {
1018
- return false;
1019
- }
1020
-
1021
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
1022
- return pattern.test(toSource(value));
1023
- }
1024
- /**
1025
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1026
- *
1027
- * @private
1028
- * @param {Object} object The object to query.
1029
- * @returns {Array} Returns the array of property names.
1030
- */
1031
-
1032
-
1033
- function baseKeys(object) {
1034
- if (!isPrototype(object)) {
1035
- return nativeKeys(object);
1036
- }
1037
-
1038
- var result = [];
1039
-
1040
- for (var key in Object(object)) {
1041
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
1042
- result.push(key);
1043
- }
1044
- }
1045
-
1046
- return result;
1047
- }
1048
- /**
1049
- * Creates a clone of `buffer`.
1050
- *
1051
- * @private
1052
- * @param {Buffer} buffer The buffer to clone.
1053
- * @param {boolean} [isDeep] Specify a deep clone.
1054
- * @returns {Buffer} Returns the cloned buffer.
1055
- */
1056
-
1057
-
1058
- function cloneBuffer(buffer, isDeep) {
1059
- if (isDeep) {
1060
- return buffer.slice();
1061
- }
1062
-
1063
- var result = new buffer.constructor(buffer.length);
1064
- buffer.copy(result);
1065
- return result;
1066
- }
1067
- /**
1068
- * Creates a clone of `arrayBuffer`.
1069
- *
1070
- * @private
1071
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
1072
- * @returns {ArrayBuffer} Returns the cloned array buffer.
1073
- */
1074
-
1075
-
1076
- function cloneArrayBuffer(arrayBuffer) {
1077
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1078
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
1079
- return result;
1080
- }
1081
- /**
1082
- * Creates a clone of `dataView`.
1083
- *
1084
- * @private
1085
- * @param {Object} dataView The data view to clone.
1086
- * @param {boolean} [isDeep] Specify a deep clone.
1087
- * @returns {Object} Returns the cloned data view.
1088
- */
1089
-
1090
-
1091
- function cloneDataView(dataView, isDeep) {
1092
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
1093
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
1094
- }
1095
- /**
1096
- * Creates a clone of `map`.
1097
- *
1098
- * @private
1099
- * @param {Object} map The map to clone.
1100
- * @param {Function} cloneFunc The function to clone values.
1101
- * @param {boolean} [isDeep] Specify a deep clone.
1102
- * @returns {Object} Returns the cloned map.
1103
- */
1104
-
1105
-
1106
- function cloneMap(map, isDeep, cloneFunc) {
1107
- var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
1108
- return arrayReduce(array, addMapEntry, new map.constructor());
1109
- }
1110
- /**
1111
- * Creates a clone of `regexp`.
1112
- *
1113
- * @private
1114
- * @param {Object} regexp The regexp to clone.
1115
- * @returns {Object} Returns the cloned regexp.
1116
- */
1117
-
1118
-
1119
- function cloneRegExp(regexp) {
1120
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
1121
- result.lastIndex = regexp.lastIndex;
1122
- return result;
1123
- }
1124
- /**
1125
- * Creates a clone of `set`.
1126
- *
1127
- * @private
1128
- * @param {Object} set The set to clone.
1129
- * @param {Function} cloneFunc The function to clone values.
1130
- * @param {boolean} [isDeep] Specify a deep clone.
1131
- * @returns {Object} Returns the cloned set.
1132
- */
1133
-
1134
-
1135
- function cloneSet(set, isDeep, cloneFunc) {
1136
- var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
1137
- return arrayReduce(array, addSetEntry, new set.constructor());
1138
- }
1139
- /**
1140
- * Creates a clone of the `symbol` object.
1141
- *
1142
- * @private
1143
- * @param {Object} symbol The symbol object to clone.
1144
- * @returns {Object} Returns the cloned symbol object.
1145
- */
1146
-
1147
-
1148
- function cloneSymbol(symbol) {
1149
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
1150
- }
1151
- /**
1152
- * Creates a clone of `typedArray`.
1153
- *
1154
- * @private
1155
- * @param {Object} typedArray The typed array to clone.
1156
- * @param {boolean} [isDeep] Specify a deep clone.
1157
- * @returns {Object} Returns the cloned typed array.
1158
- */
1159
-
1160
-
1161
- function cloneTypedArray(typedArray, isDeep) {
1162
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
1163
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1164
- }
1165
- /**
1166
- * Copies the values of `source` to `array`.
1167
- *
1168
- * @private
1169
- * @param {Array} source The array to copy values from.
1170
- * @param {Array} [array=[]] The array to copy values to.
1171
- * @returns {Array} Returns `array`.
1172
- */
1173
-
1174
-
1175
- function copyArray(source, array) {
1176
- var index = -1,
1177
- length = source.length;
1178
- array || (array = Array(length));
1179
-
1180
- while (++index < length) {
1181
- array[index] = source[index];
1182
- }
1183
-
1184
- return array;
1185
- }
1186
- /**
1187
- * Copies properties of `source` to `object`.
1188
- *
1189
- * @private
1190
- * @param {Object} source The object to copy properties from.
1191
- * @param {Array} props The property identifiers to copy.
1192
- * @param {Object} [object={}] The object to copy properties to.
1193
- * @param {Function} [customizer] The function to customize copied values.
1194
- * @returns {Object} Returns `object`.
1195
- */
1196
-
1197
-
1198
- function copyObject(source, props, object, customizer) {
1199
- object || (object = {});
1200
- var index = -1,
1201
- length = props.length;
1202
-
1203
- while (++index < length) {
1204
- var key = props[index];
1205
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
1206
- assignValue(object, key, newValue === undefined ? source[key] : newValue);
1207
- }
1208
-
1209
- return object;
1210
- }
1211
- /**
1212
- * Copies own symbol properties of `source` to `object`.
1213
- *
1214
- * @private
1215
- * @param {Object} source The object to copy symbols from.
1216
- * @param {Object} [object={}] The object to copy symbols to.
1217
- * @returns {Object} Returns `object`.
1218
- */
1219
-
1220
-
1221
- function copySymbols(source, object) {
1222
- return copyObject(source, getSymbols(source), object);
1223
- }
1224
- /**
1225
- * Creates an array of own enumerable property names and symbols of `object`.
1226
- *
1227
- * @private
1228
- * @param {Object} object The object to query.
1229
- * @returns {Array} Returns the array of property names and symbols.
1230
- */
1231
-
1232
-
1233
- function getAllKeys(object) {
1234
- return baseGetAllKeys(object, keys, getSymbols);
1235
- }
1236
- /**
1237
- * Gets the data for `map`.
1238
- *
1239
- * @private
1240
- * @param {Object} map The map to query.
1241
- * @param {string} key The reference key.
1242
- * @returns {*} Returns the map data.
1243
- */
1244
-
1245
-
1246
- function getMapData(map, key) {
1247
- var data = map.__data__;
1248
- return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
1249
- }
1250
- /**
1251
- * Gets the native function at `key` of `object`.
1252
- *
1253
- * @private
1254
- * @param {Object} object The object to query.
1255
- * @param {string} key The key of the method to get.
1256
- * @returns {*} Returns the function if it's native, else `undefined`.
1257
- */
1258
-
1259
-
1260
- function getNative(object, key) {
1261
- var value = getValue(object, key);
1262
- return baseIsNative(value) ? value : undefined;
1263
- }
1264
- /**
1265
- * Creates an array of the own enumerable symbol properties of `object`.
1266
- *
1267
- * @private
1268
- * @param {Object} object The object to query.
1269
- * @returns {Array} Returns the array of symbols.
1270
- */
1271
-
1272
-
1273
- var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
1274
- /**
1275
- * Gets the `toStringTag` of `value`.
1276
- *
1277
- * @private
1278
- * @param {*} value The value to query.
1279
- * @returns {string} Returns the `toStringTag`.
1280
- */
1281
-
1282
- var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11,
1283
- // for data views in Edge < 14, and promises in Node.js.
1284
-
1285
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
1286
- getTag = function getTag(value) {
1287
- var result = objectToString.call(value),
1288
- Ctor = result == objectTag ? value.constructor : undefined,
1289
- ctorString = Ctor ? toSource(Ctor) : undefined;
1290
-
1291
- if (ctorString) {
1292
- switch (ctorString) {
1293
- case dataViewCtorString:
1294
- return dataViewTag;
1295
-
1296
- case mapCtorString:
1297
- return mapTag;
1298
-
1299
- case promiseCtorString:
1300
- return promiseTag;
1301
-
1302
- case setCtorString:
1303
- return setTag;
1304
-
1305
- case weakMapCtorString:
1306
- return weakMapTag;
1307
- }
1308
- }
1309
-
1310
- return result;
1311
- };
1312
- }
1313
- /**
1314
- * Initializes an array clone.
1315
- *
1316
- * @private
1317
- * @param {Array} array The array to clone.
1318
- * @returns {Array} Returns the initialized clone.
1319
- */
1320
-
1321
-
1322
- function initCloneArray(array) {
1323
- var length = array.length,
1324
- result = array.constructor(length); // Add properties assigned by `RegExp#exec`.
1325
-
1326
- if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
1327
- result.index = array.index;
1328
- result.input = array.input;
1329
- }
1330
-
1331
- return result;
1332
- }
1333
- /**
1334
- * Initializes an object clone.
1335
- *
1336
- * @private
1337
- * @param {Object} object The object to clone.
1338
- * @returns {Object} Returns the initialized clone.
1339
- */
1340
-
1341
-
1342
- function initCloneObject(object) {
1343
- return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
1344
- }
1345
- /**
1346
- * Initializes an object clone based on its `toStringTag`.
1347
- *
1348
- * **Note:** This function only supports cloning values with tags of
1349
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1350
- *
1351
- * @private
1352
- * @param {Object} object The object to clone.
1353
- * @param {string} tag The `toStringTag` of the object to clone.
1354
- * @param {Function} cloneFunc The function to clone values.
1355
- * @param {boolean} [isDeep] Specify a deep clone.
1356
- * @returns {Object} Returns the initialized clone.
1357
- */
1358
-
1359
-
1360
- function initCloneByTag(object, tag, cloneFunc, isDeep) {
1361
- var Ctor = object.constructor;
1362
-
1363
- switch (tag) {
1364
- case arrayBufferTag:
1365
- return cloneArrayBuffer(object);
1366
-
1367
- case boolTag:
1368
- case dateTag:
1369
- return new Ctor(+object);
1370
-
1371
- case dataViewTag:
1372
- return cloneDataView(object, isDeep);
1373
-
1374
- case float32Tag:
1375
- case float64Tag:
1376
- case int8Tag:
1377
- case int16Tag:
1378
- case int32Tag:
1379
- case uint8Tag:
1380
- case uint8ClampedTag:
1381
- case uint16Tag:
1382
- case uint32Tag:
1383
- return cloneTypedArray(object, isDeep);
1384
-
1385
- case mapTag:
1386
- return cloneMap(object, isDeep, cloneFunc);
1387
-
1388
- case numberTag:
1389
- case stringTag:
1390
- return new Ctor(object);
1391
-
1392
- case regexpTag:
1393
- return cloneRegExp(object);
1394
-
1395
- case setTag:
1396
- return cloneSet(object, isDeep, cloneFunc);
1397
-
1398
- case symbolTag:
1399
- return cloneSymbol(object);
1400
- }
1401
- }
1402
- /**
1403
- * Checks if `value` is a valid array-like index.
1404
- *
1405
- * @private
1406
- * @param {*} value The value to check.
1407
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1408
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1409
- */
1410
-
1411
-
1412
- function isIndex(value, length) {
1413
- length = length == null ? MAX_SAFE_INTEGER : length;
1414
- return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
1415
- }
1416
- /**
1417
- * Checks if `value` is suitable for use as unique object key.
1418
- *
1419
- * @private
1420
- * @param {*} value The value to check.
1421
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1422
- */
1423
-
1424
-
1425
- function isKeyable(value) {
1426
- var type = _typeof(value);
1427
-
1428
- return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
1429
- }
1430
- /**
1431
- * Checks if `func` has its source masked.
1432
- *
1433
- * @private
1434
- * @param {Function} func The function to check.
1435
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1436
- */
1437
-
1438
-
1439
- function isMasked(func) {
1440
- return !!maskSrcKey && maskSrcKey in func;
1441
- }
1442
- /**
1443
- * Checks if `value` is likely a prototype object.
1444
- *
1445
- * @private
1446
- * @param {*} value The value to check.
1447
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1448
- */
1449
-
1450
-
1451
- function isPrototype(value) {
1452
- var Ctor = value && value.constructor,
1453
- proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
1454
- return value === proto;
1455
- }
1456
- /**
1457
- * Converts `func` to its source code.
1458
- *
1459
- * @private
1460
- * @param {Function} func The function to process.
1461
- * @returns {string} Returns the source code.
1462
- */
1463
-
1464
-
1465
- function toSource(func) {
1466
- if (func != null) {
1467
- try {
1468
- return funcToString.call(func);
1469
- } catch (e) {}
1470
-
1471
- try {
1472
- return func + '';
1473
- } catch (e) {}
1474
- }
1475
-
1476
- return '';
1477
- }
1478
- /**
1479
- * This method is like `_.clone` except that it recursively clones `value`.
1480
- *
1481
- * @static
1482
- * @memberOf _
1483
- * @since 1.0.0
1484
- * @category Lang
1485
- * @param {*} value The value to recursively clone.
1486
- * @returns {*} Returns the deep cloned value.
1487
- * @see _.clone
1488
- * @example
1489
- *
1490
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
1491
- *
1492
- * var deep = _.cloneDeep(objects);
1493
- * console.log(deep[0] === objects[0]);
1494
- * // => false
1495
- */
1496
-
1497
-
1498
- function cloneDeep(value) {
1499
- return baseClone(value, true, true);
1500
- }
1501
- /**
1502
- * Performs a
1503
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1504
- * comparison between two values to determine if they are equivalent.
1505
- *
1506
- * @static
1507
- * @memberOf _
1508
- * @since 4.0.0
1509
- * @category Lang
1510
- * @param {*} value The value to compare.
1511
- * @param {*} other The other value to compare.
1512
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1513
- * @example
1514
- *
1515
- * var object = { 'a': 1 };
1516
- * var other = { 'a': 1 };
1517
- *
1518
- * _.eq(object, object);
1519
- * // => true
1520
- *
1521
- * _.eq(object, other);
1522
- * // => false
1523
- *
1524
- * _.eq('a', 'a');
1525
- * // => true
1526
- *
1527
- * _.eq('a', Object('a'));
1528
- * // => false
1529
- *
1530
- * _.eq(NaN, NaN);
1531
- * // => true
1532
- */
1533
-
1534
-
1535
- function eq(value, other) {
1536
- return value === other || value !== value && other !== other;
1537
- }
1538
- /**
1539
- * Checks if `value` is likely an `arguments` object.
1540
- *
1541
- * @static
1542
- * @memberOf _
1543
- * @since 0.1.0
1544
- * @category Lang
1545
- * @param {*} value The value to check.
1546
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1547
- * else `false`.
1548
- * @example
1549
- *
1550
- * _.isArguments(function() { return arguments; }());
1551
- * // => true
1552
- *
1553
- * _.isArguments([1, 2, 3]);
1554
- * // => false
1555
- */
1556
-
1557
-
1558
- function isArguments(value) {
1559
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
1560
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
1561
- }
1562
- /**
1563
- * Checks if `value` is classified as an `Array` object.
1564
- *
1565
- * @static
1566
- * @memberOf _
1567
- * @since 0.1.0
1568
- * @category Lang
1569
- * @param {*} value The value to check.
1570
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1571
- * @example
1572
- *
1573
- * _.isArray([1, 2, 3]);
1574
- * // => true
1575
- *
1576
- * _.isArray(document.body.children);
1577
- * // => false
1578
- *
1579
- * _.isArray('abc');
1580
- * // => false
1581
- *
1582
- * _.isArray(_.noop);
1583
- * // => false
1584
- */
1585
-
1586
-
1587
- var isArray = Array.isArray;
1588
- /**
1589
- * Checks if `value` is array-like. A value is considered array-like if it's
1590
- * not a function and has a `value.length` that's an integer greater than or
1591
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1592
- *
1593
- * @static
1594
- * @memberOf _
1595
- * @since 4.0.0
1596
- * @category Lang
1597
- * @param {*} value The value to check.
1598
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1599
- * @example
1600
- *
1601
- * _.isArrayLike([1, 2, 3]);
1602
- * // => true
1603
- *
1604
- * _.isArrayLike(document.body.children);
1605
- * // => true
1606
- *
1607
- * _.isArrayLike('abc');
1608
- * // => true
1609
- *
1610
- * _.isArrayLike(_.noop);
1611
- * // => false
1612
- */
1613
-
1614
- function isArrayLike(value) {
1615
- return value != null && isLength(value.length) && !isFunction(value);
1616
- }
1617
- /**
1618
- * This method is like `_.isArrayLike` except that it also checks if `value`
1619
- * is an object.
1620
- *
1621
- * @static
1622
- * @memberOf _
1623
- * @since 4.0.0
1624
- * @category Lang
1625
- * @param {*} value The value to check.
1626
- * @returns {boolean} Returns `true` if `value` is an array-like object,
1627
- * else `false`.
1628
- * @example
1629
- *
1630
- * _.isArrayLikeObject([1, 2, 3]);
1631
- * // => true
1632
- *
1633
- * _.isArrayLikeObject(document.body.children);
1634
- * // => true
1635
- *
1636
- * _.isArrayLikeObject('abc');
1637
- * // => false
1638
- *
1639
- * _.isArrayLikeObject(_.noop);
1640
- * // => false
1641
- */
1642
-
1643
-
1644
- function isArrayLikeObject(value) {
1645
- return isObjectLike(value) && isArrayLike(value);
1646
- }
1647
- /**
1648
- * Checks if `value` is a buffer.
1649
- *
1650
- * @static
1651
- * @memberOf _
1652
- * @since 4.3.0
1653
- * @category Lang
1654
- * @param {*} value The value to check.
1655
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1656
- * @example
1657
- *
1658
- * _.isBuffer(new Buffer(2));
1659
- * // => true
1660
- *
1661
- * _.isBuffer(new Uint8Array(2));
1662
- * // => false
1663
- */
1664
-
1665
-
1666
- var isBuffer = nativeIsBuffer || stubFalse;
1667
- /**
1668
- * Checks if `value` is classified as a `Function` object.
1669
- *
1670
- * @static
1671
- * @memberOf _
1672
- * @since 0.1.0
1673
- * @category Lang
1674
- * @param {*} value The value to check.
1675
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1676
- * @example
1677
- *
1678
- * _.isFunction(_);
1679
- * // => true
1680
- *
1681
- * _.isFunction(/abc/);
1682
- * // => false
1683
- */
1684
-
1685
- function isFunction(value) {
1686
- // The use of `Object#toString` avoids issues with the `typeof` operator
1687
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
1688
- var tag = isObject(value) ? objectToString.call(value) : '';
1689
- return tag == funcTag || tag == genTag;
1690
- }
1691
- /**
1692
- * Checks if `value` is a valid array-like length.
1693
- *
1694
- * **Note:** This method is loosely based on
1695
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1696
- *
1697
- * @static
1698
- * @memberOf _
1699
- * @since 4.0.0
1700
- * @category Lang
1701
- * @param {*} value The value to check.
1702
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1703
- * @example
1704
- *
1705
- * _.isLength(3);
1706
- * // => true
1707
- *
1708
- * _.isLength(Number.MIN_VALUE);
1709
- * // => false
1710
- *
1711
- * _.isLength(Infinity);
1712
- * // => false
1713
- *
1714
- * _.isLength('3');
1715
- * // => false
1716
- */
1717
-
1718
-
1719
- function isLength(value) {
1720
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1721
- }
1722
- /**
1723
- * Checks if `value` is the
1724
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1725
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1726
- *
1727
- * @static
1728
- * @memberOf _
1729
- * @since 0.1.0
1730
- * @category Lang
1731
- * @param {*} value The value to check.
1732
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1733
- * @example
1734
- *
1735
- * _.isObject({});
1736
- * // => true
1737
- *
1738
- * _.isObject([1, 2, 3]);
1739
- * // => true
1740
- *
1741
- * _.isObject(_.noop);
1742
- * // => true
1743
- *
1744
- * _.isObject(null);
1745
- * // => false
1746
- */
1747
-
1748
-
1749
- function isObject(value) {
1750
- var type = _typeof(value);
1751
-
1752
- return !!value && (type == 'object' || type == 'function');
1753
- }
1754
- /**
1755
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1756
- * and has a `typeof` result of "object".
1757
- *
1758
- * @static
1759
- * @memberOf _
1760
- * @since 4.0.0
1761
- * @category Lang
1762
- * @param {*} value The value to check.
1763
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1764
- * @example
1765
- *
1766
- * _.isObjectLike({});
1767
- * // => true
1768
- *
1769
- * _.isObjectLike([1, 2, 3]);
1770
- * // => true
1771
- *
1772
- * _.isObjectLike(_.noop);
1773
- * // => false
1774
- *
1775
- * _.isObjectLike(null);
1776
- * // => false
1777
- */
1778
-
1779
-
1780
- function isObjectLike(value) {
1781
- return !!value && _typeof(value) == 'object';
1782
- }
1783
- /**
1784
- * Creates an array of the own enumerable property names of `object`.
1785
- *
1786
- * **Note:** Non-object values are coerced to objects. See the
1787
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1788
- * for more details.
1789
- *
1790
- * @static
1791
- * @since 0.1.0
1792
- * @memberOf _
1793
- * @category Object
1794
- * @param {Object} object The object to query.
1795
- * @returns {Array} Returns the array of property names.
1796
- * @example
1797
- *
1798
- * function Foo() {
1799
- * this.a = 1;
1800
- * this.b = 2;
1801
- * }
1802
- *
1803
- * Foo.prototype.c = 3;
1804
- *
1805
- * _.keys(new Foo);
1806
- * // => ['a', 'b'] (iteration order is not guaranteed)
1807
- *
1808
- * _.keys('hi');
1809
- * // => ['0', '1']
1810
- */
1811
-
1812
-
1813
- function keys(object) {
1814
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1815
- }
1816
- /**
1817
- * This method returns a new empty array.
1818
- *
1819
- * @static
1820
- * @memberOf _
1821
- * @since 4.13.0
1822
- * @category Util
1823
- * @returns {Array} Returns the new empty array.
1824
- * @example
1825
- *
1826
- * var arrays = _.times(2, _.stubArray);
1827
- *
1828
- * console.log(arrays);
1829
- * // => [[], []]
1830
- *
1831
- * console.log(arrays[0] === arrays[1]);
1832
- * // => false
1833
- */
1834
-
1835
-
1836
- function stubArray() {
1837
- return [];
1838
- }
1839
- /**
1840
- * This method returns `false`.
1841
- *
1842
- * @static
1843
- * @memberOf _
1844
- * @since 4.13.0
1845
- * @category Util
1846
- * @returns {boolean} Returns `false`.
1847
- * @example
1848
- *
1849
- * _.times(2, _.stubFalse);
1850
- * // => [false, false]
1851
- */
1852
-
1853
-
1854
- function stubFalse() {
1855
- return false;
1856
- }
1857
-
1858
- module.exports = cloneDeep;
1859
- })(lodash_clonedeep, lodash_clonedeep.exports);
1860
-
1861
- var cloneDeep = lodash_clonedeep.exports;
1862
- export default cloneDeep;
1863
- //# sourceMappingURL=index.js.map