• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * lodash (Custom Build) <https://lodash.com/>
3 * Build: `lodash modularize exports="npm" -o ./`
4 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
5 * Released under MIT license <https://lodash.com/license>
6 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8 */
9
10/** Used as the size to enable large array optimizations. */
11var LARGE_ARRAY_SIZE = 200;
12
13/** Used to stand-in for `undefined` hash values. */
14var HASH_UNDEFINED = '__lodash_hash_undefined__';
15
16/** Used as references for various `Number` constants. */
17var MAX_SAFE_INTEGER = 9007199254740991;
18
19/** `Object#toString` result references. */
20var funcTag = '[object Function]',
21    genTag = '[object GeneratorFunction]';
22
23/**
24 * Used to match `RegExp`
25 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
26 */
27var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
28
29/** Used to detect host constructors (Safari). */
30var reIsHostCtor = /^\[object .+?Constructor\]$/;
31
32/** Detect free variable `global` from Node.js. */
33var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
34
35/** Detect free variable `self`. */
36var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
37
38/** Used as a reference to the global object. */
39var root = freeGlobal || freeSelf || Function('return this')();
40
41/**
42 * A faster alternative to `Function#apply`, this function invokes `func`
43 * with the `this` binding of `thisArg` and the arguments of `args`.
44 *
45 * @private
46 * @param {Function} func The function to invoke.
47 * @param {*} thisArg The `this` binding of `func`.
48 * @param {Array} args The arguments to invoke `func` with.
49 * @returns {*} Returns the result of `func`.
50 */
51function apply(func, thisArg, args) {
52  switch (args.length) {
53    case 0: return func.call(thisArg);
54    case 1: return func.call(thisArg, args[0]);
55    case 2: return func.call(thisArg, args[0], args[1]);
56    case 3: return func.call(thisArg, args[0], args[1], args[2]);
57  }
58  return func.apply(thisArg, args);
59}
60
61/**
62 * A specialized version of `_.includes` for arrays without support for
63 * specifying an index to search from.
64 *
65 * @private
66 * @param {Array} [array] The array to inspect.
67 * @param {*} target The value to search for.
68 * @returns {boolean} Returns `true` if `target` is found, else `false`.
69 */
70function arrayIncludes(array, value) {
71  var length = array ? array.length : 0;
72  return !!length && baseIndexOf(array, value, 0) > -1;
73}
74
75/**
76 * This function is like `arrayIncludes` except that it accepts a comparator.
77 *
78 * @private
79 * @param {Array} [array] The array to inspect.
80 * @param {*} target The value to search for.
81 * @param {Function} comparator The comparator invoked per element.
82 * @returns {boolean} Returns `true` if `target` is found, else `false`.
83 */
84function arrayIncludesWith(array, value, comparator) {
85  var index = -1,
86      length = array ? array.length : 0;
87
88  while (++index < length) {
89    if (comparator(value, array[index])) {
90      return true;
91    }
92  }
93  return false;
94}
95
96/**
97 * A specialized version of `_.map` for arrays without support for iteratee
98 * shorthands.
99 *
100 * @private
101 * @param {Array} [array] The array to iterate over.
102 * @param {Function} iteratee The function invoked per iteration.
103 * @returns {Array} Returns the new mapped array.
104 */
105function arrayMap(array, iteratee) {
106  var index = -1,
107      length = array ? array.length : 0,
108      result = Array(length);
109
110  while (++index < length) {
111    result[index] = iteratee(array[index], index, array);
112  }
113  return result;
114}
115
116/**
117 * The base implementation of `_.findIndex` and `_.findLastIndex` without
118 * support for iteratee shorthands.
119 *
120 * @private
121 * @param {Array} array The array to inspect.
122 * @param {Function} predicate The function invoked per iteration.
123 * @param {number} fromIndex The index to search from.
124 * @param {boolean} [fromRight] Specify iterating from right to left.
125 * @returns {number} Returns the index of the matched value, else `-1`.
126 */
127function baseFindIndex(array, predicate, fromIndex, fromRight) {
128  var length = array.length,
129      index = fromIndex + (fromRight ? 1 : -1);
130
131  while ((fromRight ? index-- : ++index < length)) {
132    if (predicate(array[index], index, array)) {
133      return index;
134    }
135  }
136  return -1;
137}
138
139/**
140 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
141 *
142 * @private
143 * @param {Array} array The array to inspect.
144 * @param {*} value The value to search for.
145 * @param {number} fromIndex The index to search from.
146 * @returns {number} Returns the index of the matched value, else `-1`.
147 */
148function baseIndexOf(array, value, fromIndex) {
149  if (value !== value) {
150    return baseFindIndex(array, baseIsNaN, fromIndex);
151  }
152  var index = fromIndex - 1,
153      length = array.length;
154
155  while (++index < length) {
156    if (array[index] === value) {
157      return index;
158    }
159  }
160  return -1;
161}
162
163/**
164 * The base implementation of `_.isNaN` without support for number objects.
165 *
166 * @private
167 * @param {*} value The value to check.
168 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
169 */
170function baseIsNaN(value) {
171  return value !== value;
172}
173
174/**
175 * The base implementation of `_.unary` without support for storing metadata.
176 *
177 * @private
178 * @param {Function} func The function to cap arguments for.
179 * @returns {Function} Returns the new capped function.
180 */
181function baseUnary(func) {
182  return function(value) {
183    return func(value);
184  };
185}
186
187/**
188 * Checks if a cache value for `key` exists.
189 *
190 * @private
191 * @param {Object} cache The cache to query.
192 * @param {string} key The key of the entry to check.
193 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
194 */
195function cacheHas(cache, key) {
196  return cache.has(key);
197}
198
199/**
200 * Gets the value at `key` of `object`.
201 *
202 * @private
203 * @param {Object} [object] The object to query.
204 * @param {string} key The key of the property to get.
205 * @returns {*} Returns the property value.
206 */
207function getValue(object, key) {
208  return object == null ? undefined : object[key];
209}
210
211/**
212 * Checks if `value` is a host object in IE < 9.
213 *
214 * @private
215 * @param {*} value The value to check.
216 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
217 */
218function isHostObject(value) {
219  // Many host objects are `Object` objects that can coerce to strings
220  // despite having improperly defined `toString` methods.
221  var result = false;
222  if (value != null && typeof value.toString != 'function') {
223    try {
224      result = !!(value + '');
225    } catch (e) {}
226  }
227  return result;
228}
229
230/** Used for built-in method references. */
231var arrayProto = Array.prototype,
232    funcProto = Function.prototype,
233    objectProto = Object.prototype;
234
235/** Used to detect overreaching core-js shims. */
236var coreJsData = root['__core-js_shared__'];
237
238/** Used to detect methods masquerading as native. */
239var maskSrcKey = (function() {
240  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
241  return uid ? ('Symbol(src)_1.' + uid) : '';
242}());
243
244/** Used to resolve the decompiled source of functions. */
245var funcToString = funcProto.toString;
246
247/** Used to check objects for own properties. */
248var hasOwnProperty = objectProto.hasOwnProperty;
249
250/**
251 * Used to resolve the
252 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
253 * of values.
254 */
255var objectToString = objectProto.toString;
256
257/** Used to detect if a method is native. */
258var reIsNative = RegExp('^' +
259  funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
260  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
261);
262
263/** Built-in value references. */
264var splice = arrayProto.splice;
265
266/* Built-in method references for those with the same name as other `lodash` methods. */
267var nativeMax = Math.max;
268
269/* Built-in method references that are verified to be native. */
270var Map = getNative(root, 'Map'),
271    nativeCreate = getNative(Object, 'create');
272
273/**
274 * Creates a hash object.
275 *
276 * @private
277 * @constructor
278 * @param {Array} [entries] The key-value pairs to cache.
279 */
280function Hash(entries) {
281  var index = -1,
282      length = entries ? entries.length : 0;
283
284  this.clear();
285  while (++index < length) {
286    var entry = entries[index];
287    this.set(entry[0], entry[1]);
288  }
289}
290
291/**
292 * Removes all key-value entries from the hash.
293 *
294 * @private
295 * @name clear
296 * @memberOf Hash
297 */
298function hashClear() {
299  this.__data__ = nativeCreate ? nativeCreate(null) : {};
300}
301
302/**
303 * Removes `key` and its value from the hash.
304 *
305 * @private
306 * @name delete
307 * @memberOf Hash
308 * @param {Object} hash The hash to modify.
309 * @param {string} key The key of the value to remove.
310 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
311 */
312function hashDelete(key) {
313  return this.has(key) && delete this.__data__[key];
314}
315
316/**
317 * Gets the hash value for `key`.
318 *
319 * @private
320 * @name get
321 * @memberOf Hash
322 * @param {string} key The key of the value to get.
323 * @returns {*} Returns the entry value.
324 */
325function hashGet(key) {
326  var data = this.__data__;
327  if (nativeCreate) {
328    var result = data[key];
329    return result === HASH_UNDEFINED ? undefined : result;
330  }
331  return hasOwnProperty.call(data, key) ? data[key] : undefined;
332}
333
334/**
335 * Checks if a hash value for `key` exists.
336 *
337 * @private
338 * @name has
339 * @memberOf Hash
340 * @param {string} key The key of the entry to check.
341 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
342 */
343function hashHas(key) {
344  var data = this.__data__;
345  return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
346}
347
348/**
349 * Sets the hash `key` to `value`.
350 *
351 * @private
352 * @name set
353 * @memberOf Hash
354 * @param {string} key The key of the value to set.
355 * @param {*} value The value to set.
356 * @returns {Object} Returns the hash instance.
357 */
358function hashSet(key, value) {
359  var data = this.__data__;
360  data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
361  return this;
362}
363
364// Add methods to `Hash`.
365Hash.prototype.clear = hashClear;
366Hash.prototype['delete'] = hashDelete;
367Hash.prototype.get = hashGet;
368Hash.prototype.has = hashHas;
369Hash.prototype.set = hashSet;
370
371/**
372 * Creates an list cache object.
373 *
374 * @private
375 * @constructor
376 * @param {Array} [entries] The key-value pairs to cache.
377 */
378function ListCache(entries) {
379  var index = -1,
380      length = entries ? entries.length : 0;
381
382  this.clear();
383  while (++index < length) {
384    var entry = entries[index];
385    this.set(entry[0], entry[1]);
386  }
387}
388
389/**
390 * Removes all key-value entries from the list cache.
391 *
392 * @private
393 * @name clear
394 * @memberOf ListCache
395 */
396function listCacheClear() {
397  this.__data__ = [];
398}
399
400/**
401 * Removes `key` and its value from the list cache.
402 *
403 * @private
404 * @name delete
405 * @memberOf ListCache
406 * @param {string} key The key of the value to remove.
407 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
408 */
409function listCacheDelete(key) {
410  var data = this.__data__,
411      index = assocIndexOf(data, key);
412
413  if (index < 0) {
414    return false;
415  }
416  var lastIndex = data.length - 1;
417  if (index == lastIndex) {
418    data.pop();
419  } else {
420    splice.call(data, index, 1);
421  }
422  return true;
423}
424
425/**
426 * Gets the list cache value for `key`.
427 *
428 * @private
429 * @name get
430 * @memberOf ListCache
431 * @param {string} key The key of the value to get.
432 * @returns {*} Returns the entry value.
433 */
434function listCacheGet(key) {
435  var data = this.__data__,
436      index = assocIndexOf(data, key);
437
438  return index < 0 ? undefined : data[index][1];
439}
440
441/**
442 * Checks if a list cache value for `key` exists.
443 *
444 * @private
445 * @name has
446 * @memberOf ListCache
447 * @param {string} key The key of the entry to check.
448 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
449 */
450function listCacheHas(key) {
451  return assocIndexOf(this.__data__, key) > -1;
452}
453
454/**
455 * Sets the list cache `key` to `value`.
456 *
457 * @private
458 * @name set
459 * @memberOf ListCache
460 * @param {string} key The key of the value to set.
461 * @param {*} value The value to set.
462 * @returns {Object} Returns the list cache instance.
463 */
464function listCacheSet(key, value) {
465  var data = this.__data__,
466      index = assocIndexOf(data, key);
467
468  if (index < 0) {
469    data.push([key, value]);
470  } else {
471    data[index][1] = value;
472  }
473  return this;
474}
475
476// Add methods to `ListCache`.
477ListCache.prototype.clear = listCacheClear;
478ListCache.prototype['delete'] = listCacheDelete;
479ListCache.prototype.get = listCacheGet;
480ListCache.prototype.has = listCacheHas;
481ListCache.prototype.set = listCacheSet;
482
483/**
484 * Creates a map cache object to store key-value pairs.
485 *
486 * @private
487 * @constructor
488 * @param {Array} [entries] The key-value pairs to cache.
489 */
490function MapCache(entries) {
491  var index = -1,
492      length = entries ? entries.length : 0;
493
494  this.clear();
495  while (++index < length) {
496    var entry = entries[index];
497    this.set(entry[0], entry[1]);
498  }
499}
500
501/**
502 * Removes all key-value entries from the map.
503 *
504 * @private
505 * @name clear
506 * @memberOf MapCache
507 */
508function mapCacheClear() {
509  this.__data__ = {
510    'hash': new Hash,
511    'map': new (Map || ListCache),
512    'string': new Hash
513  };
514}
515
516/**
517 * Removes `key` and its value from the map.
518 *
519 * @private
520 * @name delete
521 * @memberOf MapCache
522 * @param {string} key The key of the value to remove.
523 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
524 */
525function mapCacheDelete(key) {
526  return getMapData(this, key)['delete'](key);
527}
528
529/**
530 * Gets the map value for `key`.
531 *
532 * @private
533 * @name get
534 * @memberOf MapCache
535 * @param {string} key The key of the value to get.
536 * @returns {*} Returns the entry value.
537 */
538function mapCacheGet(key) {
539  return getMapData(this, key).get(key);
540}
541
542/**
543 * Checks if a map value for `key` exists.
544 *
545 * @private
546 * @name has
547 * @memberOf MapCache
548 * @param {string} key The key of the entry to check.
549 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
550 */
551function mapCacheHas(key) {
552  return getMapData(this, key).has(key);
553}
554
555/**
556 * Sets the map `key` to `value`.
557 *
558 * @private
559 * @name set
560 * @memberOf MapCache
561 * @param {string} key The key of the value to set.
562 * @param {*} value The value to set.
563 * @returns {Object} Returns the map cache instance.
564 */
565function mapCacheSet(key, value) {
566  getMapData(this, key).set(key, value);
567  return this;
568}
569
570// Add methods to `MapCache`.
571MapCache.prototype.clear = mapCacheClear;
572MapCache.prototype['delete'] = mapCacheDelete;
573MapCache.prototype.get = mapCacheGet;
574MapCache.prototype.has = mapCacheHas;
575MapCache.prototype.set = mapCacheSet;
576
577/**
578 *
579 * Creates an array cache object to store unique values.
580 *
581 * @private
582 * @constructor
583 * @param {Array} [values] The values to cache.
584 */
585function SetCache(values) {
586  var index = -1,
587      length = values ? values.length : 0;
588
589  this.__data__ = new MapCache;
590  while (++index < length) {
591    this.add(values[index]);
592  }
593}
594
595/**
596 * Adds `value` to the array cache.
597 *
598 * @private
599 * @name add
600 * @memberOf SetCache
601 * @alias push
602 * @param {*} value The value to cache.
603 * @returns {Object} Returns the cache instance.
604 */
605function setCacheAdd(value) {
606  this.__data__.set(value, HASH_UNDEFINED);
607  return this;
608}
609
610/**
611 * Checks if `value` is in the array cache.
612 *
613 * @private
614 * @name has
615 * @memberOf SetCache
616 * @param {*} value The value to search for.
617 * @returns {number} Returns `true` if `value` is found, else `false`.
618 */
619function setCacheHas(value) {
620  return this.__data__.has(value);
621}
622
623// Add methods to `SetCache`.
624SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
625SetCache.prototype.has = setCacheHas;
626
627/**
628 * Gets the index at which the `key` is found in `array` of key-value pairs.
629 *
630 * @private
631 * @param {Array} array The array to inspect.
632 * @param {*} key The key to search for.
633 * @returns {number} Returns the index of the matched value, else `-1`.
634 */
635function assocIndexOf(array, key) {
636  var length = array.length;
637  while (length--) {
638    if (eq(array[length][0], key)) {
639      return length;
640    }
641  }
642  return -1;
643}
644
645/**
646 * The base implementation of methods like `_.difference` without support
647 * for excluding multiple arrays or iteratee shorthands.
648 *
649 * @private
650 * @param {Array} array The array to inspect.
651 * @param {Array} values The values to exclude.
652 * @param {Function} [iteratee] The iteratee invoked per element.
653 * @param {Function} [comparator] The comparator invoked per element.
654 * @returns {Array} Returns the new array of filtered values.
655 */
656function baseDifference(array, values, iteratee, comparator) {
657  var index = -1,
658      includes = arrayIncludes,
659      isCommon = true,
660      length = array.length,
661      result = [],
662      valuesLength = values.length;
663
664  if (!length) {
665    return result;
666  }
667  if (iteratee) {
668    values = arrayMap(values, baseUnary(iteratee));
669  }
670  if (comparator) {
671    includes = arrayIncludesWith;
672    isCommon = false;
673  }
674  else if (values.length >= LARGE_ARRAY_SIZE) {
675    includes = cacheHas;
676    isCommon = false;
677    values = new SetCache(values);
678  }
679  outer:
680  while (++index < length) {
681    var value = array[index],
682        computed = iteratee ? iteratee(value) : value;
683
684    value = (comparator || value !== 0) ? value : 0;
685    if (isCommon && computed === computed) {
686      var valuesIndex = valuesLength;
687      while (valuesIndex--) {
688        if (values[valuesIndex] === computed) {
689          continue outer;
690        }
691      }
692      result.push(value);
693    }
694    else if (!includes(values, computed, comparator)) {
695      result.push(value);
696    }
697  }
698  return result;
699}
700
701/**
702 * The base implementation of `_.isNative` without bad shim checks.
703 *
704 * @private
705 * @param {*} value The value to check.
706 * @returns {boolean} Returns `true` if `value` is a native function,
707 *  else `false`.
708 */
709function baseIsNative(value) {
710  if (!isObject(value) || isMasked(value)) {
711    return false;
712  }
713  var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
714  return pattern.test(toSource(value));
715}
716
717/**
718 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
719 *
720 * @private
721 * @param {Function} func The function to apply a rest parameter to.
722 * @param {number} [start=func.length-1] The start position of the rest parameter.
723 * @returns {Function} Returns the new function.
724 */
725function baseRest(func, start) {
726  start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
727  return function() {
728    var args = arguments,
729        index = -1,
730        length = nativeMax(args.length - start, 0),
731        array = Array(length);
732
733    while (++index < length) {
734      array[index] = args[start + index];
735    }
736    index = -1;
737    var otherArgs = Array(start + 1);
738    while (++index < start) {
739      otherArgs[index] = args[index];
740    }
741    otherArgs[start] = array;
742    return apply(func, this, otherArgs);
743  };
744}
745
746/**
747 * Gets the data for `map`.
748 *
749 * @private
750 * @param {Object} map The map to query.
751 * @param {string} key The reference key.
752 * @returns {*} Returns the map data.
753 */
754function getMapData(map, key) {
755  var data = map.__data__;
756  return isKeyable(key)
757    ? data[typeof key == 'string' ? 'string' : 'hash']
758    : data.map;
759}
760
761/**
762 * Gets the native function at `key` of `object`.
763 *
764 * @private
765 * @param {Object} object The object to query.
766 * @param {string} key The key of the method to get.
767 * @returns {*} Returns the function if it's native, else `undefined`.
768 */
769function getNative(object, key) {
770  var value = getValue(object, key);
771  return baseIsNative(value) ? value : undefined;
772}
773
774/**
775 * Checks if `value` is suitable for use as unique object key.
776 *
777 * @private
778 * @param {*} value The value to check.
779 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
780 */
781function isKeyable(value) {
782  var type = typeof value;
783  return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
784    ? (value !== '__proto__')
785    : (value === null);
786}
787
788/**
789 * Checks if `func` has its source masked.
790 *
791 * @private
792 * @param {Function} func The function to check.
793 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
794 */
795function isMasked(func) {
796  return !!maskSrcKey && (maskSrcKey in func);
797}
798
799/**
800 * Converts `func` to its source code.
801 *
802 * @private
803 * @param {Function} func The function to process.
804 * @returns {string} Returns the source code.
805 */
806function toSource(func) {
807  if (func != null) {
808    try {
809      return funcToString.call(func);
810    } catch (e) {}
811    try {
812      return (func + '');
813    } catch (e) {}
814  }
815  return '';
816}
817
818/**
819 * Creates an array excluding all given values using
820 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
821 * for equality comparisons.
822 *
823 * **Note:** Unlike `_.pull`, this method returns a new array.
824 *
825 * @static
826 * @memberOf _
827 * @since 0.1.0
828 * @category Array
829 * @param {Array} array The array to inspect.
830 * @param {...*} [values] The values to exclude.
831 * @returns {Array} Returns the new array of filtered values.
832 * @see _.difference, _.xor
833 * @example
834 *
835 * _.without([2, 1, 2, 3], 1, 2);
836 * // => [3]
837 */
838var without = baseRest(function(array, values) {
839  return isArrayLikeObject(array)
840    ? baseDifference(array, values)
841    : [];
842});
843
844/**
845 * Performs a
846 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
847 * comparison between two values to determine if they are equivalent.
848 *
849 * @static
850 * @memberOf _
851 * @since 4.0.0
852 * @category Lang
853 * @param {*} value The value to compare.
854 * @param {*} other The other value to compare.
855 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
856 * @example
857 *
858 * var object = { 'a': 1 };
859 * var other = { 'a': 1 };
860 *
861 * _.eq(object, object);
862 * // => true
863 *
864 * _.eq(object, other);
865 * // => false
866 *
867 * _.eq('a', 'a');
868 * // => true
869 *
870 * _.eq('a', Object('a'));
871 * // => false
872 *
873 * _.eq(NaN, NaN);
874 * // => true
875 */
876function eq(value, other) {
877  return value === other || (value !== value && other !== other);
878}
879
880/**
881 * Checks if `value` is array-like. A value is considered array-like if it's
882 * not a function and has a `value.length` that's an integer greater than or
883 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
884 *
885 * @static
886 * @memberOf _
887 * @since 4.0.0
888 * @category Lang
889 * @param {*} value The value to check.
890 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
891 * @example
892 *
893 * _.isArrayLike([1, 2, 3]);
894 * // => true
895 *
896 * _.isArrayLike(document.body.children);
897 * // => true
898 *
899 * _.isArrayLike('abc');
900 * // => true
901 *
902 * _.isArrayLike(_.noop);
903 * // => false
904 */
905function isArrayLike(value) {
906  return value != null && isLength(value.length) && !isFunction(value);
907}
908
909/**
910 * This method is like `_.isArrayLike` except that it also checks if `value`
911 * is an object.
912 *
913 * @static
914 * @memberOf _
915 * @since 4.0.0
916 * @category Lang
917 * @param {*} value The value to check.
918 * @returns {boolean} Returns `true` if `value` is an array-like object,
919 *  else `false`.
920 * @example
921 *
922 * _.isArrayLikeObject([1, 2, 3]);
923 * // => true
924 *
925 * _.isArrayLikeObject(document.body.children);
926 * // => true
927 *
928 * _.isArrayLikeObject('abc');
929 * // => false
930 *
931 * _.isArrayLikeObject(_.noop);
932 * // => false
933 */
934function isArrayLikeObject(value) {
935  return isObjectLike(value) && isArrayLike(value);
936}
937
938/**
939 * Checks if `value` is classified as a `Function` object.
940 *
941 * @static
942 * @memberOf _
943 * @since 0.1.0
944 * @category Lang
945 * @param {*} value The value to check.
946 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
947 * @example
948 *
949 * _.isFunction(_);
950 * // => true
951 *
952 * _.isFunction(/abc/);
953 * // => false
954 */
955function isFunction(value) {
956  // The use of `Object#toString` avoids issues with the `typeof` operator
957  // in Safari 8-9 which returns 'object' for typed array and other constructors.
958  var tag = isObject(value) ? objectToString.call(value) : '';
959  return tag == funcTag || tag == genTag;
960}
961
962/**
963 * Checks if `value` is a valid array-like length.
964 *
965 * **Note:** This method is loosely based on
966 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
967 *
968 * @static
969 * @memberOf _
970 * @since 4.0.0
971 * @category Lang
972 * @param {*} value The value to check.
973 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
974 * @example
975 *
976 * _.isLength(3);
977 * // => true
978 *
979 * _.isLength(Number.MIN_VALUE);
980 * // => false
981 *
982 * _.isLength(Infinity);
983 * // => false
984 *
985 * _.isLength('3');
986 * // => false
987 */
988function isLength(value) {
989  return typeof value == 'number' &&
990    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
991}
992
993/**
994 * Checks if `value` is the
995 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
996 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
997 *
998 * @static
999 * @memberOf _
1000 * @since 0.1.0
1001 * @category Lang
1002 * @param {*} value The value to check.
1003 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1004 * @example
1005 *
1006 * _.isObject({});
1007 * // => true
1008 *
1009 * _.isObject([1, 2, 3]);
1010 * // => true
1011 *
1012 * _.isObject(_.noop);
1013 * // => true
1014 *
1015 * _.isObject(null);
1016 * // => false
1017 */
1018function isObject(value) {
1019  var type = typeof value;
1020  return !!value && (type == 'object' || type == 'function');
1021}
1022
1023/**
1024 * Checks if `value` is object-like. A value is object-like if it's not `null`
1025 * and has a `typeof` result of "object".
1026 *
1027 * @static
1028 * @memberOf _
1029 * @since 4.0.0
1030 * @category Lang
1031 * @param {*} value The value to check.
1032 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1033 * @example
1034 *
1035 * _.isObjectLike({});
1036 * // => true
1037 *
1038 * _.isObjectLike([1, 2, 3]);
1039 * // => true
1040 *
1041 * _.isObjectLike(_.noop);
1042 * // => false
1043 *
1044 * _.isObjectLike(null);
1045 * // => false
1046 */
1047function isObjectLike(value) {
1048  return !!value && typeof value == 'object';
1049}
1050
1051module.exports = without;
1052