@cornerstonejs/adapters 2.0.0-beta.26 → 2.0.0-beta.28

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