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