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