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