Initial commit
[yaffs-website] / node_modules / node-sass / node_modules / lodash / core.js
1 /**
2  * @license
3  * lodash (Custom Build) <https://lodash.com/>
4  * Build: `lodash core -o ./dist/lodash.core.js`
5  * Copyright JS Foundation and other contributors <https://js.foundation/>
6  * Released under MIT license <https://lodash.com/license>
7  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9  */
10 ;(function() {
11
12   /** Used as a safe reference for `undefined` in pre-ES5 environments. */
13   var undefined;
14
15   /** Used as the semantic version number. */
16   var VERSION = '4.16.6';
17
18   /** Error message constants. */
19   var FUNC_ERROR_TEXT = 'Expected a function';
20
21   /** Used to compose bitmasks for function metadata. */
22   var BIND_FLAG = 1,
23       PARTIAL_FLAG = 32;
24
25   /** Used to compose bitmasks for comparison styles. */
26   var UNORDERED_COMPARE_FLAG = 1,
27       PARTIAL_COMPARE_FLAG = 2;
28
29   /** Used as references for various `Number` constants. */
30   var INFINITY = 1 / 0,
31       MAX_SAFE_INTEGER = 9007199254740991;
32
33   /** `Object#toString` result references. */
34   var argsTag = '[object Arguments]',
35       arrayTag = '[object Array]',
36       asyncTag = '[object AsyncFunction]',
37       boolTag = '[object Boolean]',
38       dateTag = '[object Date]',
39       errorTag = '[object Error]',
40       funcTag = '[object Function]',
41       genTag = '[object GeneratorFunction]',
42       numberTag = '[object Number]',
43       objectTag = '[object Object]',
44       proxyTag = '[object Proxy]',
45       regexpTag = '[object RegExp]',
46       stringTag = '[object String]';
47
48   /** Used to match HTML entities and HTML characters. */
49   var reUnescapedHtml = /[&<>"']/g,
50       reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
51
52   /** Used to map characters to HTML entities. */
53   var htmlEscapes = {
54     '&': '&amp;',
55     '<': '&lt;',
56     '>': '&gt;',
57     '"': '&quot;',
58     "'": '&#39;'
59   };
60
61   /** Detect free variable `global` from Node.js. */
62   var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
63
64   /** Detect free variable `self`. */
65   var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
66
67   /** Used as a reference to the global object. */
68   var root = freeGlobal || freeSelf || Function('return this')();
69
70   /** Detect free variable `exports`. */
71   var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
72
73   /** Detect free variable `module`. */
74   var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
75
76   /*--------------------------------------------------------------------------*/
77
78   /**
79    * Appends the elements of `values` to `array`.
80    *
81    * @private
82    * @param {Array} array The array to modify.
83    * @param {Array} values The values to append.
84    * @returns {Array} Returns `array`.
85    */
86   function arrayPush(array, values) {
87     array.push.apply(array, values);
88     return array;
89   }
90
91   /**
92    * The base implementation of `_.findIndex` and `_.findLastIndex` without
93    * support for iteratee shorthands.
94    *
95    * @private
96    * @param {Array} array The array to inspect.
97    * @param {Function} predicate The function invoked per iteration.
98    * @param {number} fromIndex The index to search from.
99    * @param {boolean} [fromRight] Specify iterating from right to left.
100    * @returns {number} Returns the index of the matched value, else `-1`.
101    */
102   function baseFindIndex(array, predicate, fromIndex, fromRight) {
103     var length = array.length,
104         index = fromIndex + (fromRight ? 1 : -1);
105
106     while ((fromRight ? index-- : ++index < length)) {
107       if (predicate(array[index], index, array)) {
108         return index;
109       }
110     }
111     return -1;
112   }
113
114   /**
115    * The base implementation of `_.property` without support for deep paths.
116    *
117    * @private
118    * @param {string} key The key of the property to get.
119    * @returns {Function} Returns the new accessor function.
120    */
121   function baseProperty(key) {
122     return function(object) {
123       return object == null ? undefined : object[key];
124     };
125   }
126
127   /**
128    * The base implementation of `_.propertyOf` without support for deep paths.
129    *
130    * @private
131    * @param {Object} object The object to query.
132    * @returns {Function} Returns the new accessor function.
133    */
134   function basePropertyOf(object) {
135     return function(key) {
136       return object == null ? undefined : object[key];
137     };
138   }
139
140   /**
141    * The base implementation of `_.reduce` and `_.reduceRight`, without support
142    * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
143    *
144    * @private
145    * @param {Array|Object} collection The collection to iterate over.
146    * @param {Function} iteratee The function invoked per iteration.
147    * @param {*} accumulator The initial value.
148    * @param {boolean} initAccum Specify using the first or last element of
149    *  `collection` as the initial value.
150    * @param {Function} eachFunc The function to iterate over `collection`.
151    * @returns {*} Returns the accumulated value.
152    */
153   function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
154     eachFunc(collection, function(value, index, collection) {
155       accumulator = initAccum
156         ? (initAccum = false, value)
157         : iteratee(accumulator, value, index, collection);
158     });
159     return accumulator;
160   }
161
162   /**
163    * The base implementation of `_.values` and `_.valuesIn` which creates an
164    * array of `object` property values corresponding to the property names
165    * of `props`.
166    *
167    * @private
168    * @param {Object} object The object to query.
169    * @param {Array} props The property names to get values for.
170    * @returns {Object} Returns the array of property values.
171    */
172   function baseValues(object, props) {
173     return baseMap(props, function(key) {
174       return object[key];
175     });
176   }
177
178   /**
179    * Used by `_.escape` to convert characters to HTML entities.
180    *
181    * @private
182    * @param {string} chr The matched character to escape.
183    * @returns {string} Returns the escaped character.
184    */
185   var escapeHtmlChar = basePropertyOf(htmlEscapes);
186
187   /**
188    * Creates a unary function that invokes `func` with its argument transformed.
189    *
190    * @private
191    * @param {Function} func The function to wrap.
192    * @param {Function} transform The argument transform.
193    * @returns {Function} Returns the new function.
194    */
195   function overArg(func, transform) {
196     return function(arg) {
197       return func(transform(arg));
198     };
199   }
200
201   /*--------------------------------------------------------------------------*/
202
203   /** Used for built-in method references. */
204   var arrayProto = Array.prototype,
205       objectProto = Object.prototype;
206
207   /** Used to check objects for own properties. */
208   var hasOwnProperty = objectProto.hasOwnProperty;
209
210   /** Used to generate unique IDs. */
211   var idCounter = 0;
212
213   /**
214    * Used to resolve the
215    * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
216    * of values.
217    */
218   var nativeObjectToString = objectProto.toString;
219
220   /** Used to restore the original `_` reference in `_.noConflict`. */
221   var oldDash = root._;
222
223   /** Built-in value references. */
224   var objectCreate = Object.create,
225       propertyIsEnumerable = objectProto.propertyIsEnumerable;
226
227   /* Built-in method references for those with the same name as other `lodash` methods. */
228   var nativeIsFinite = root.isFinite,
229       nativeKeys = overArg(Object.keys, Object),
230       nativeMax = Math.max;
231
232   /*------------------------------------------------------------------------*/
233
234   /**
235    * Creates a `lodash` object which wraps `value` to enable implicit method
236    * chain sequences. Methods that operate on and return arrays, collections,
237    * and functions can be chained together. Methods that retrieve a single value
238    * or may return a primitive value will automatically end the chain sequence
239    * and return the unwrapped value. Otherwise, the value must be unwrapped
240    * with `_#value`.
241    *
242    * Explicit chain sequences, which must be unwrapped with `_#value`, may be
243    * enabled using `_.chain`.
244    *
245    * The execution of chained methods is lazy, that is, it's deferred until
246    * `_#value` is implicitly or explicitly called.
247    *
248    * Lazy evaluation allows several methods to support shortcut fusion.
249    * Shortcut fusion is an optimization to merge iteratee calls; this avoids
250    * the creation of intermediate arrays and can greatly reduce the number of
251    * iteratee executions. Sections of a chain sequence qualify for shortcut
252    * fusion if the section is applied to an array of at least `200` elements
253    * and any iteratees accept only one argument. The heuristic for whether a
254    * section qualifies for shortcut fusion is subject to change.
255    *
256    * Chaining is supported in custom builds as long as the `_#value` method is
257    * directly or indirectly included in the build.
258    *
259    * In addition to lodash methods, wrappers have `Array` and `String` methods.
260    *
261    * The wrapper `Array` methods are:
262    * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
263    *
264    * The wrapper `String` methods are:
265    * `replace` and `split`
266    *
267    * The wrapper methods that support shortcut fusion are:
268    * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
269    * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
270    * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
271    *
272    * The chainable wrapper methods are:
273    * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
274    * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
275    * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
276    * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
277    * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
278    * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
279    * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
280    * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
281    * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
282    * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
283    * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
284    * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
285    * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
286    * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
287    * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
288    * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
289    * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
290    * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
291    * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
292    * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
293    * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
294    * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
295    * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
296    * `zipObject`, `zipObjectDeep`, and `zipWith`
297    *
298    * The wrapper methods that are **not** chainable by default are:
299    * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
300    * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
301    * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
302    * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
303    * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
304    * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
305    * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
306    * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
307    * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
308    * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
309    * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
310    * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
311    * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
312    * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
313    * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
314    * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
315    * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
316    * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
317    * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
318    * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
319    * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
320    * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
321    * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
322    * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
323    * `upperFirst`, `value`, and `words`
324    *
325    * @name _
326    * @constructor
327    * @category Seq
328    * @param {*} value The value to wrap in a `lodash` instance.
329    * @returns {Object} Returns the new `lodash` wrapper instance.
330    * @example
331    *
332    * function square(n) {
333    *   return n * n;
334    * }
335    *
336    * var wrapped = _([1, 2, 3]);
337    *
338    * // Returns an unwrapped value.
339    * wrapped.reduce(_.add);
340    * // => 6
341    *
342    * // Returns a wrapped value.
343    * var squares = wrapped.map(square);
344    *
345    * _.isArray(squares);
346    * // => false
347    *
348    * _.isArray(squares.value());
349    * // => true
350    */
351   function lodash(value) {
352     return value instanceof LodashWrapper
353       ? value
354       : new LodashWrapper(value);
355   }
356
357   /**
358    * The base implementation of `_.create` without support for assigning
359    * properties to the created object.
360    *
361    * @private
362    * @param {Object} proto The object to inherit from.
363    * @returns {Object} Returns the new object.
364    */
365   var baseCreate = (function() {
366     function object() {}
367     return function(proto) {
368       if (!isObject(proto)) {
369         return {};
370       }
371       if (objectCreate) {
372         return objectCreate(proto);
373       }
374       object.prototype = proto;
375       var result = new object;
376       object.prototype = undefined;
377       return result;
378     };
379   }());
380
381   /**
382    * The base constructor for creating `lodash` wrapper objects.
383    *
384    * @private
385    * @param {*} value The value to wrap.
386    * @param {boolean} [chainAll] Enable explicit method chain sequences.
387    */
388   function LodashWrapper(value, chainAll) {
389     this.__wrapped__ = value;
390     this.__actions__ = [];
391     this.__chain__ = !!chainAll;
392   }
393
394   LodashWrapper.prototype = baseCreate(lodash.prototype);
395   LodashWrapper.prototype.constructor = LodashWrapper;
396
397   /*------------------------------------------------------------------------*/
398
399   /**
400    * Used by `_.defaults` to customize its `_.assignIn` use.
401    *
402    * @private
403    * @param {*} objValue The destination value.
404    * @param {*} srcValue The source value.
405    * @param {string} key The key of the property to assign.
406    * @param {Object} object The parent object of `objValue`.
407    * @returns {*} Returns the value to assign.
408    */
409   function assignInDefaults(objValue, srcValue, key, object) {
410     if (objValue === undefined ||
411         (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
412       return srcValue;
413     }
414     return objValue;
415   }
416
417   /**
418    * Assigns `value` to `key` of `object` if the existing value is not equivalent
419    * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
420    * for equality comparisons.
421    *
422    * @private
423    * @param {Object} object The object to modify.
424    * @param {string} key The key of the property to assign.
425    * @param {*} value The value to assign.
426    */
427   function assignValue(object, key, value) {
428     var objValue = object[key];
429     if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
430         (value === undefined && !(key in object))) {
431       baseAssignValue(object, key, value);
432     }
433   }
434
435   /**
436    * The base implementation of `assignValue` and `assignMergeValue` without
437    * value checks.
438    *
439    * @private
440    * @param {Object} object The object to modify.
441    * @param {string} key The key of the property to assign.
442    * @param {*} value The value to assign.
443    */
444   function baseAssignValue(object, key, value) {
445     object[key] = value;
446   }
447
448   /**
449    * The base implementation of `_.delay` and `_.defer` which accepts `args`
450    * to provide to `func`.
451    *
452    * @private
453    * @param {Function} func The function to delay.
454    * @param {number} wait The number of milliseconds to delay invocation.
455    * @param {Array} args The arguments to provide to `func`.
456    * @returns {number|Object} Returns the timer id or timeout object.
457    */
458   function baseDelay(func, wait, args) {
459     if (typeof func != 'function') {
460       throw new TypeError(FUNC_ERROR_TEXT);
461     }
462     return setTimeout(function() { func.apply(undefined, args); }, wait);
463   }
464
465   /**
466    * The base implementation of `_.forEach` without support for iteratee shorthands.
467    *
468    * @private
469    * @param {Array|Object} collection The collection to iterate over.
470    * @param {Function} iteratee The function invoked per iteration.
471    * @returns {Array|Object} Returns `collection`.
472    */
473   var baseEach = createBaseEach(baseForOwn);
474
475   /**
476    * The base implementation of `_.every` without support for iteratee shorthands.
477    *
478    * @private
479    * @param {Array|Object} collection The collection to iterate over.
480    * @param {Function} predicate The function invoked per iteration.
481    * @returns {boolean} Returns `true` if all elements pass the predicate check,
482    *  else `false`
483    */
484   function baseEvery(collection, predicate) {
485     var result = true;
486     baseEach(collection, function(value, index, collection) {
487       result = !!predicate(value, index, collection);
488       return result;
489     });
490     return result;
491   }
492
493   /**
494    * The base implementation of methods like `_.max` and `_.min` which accepts a
495    * `comparator` to determine the extremum value.
496    *
497    * @private
498    * @param {Array} array The array to iterate over.
499    * @param {Function} iteratee The iteratee invoked per iteration.
500    * @param {Function} comparator The comparator used to compare values.
501    * @returns {*} Returns the extremum value.
502    */
503   function baseExtremum(array, iteratee, comparator) {
504     var index = -1,
505         length = array.length;
506
507     while (++index < length) {
508       var value = array[index],
509           current = iteratee(value);
510
511       if (current != null && (computed === undefined
512             ? (current === current && !false)
513             : comparator(current, computed)
514           )) {
515         var computed = current,
516             result = value;
517       }
518     }
519     return result;
520   }
521
522   /**
523    * The base implementation of `_.filter` without support for iteratee shorthands.
524    *
525    * @private
526    * @param {Array|Object} collection The collection to iterate over.
527    * @param {Function} predicate The function invoked per iteration.
528    * @returns {Array} Returns the new filtered array.
529    */
530   function baseFilter(collection, predicate) {
531     var result = [];
532     baseEach(collection, function(value, index, collection) {
533       if (predicate(value, index, collection)) {
534         result.push(value);
535       }
536     });
537     return result;
538   }
539
540   /**
541    * The base implementation of `_.flatten` with support for restricting flattening.
542    *
543    * @private
544    * @param {Array} array The array to flatten.
545    * @param {number} depth The maximum recursion depth.
546    * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
547    * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
548    * @param {Array} [result=[]] The initial result value.
549    * @returns {Array} Returns the new flattened array.
550    */
551   function baseFlatten(array, depth, predicate, isStrict, result) {
552     var index = -1,
553         length = array.length;
554
555     predicate || (predicate = isFlattenable);
556     result || (result = []);
557
558     while (++index < length) {
559       var value = array[index];
560       if (depth > 0 && predicate(value)) {
561         if (depth > 1) {
562           // Recursively flatten arrays (susceptible to call stack limits).
563           baseFlatten(value, depth - 1, predicate, isStrict, result);
564         } else {
565           arrayPush(result, value);
566         }
567       } else if (!isStrict) {
568         result[result.length] = value;
569       }
570     }
571     return result;
572   }
573
574   /**
575    * The base implementation of `baseForOwn` which iterates over `object`
576    * properties returned by `keysFunc` and invokes `iteratee` for each property.
577    * Iteratee functions may exit iteration early by explicitly returning `false`.
578    *
579    * @private
580    * @param {Object} object The object to iterate over.
581    * @param {Function} iteratee The function invoked per iteration.
582    * @param {Function} keysFunc The function to get the keys of `object`.
583    * @returns {Object} Returns `object`.
584    */
585   var baseFor = createBaseFor();
586
587   /**
588    * The base implementation of `_.forOwn` without support for iteratee shorthands.
589    *
590    * @private
591    * @param {Object} object The object to iterate over.
592    * @param {Function} iteratee The function invoked per iteration.
593    * @returns {Object} Returns `object`.
594    */
595   function baseForOwn(object, iteratee) {
596     return object && baseFor(object, iteratee, keys);
597   }
598
599   /**
600    * The base implementation of `_.functions` which creates an array of
601    * `object` function property names filtered from `props`.
602    *
603    * @private
604    * @param {Object} object The object to inspect.
605    * @param {Array} props The property names to filter.
606    * @returns {Array} Returns the function names.
607    */
608   function baseFunctions(object, props) {
609     return baseFilter(props, function(key) {
610       return isFunction(object[key]);
611     });
612   }
613
614   /**
615    * The base implementation of `getTag` without fallbacks for buggy environments.
616    *
617    * @private
618    * @param {*} value The value to query.
619    * @returns {string} Returns the `toStringTag`.
620    */
621   function baseGetTag(value) {
622     return objectToString(value);
623   }
624
625   /**
626    * The base implementation of `_.gt` which doesn't coerce arguments.
627    *
628    * @private
629    * @param {*} value The value to compare.
630    * @param {*} other The other value to compare.
631    * @returns {boolean} Returns `true` if `value` is greater than `other`,
632    *  else `false`.
633    */
634   function baseGt(value, other) {
635     return value > other;
636   }
637
638   /**
639    * The base implementation of `_.isArguments`.
640    *
641    * @private
642    * @param {*} value The value to check.
643    * @returns {boolean} Returns `true` if `value` is an `arguments` object,
644    */
645   var baseIsArguments = noop;
646
647   /**
648    * The base implementation of `_.isDate` without Node.js optimizations.
649    *
650    * @private
651    * @param {*} value The value to check.
652    * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
653    */
654   function baseIsDate(value) {
655     return isObjectLike(value) && baseGetTag(value) == dateTag;
656   }
657
658   /**
659    * The base implementation of `_.isEqual` which supports partial comparisons
660    * and tracks traversed objects.
661    *
662    * @private
663    * @param {*} value The value to compare.
664    * @param {*} other The other value to compare.
665    * @param {Function} [customizer] The function to customize comparisons.
666    * @param {boolean} [bitmask] The bitmask of comparison flags.
667    *  The bitmask may be composed of the following flags:
668    *     1 - Unordered comparison
669    *     2 - Partial comparison
670    * @param {Object} [stack] Tracks traversed `value` and `other` objects.
671    * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
672    */
673   function baseIsEqual(value, other, customizer, bitmask, stack) {
674     if (value === other) {
675       return true;
676     }
677     if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
678       return value !== value && other !== other;
679     }
680     return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
681   }
682
683   /**
684    * A specialized version of `baseIsEqual` for arrays and objects which performs
685    * deep comparisons and tracks traversed objects enabling objects with circular
686    * references to be compared.
687    *
688    * @private
689    * @param {Object} object The object to compare.
690    * @param {Object} other The other object to compare.
691    * @param {Function} equalFunc The function to determine equivalents of values.
692    * @param {Function} [customizer] The function to customize comparisons.
693    * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
694    *  for more details.
695    * @param {Object} [stack] Tracks traversed `object` and `other` objects.
696    * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
697    */
698   function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
699     var objIsArr = isArray(object),
700         othIsArr = isArray(other),
701         objTag = arrayTag,
702         othTag = arrayTag;
703
704     if (!objIsArr) {
705       objTag = baseGetTag(object);
706       objTag = objTag == argsTag ? objectTag : objTag;
707     }
708     if (!othIsArr) {
709       othTag = baseGetTag(other);
710       othTag = othTag == argsTag ? objectTag : othTag;
711     }
712     var objIsObj = objTag == objectTag,
713         othIsObj = othTag == objectTag,
714         isSameTag = objTag == othTag;
715
716     stack || (stack = []);
717     var objStack = find(stack, function(entry) {
718       return entry[0] == object;
719     });
720     var othStack = find(stack, function(entry) {
721       return entry[0] == other;
722     });
723     if (objStack && othStack) {
724       return objStack[1] == other;
725     }
726     stack.push([object, other]);
727     stack.push([other, object]);
728     if (isSameTag && !objIsObj) {
729       var result = (objIsArr)
730         ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
731         : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
732       stack.pop();
733       return result;
734     }
735     if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
736       var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
737           othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
738
739       if (objIsWrapped || othIsWrapped) {
740         var objUnwrapped = objIsWrapped ? object.value() : object,
741             othUnwrapped = othIsWrapped ? other.value() : other;
742
743         var result = equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
744         stack.pop();
745         return result;
746       }
747     }
748     if (!isSameTag) {
749       return false;
750     }
751     var result = equalObjects(object, other, equalFunc, customizer, bitmask, stack);
752     stack.pop();
753     return result;
754   }
755
756   /**
757    * The base implementation of `_.isRegExp` without Node.js optimizations.
758    *
759    * @private
760    * @param {*} value The value to check.
761    * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
762    */
763   function baseIsRegExp(value) {
764     return isObjectLike(value) && baseGetTag(value) == regexpTag;
765   }
766
767   /**
768    * The base implementation of `_.iteratee`.
769    *
770    * @private
771    * @param {*} [value=_.identity] The value to convert to an iteratee.
772    * @returns {Function} Returns the iteratee.
773    */
774   function baseIteratee(func) {
775     if (typeof func == 'function') {
776       return func;
777     }
778     if (func == null) {
779       return identity;
780     }
781     return (typeof func == 'object' ? baseMatches : baseProperty)(func);
782   }
783
784   /**
785    * The base implementation of `_.lt` which doesn't coerce arguments.
786    *
787    * @private
788    * @param {*} value The value to compare.
789    * @param {*} other The other value to compare.
790    * @returns {boolean} Returns `true` if `value` is less than `other`,
791    *  else `false`.
792    */
793   function baseLt(value, other) {
794     return value < other;
795   }
796
797   /**
798    * The base implementation of `_.map` without support for iteratee shorthands.
799    *
800    * @private
801    * @param {Array|Object} collection The collection to iterate over.
802    * @param {Function} iteratee The function invoked per iteration.
803    * @returns {Array} Returns the new mapped array.
804    */
805   function baseMap(collection, iteratee) {
806     var index = -1,
807         result = isArrayLike(collection) ? Array(collection.length) : [];
808
809     baseEach(collection, function(value, key, collection) {
810       result[++index] = iteratee(value, key, collection);
811     });
812     return result;
813   }
814
815   /**
816    * The base implementation of `_.matches` which doesn't clone `source`.
817    *
818    * @private
819    * @param {Object} source The object of property values to match.
820    * @returns {Function} Returns the new spec function.
821    */
822   function baseMatches(source) {
823     var props = nativeKeys(source);
824     return function(object) {
825       var length = props.length;
826       if (object == null) {
827         return !length;
828       }
829       object = Object(object);
830       while (length--) {
831         var key = props[length];
832         if (!(key in object &&
833               baseIsEqual(source[key], object[key], undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG)
834             )) {
835           return false;
836         }
837       }
838       return true;
839     };
840   }
841
842   /**
843    * The base implementation of `_.pick` without support for individual
844    * property identifiers.
845    *
846    * @private
847    * @param {Object} object The source object.
848    * @param {string[]} props The property identifiers to pick.
849    * @returns {Object} Returns the new object.
850    */
851   function basePick(object, props) {
852     object = Object(object);
853     return reduce(props, function(result, key) {
854       if (key in object) {
855         result[key] = object[key];
856       }
857       return result;
858     }, {});
859   }
860
861   /**
862    * The base implementation of `_.rest` which doesn't validate or coerce arguments.
863    *
864    * @private
865    * @param {Function} func The function to apply a rest parameter to.
866    * @param {number} [start=func.length-1] The start position of the rest parameter.
867    * @returns {Function} Returns the new function.
868    */
869   function baseRest(func, start) {
870     return setToString(overRest(func, start, identity), func + '');
871   }
872
873   /**
874    * The base implementation of `_.slice` without an iteratee call guard.
875    *
876    * @private
877    * @param {Array} array The array to slice.
878    * @param {number} [start=0] The start position.
879    * @param {number} [end=array.length] The end position.
880    * @returns {Array} Returns the slice of `array`.
881    */
882   function baseSlice(array, start, end) {
883     var index = -1,
884         length = array.length;
885
886     if (start < 0) {
887       start = -start > length ? 0 : (length + start);
888     }
889     end = end > length ? length : end;
890     if (end < 0) {
891       end += length;
892     }
893     length = start > end ? 0 : ((end - start) >>> 0);
894     start >>>= 0;
895
896     var result = Array(length);
897     while (++index < length) {
898       result[index] = array[index + start];
899     }
900     return result;
901   }
902
903   /**
904    * Copies the values of `source` to `array`.
905    *
906    * @private
907    * @param {Array} source The array to copy values from.
908    * @param {Array} [array=[]] The array to copy values to.
909    * @returns {Array} Returns `array`.
910    */
911   function copyArray(source) {
912     return baseSlice(source, 0, source.length);
913   }
914
915   /**
916    * The base implementation of `_.some` without support for iteratee shorthands.
917    *
918    * @private
919    * @param {Array|Object} collection The collection to iterate over.
920    * @param {Function} predicate The function invoked per iteration.
921    * @returns {boolean} Returns `true` if any element passes the predicate check,
922    *  else `false`.
923    */
924   function baseSome(collection, predicate) {
925     var result;
926
927     baseEach(collection, function(value, index, collection) {
928       result = predicate(value, index, collection);
929       return !result;
930     });
931     return !!result;
932   }
933
934   /**
935    * The base implementation of `wrapperValue` which returns the result of
936    * performing a sequence of actions on the unwrapped `value`, where each
937    * successive action is supplied the return value of the previous.
938    *
939    * @private
940    * @param {*} value The unwrapped value.
941    * @param {Array} actions Actions to perform to resolve the unwrapped value.
942    * @returns {*} Returns the resolved value.
943    */
944   function baseWrapperValue(value, actions) {
945     var result = value;
946     return reduce(actions, function(result, action) {
947       return action.func.apply(action.thisArg, arrayPush([result], action.args));
948     }, result);
949   }
950
951   /**
952    * Compares values to sort them in ascending order.
953    *
954    * @private
955    * @param {*} value The value to compare.
956    * @param {*} other The other value to compare.
957    * @returns {number} Returns the sort order indicator for `value`.
958    */
959   function compareAscending(value, other) {
960     if (value !== other) {
961       var valIsDefined = value !== undefined,
962           valIsNull = value === null,
963           valIsReflexive = value === value,
964           valIsSymbol = false;
965
966       var othIsDefined = other !== undefined,
967           othIsNull = other === null,
968           othIsReflexive = other === other,
969           othIsSymbol = false;
970
971       if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
972           (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
973           (valIsNull && othIsDefined && othIsReflexive) ||
974           (!valIsDefined && othIsReflexive) ||
975           !valIsReflexive) {
976         return 1;
977       }
978       if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
979           (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
980           (othIsNull && valIsDefined && valIsReflexive) ||
981           (!othIsDefined && valIsReflexive) ||
982           !othIsReflexive) {
983         return -1;
984       }
985     }
986     return 0;
987   }
988
989   /**
990    * Copies properties of `source` to `object`.
991    *
992    * @private
993    * @param {Object} source The object to copy properties from.
994    * @param {Array} props The property identifiers to copy.
995    * @param {Object} [object={}] The object to copy properties to.
996    * @param {Function} [customizer] The function to customize copied values.
997    * @returns {Object} Returns `object`.
998    */
999   function copyObject(source, props, object, customizer) {
1000     var isNew = !object;
1001     object || (object = {});
1002
1003     var index = -1,
1004         length = props.length;
1005
1006     while (++index < length) {
1007       var key = props[index];
1008
1009       var newValue = customizer
1010         ? customizer(object[key], source[key], key, object, source)
1011         : undefined;
1012
1013       if (newValue === undefined) {
1014         newValue = source[key];
1015       }
1016       if (isNew) {
1017         baseAssignValue(object, key, newValue);
1018       } else {
1019         assignValue(object, key, newValue);
1020       }
1021     }
1022     return object;
1023   }
1024
1025   /**
1026    * Creates a function like `_.assign`.
1027    *
1028    * @private
1029    * @param {Function} assigner The function to assign values.
1030    * @returns {Function} Returns the new assigner function.
1031    */
1032   function createAssigner(assigner) {
1033     return baseRest(function(object, sources) {
1034       var index = -1,
1035           length = sources.length,
1036           customizer = length > 1 ? sources[length - 1] : undefined;
1037
1038       customizer = (assigner.length > 3 && typeof customizer == 'function')
1039         ? (length--, customizer)
1040         : undefined;
1041
1042       object = Object(object);
1043       while (++index < length) {
1044         var source = sources[index];
1045         if (source) {
1046           assigner(object, source, index, customizer);
1047         }
1048       }
1049       return object;
1050     });
1051   }
1052
1053   /**
1054    * Creates a `baseEach` or `baseEachRight` function.
1055    *
1056    * @private
1057    * @param {Function} eachFunc The function to iterate over a collection.
1058    * @param {boolean} [fromRight] Specify iterating from right to left.
1059    * @returns {Function} Returns the new base function.
1060    */
1061   function createBaseEach(eachFunc, fromRight) {
1062     return function(collection, iteratee) {
1063       if (collection == null) {
1064         return collection;
1065       }
1066       if (!isArrayLike(collection)) {
1067         return eachFunc(collection, iteratee);
1068       }
1069       var length = collection.length,
1070           index = fromRight ? length : -1,
1071           iterable = Object(collection);
1072
1073       while ((fromRight ? index-- : ++index < length)) {
1074         if (iteratee(iterable[index], index, iterable) === false) {
1075           break;
1076         }
1077       }
1078       return collection;
1079     };
1080   }
1081
1082   /**
1083    * Creates a base function for methods like `_.forIn` and `_.forOwn`.
1084    *
1085    * @private
1086    * @param {boolean} [fromRight] Specify iterating from right to left.
1087    * @returns {Function} Returns the new base function.
1088    */
1089   function createBaseFor(fromRight) {
1090     return function(object, iteratee, keysFunc) {
1091       var index = -1,
1092           iterable = Object(object),
1093           props = keysFunc(object),
1094           length = props.length;
1095
1096       while (length--) {
1097         var key = props[fromRight ? length : ++index];
1098         if (iteratee(iterable[key], key, iterable) === false) {
1099           break;
1100         }
1101       }
1102       return object;
1103     };
1104   }
1105
1106   /**
1107    * Creates a function that produces an instance of `Ctor` regardless of
1108    * whether it was invoked as part of a `new` expression or by `call` or `apply`.
1109    *
1110    * @private
1111    * @param {Function} Ctor The constructor to wrap.
1112    * @returns {Function} Returns the new wrapped function.
1113    */
1114   function createCtor(Ctor) {
1115     return function() {
1116       // Use a `switch` statement to work with class constructors. See
1117       // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
1118       // for more details.
1119       var args = arguments;
1120       var thisBinding = baseCreate(Ctor.prototype),
1121           result = Ctor.apply(thisBinding, args);
1122
1123       // Mimic the constructor's `return` behavior.
1124       // See https://es5.github.io/#x13.2.2 for more details.
1125       return isObject(result) ? result : thisBinding;
1126     };
1127   }
1128
1129   /**
1130    * Creates a `_.find` or `_.findLast` function.
1131    *
1132    * @private
1133    * @param {Function} findIndexFunc The function to find the collection index.
1134    * @returns {Function} Returns the new find function.
1135    */
1136   function createFind(findIndexFunc) {
1137     return function(collection, predicate, fromIndex) {
1138       var iterable = Object(collection);
1139       if (!isArrayLike(collection)) {
1140         var iteratee = baseIteratee(predicate, 3);
1141         collection = keys(collection);
1142         predicate = function(key) { return iteratee(iterable[key], key, iterable); };
1143       }
1144       var index = findIndexFunc(collection, predicate, fromIndex);
1145       return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
1146     };
1147   }
1148
1149   /**
1150    * Creates a function that wraps `func` to invoke it with the `this` binding
1151    * of `thisArg` and `partials` prepended to the arguments it receives.
1152    *
1153    * @private
1154    * @param {Function} func The function to wrap.
1155    * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
1156    * @param {*} thisArg The `this` binding of `func`.
1157    * @param {Array} partials The arguments to prepend to those provided to
1158    *  the new function.
1159    * @returns {Function} Returns the new wrapped function.
1160    */
1161   function createPartial(func, bitmask, thisArg, partials) {
1162     if (typeof func != 'function') {
1163       throw new TypeError(FUNC_ERROR_TEXT);
1164     }
1165     var isBind = bitmask & BIND_FLAG,
1166         Ctor = createCtor(func);
1167
1168     function wrapper() {
1169       var argsIndex = -1,
1170           argsLength = arguments.length,
1171           leftIndex = -1,
1172           leftLength = partials.length,
1173           args = Array(leftLength + argsLength),
1174           fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
1175
1176       while (++leftIndex < leftLength) {
1177         args[leftIndex] = partials[leftIndex];
1178       }
1179       while (argsLength--) {
1180         args[leftIndex++] = arguments[++argsIndex];
1181       }
1182       return fn.apply(isBind ? thisArg : this, args);
1183     }
1184     return wrapper;
1185   }
1186
1187   /**
1188    * A specialized version of `baseIsEqualDeep` for arrays with support for
1189    * partial deep comparisons.
1190    *
1191    * @private
1192    * @param {Array} array The array to compare.
1193    * @param {Array} other The other array to compare.
1194    * @param {Function} equalFunc The function to determine equivalents of values.
1195    * @param {Function} customizer The function to customize comparisons.
1196    * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
1197    *  for more details.
1198    * @param {Object} stack Tracks traversed `array` and `other` objects.
1199    * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1200    */
1201   function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
1202     var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
1203         arrLength = array.length,
1204         othLength = other.length;
1205
1206     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1207       return false;
1208     }
1209     var index = -1,
1210         result = true,
1211         seen = (bitmask & UNORDERED_COMPARE_FLAG) ? [] : undefined;
1212
1213     // Ignore non-index properties.
1214     while (++index < arrLength) {
1215       var arrValue = array[index],
1216           othValue = other[index];
1217
1218       var compared;
1219       if (compared !== undefined) {
1220         if (compared) {
1221           continue;
1222         }
1223         result = false;
1224         break;
1225       }
1226       // Recursively compare arrays (susceptible to call stack limits).
1227       if (seen) {
1228         if (!baseSome(other, function(othValue, othIndex) {
1229               if (!indexOf(seen, othIndex) &&
1230                   (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
1231                 return seen.push(othIndex);
1232               }
1233             })) {
1234           result = false;
1235           break;
1236         }
1237       } else if (!(
1238             arrValue === othValue ||
1239               equalFunc(arrValue, othValue, customizer, bitmask, stack)
1240           )) {
1241         result = false;
1242         break;
1243       }
1244     }
1245     return result;
1246   }
1247
1248   /**
1249    * A specialized version of `baseIsEqualDeep` for comparing objects of
1250    * the same `toStringTag`.
1251    *
1252    * **Note:** This function only supports comparing values with tags of
1253    * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1254    *
1255    * @private
1256    * @param {Object} object The object to compare.
1257    * @param {Object} other The other object to compare.
1258    * @param {string} tag The `toStringTag` of the objects to compare.
1259    * @param {Function} equalFunc The function to determine equivalents of values.
1260    * @param {Function} customizer The function to customize comparisons.
1261    * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
1262    *  for more details.
1263    * @param {Object} stack Tracks traversed `object` and `other` objects.
1264    * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1265    */
1266   function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
1267     switch (tag) {
1268
1269       case boolTag:
1270       case dateTag:
1271       case numberTag:
1272         // Coerce booleans to `1` or `0` and dates to milliseconds.
1273         // Invalid dates are coerced to `NaN`.
1274         return eq(+object, +other);
1275
1276       case errorTag:
1277         return object.name == other.name && object.message == other.message;
1278
1279       case regexpTag:
1280       case stringTag:
1281         // Coerce regexes to strings and treat strings, primitives and objects,
1282         // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1283         // for more details.
1284         return object == (other + '');
1285
1286     }
1287     return false;
1288   }
1289
1290   /**
1291    * A specialized version of `baseIsEqualDeep` for objects with support for
1292    * partial deep comparisons.
1293    *
1294    * @private
1295    * @param {Object} object The object to compare.
1296    * @param {Object} other The other object to compare.
1297    * @param {Function} equalFunc The function to determine equivalents of values.
1298    * @param {Function} customizer The function to customize comparisons.
1299    * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
1300    *  for more details.
1301    * @param {Object} stack Tracks traversed `object` and `other` objects.
1302    * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1303    */
1304   function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
1305     var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
1306         objProps = keys(object),
1307         objLength = objProps.length,
1308         othProps = keys(other),
1309         othLength = othProps.length;
1310
1311     if (objLength != othLength && !isPartial) {
1312       return false;
1313     }
1314     var index = objLength;
1315     while (index--) {
1316       var key = objProps[index];
1317       if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1318         return false;
1319       }
1320     }
1321     var result = true;
1322
1323     var skipCtor = isPartial;
1324     while (++index < objLength) {
1325       key = objProps[index];
1326       var objValue = object[key],
1327           othValue = other[key];
1328
1329       var compared;
1330       // Recursively compare objects (susceptible to call stack limits).
1331       if (!(compared === undefined
1332             ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
1333             : compared
1334           )) {
1335         result = false;
1336         break;
1337       }
1338       skipCtor || (skipCtor = key == 'constructor');
1339     }
1340     if (result && !skipCtor) {
1341       var objCtor = object.constructor,
1342           othCtor = other.constructor;
1343
1344       // Non `Object` object instances with different constructors are not equal.
1345       if (objCtor != othCtor &&
1346           ('constructor' in object && 'constructor' in other) &&
1347           !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1348             typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1349         result = false;
1350       }
1351     }
1352     return result;
1353   }
1354
1355   /**
1356    * A specialized version of `baseRest` which flattens the rest array.
1357    *
1358    * @private
1359    * @param {Function} func The function to apply a rest parameter to.
1360    * @returns {Function} Returns the new function.
1361    */
1362   function flatRest(func) {
1363     return setToString(overRest(func, undefined, flatten), func + '');
1364   }
1365
1366   /**
1367    * Checks if `value` is a flattenable `arguments` object or array.
1368    *
1369    * @private
1370    * @param {*} value The value to check.
1371    * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
1372    */
1373   function isFlattenable(value) {
1374     return isArray(value) || isArguments(value);
1375   }
1376
1377   /**
1378    * This function is like
1379    * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1380    * except that it includes inherited enumerable properties.
1381    *
1382    * @private
1383    * @param {Object} object The object to query.
1384    * @returns {Array} Returns the array of property names.
1385    */
1386   function nativeKeysIn(object) {
1387     var result = [];
1388     if (object != null) {
1389       for (var key in Object(object)) {
1390         result.push(key);
1391       }
1392     }
1393     return result;
1394   }
1395
1396   /**
1397    * Converts `value` to a string using `Object.prototype.toString`.
1398    *
1399    * @private
1400    * @param {*} value The value to convert.
1401    * @returns {string} Returns the converted string.
1402    */
1403   function objectToString(value) {
1404     return nativeObjectToString.call(value);
1405   }
1406
1407   /**
1408    * A specialized version of `baseRest` which transforms the rest array.
1409    *
1410    * @private
1411    * @param {Function} func The function to apply a rest parameter to.
1412    * @param {number} [start=func.length-1] The start position of the rest parameter.
1413    * @param {Function} transform The rest array transform.
1414    * @returns {Function} Returns the new function.
1415    */
1416   function overRest(func, start, transform) {
1417     start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
1418     return function() {
1419       var args = arguments,
1420           index = -1,
1421           length = nativeMax(args.length - start, 0),
1422           array = Array(length);
1423
1424       while (++index < length) {
1425         array[index] = args[start + index];
1426       }
1427       index = -1;
1428       var otherArgs = Array(start + 1);
1429       while (++index < start) {
1430         otherArgs[index] = args[index];
1431       }
1432       otherArgs[start] = transform(array);
1433       return func.apply(this, otherArgs);
1434     };
1435   }
1436
1437   /**
1438    * Sets the `toString` method of `func` to return `string`.
1439    *
1440    * @private
1441    * @param {Function} func The function to modify.
1442    * @param {Function} string The `toString` result.
1443    * @returns {Function} Returns `func`.
1444    */
1445   var setToString = identity;
1446
1447   /**
1448    * Converts `value` to a string key if it's not a string or symbol.
1449    *
1450    * @private
1451    * @param {*} value The value to inspect.
1452    * @returns {string|symbol} Returns the key.
1453    */
1454   var toKey = String;
1455
1456   /*------------------------------------------------------------------------*/
1457
1458   /**
1459    * Creates an array with all falsey values removed. The values `false`, `null`,
1460    * `0`, `""`, `undefined`, and `NaN` are falsey.
1461    *
1462    * @static
1463    * @memberOf _
1464    * @since 0.1.0
1465    * @category Array
1466    * @param {Array} array The array to compact.
1467    * @returns {Array} Returns the new array of filtered values.
1468    * @example
1469    *
1470    * _.compact([0, 1, false, 2, '', 3]);
1471    * // => [1, 2, 3]
1472    */
1473   function compact(array) {
1474     return baseFilter(array, Boolean);
1475   }
1476
1477   /**
1478    * Creates a new array concatenating `array` with any additional arrays
1479    * and/or values.
1480    *
1481    * @static
1482    * @memberOf _
1483    * @since 4.0.0
1484    * @category Array
1485    * @param {Array} array The array to concatenate.
1486    * @param {...*} [values] The values to concatenate.
1487    * @returns {Array} Returns the new concatenated array.
1488    * @example
1489    *
1490    * var array = [1];
1491    * var other = _.concat(array, 2, [3], [[4]]);
1492    *
1493    * console.log(other);
1494    * // => [1, 2, 3, [4]]
1495    *
1496    * console.log(array);
1497    * // => [1]
1498    */
1499   function concat() {
1500     var length = arguments.length;
1501     if (!length) {
1502       return [];
1503     }
1504     var args = Array(length - 1),
1505         array = arguments[0],
1506         index = length;
1507
1508     while (index--) {
1509       args[index - 1] = arguments[index];
1510     }
1511     return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
1512   }
1513
1514   /**
1515    * This method is like `_.find` except that it returns the index of the first
1516    * element `predicate` returns truthy for instead of the element itself.
1517    *
1518    * @static
1519    * @memberOf _
1520    * @since 1.1.0
1521    * @category Array
1522    * @param {Array} array The array to inspect.
1523    * @param {Function} [predicate=_.identity] The function invoked per iteration.
1524    * @param {number} [fromIndex=0] The index to search from.
1525    * @returns {number} Returns the index of the found element, else `-1`.
1526    * @example
1527    *
1528    * var users = [
1529    *   { 'user': 'barney',  'active': false },
1530    *   { 'user': 'fred',    'active': false },
1531    *   { 'user': 'pebbles', 'active': true }
1532    * ];
1533    *
1534    * _.findIndex(users, function(o) { return o.user == 'barney'; });
1535    * // => 0
1536    *
1537    * // The `_.matches` iteratee shorthand.
1538    * _.findIndex(users, { 'user': 'fred', 'active': false });
1539    * // => 1
1540    *
1541    * // The `_.matchesProperty` iteratee shorthand.
1542    * _.findIndex(users, ['active', false]);
1543    * // => 0
1544    *
1545    * // The `_.property` iteratee shorthand.
1546    * _.findIndex(users, 'active');
1547    * // => 2
1548    */
1549   function findIndex(array, predicate, fromIndex) {
1550     var length = array == null ? 0 : array.length;
1551     if (!length) {
1552       return -1;
1553     }
1554     var index = fromIndex == null ? 0 : toInteger(fromIndex);
1555     if (index < 0) {
1556       index = nativeMax(length + index, 0);
1557     }
1558     return baseFindIndex(array, baseIteratee(predicate, 3), index);
1559   }
1560
1561   /**
1562    * Flattens `array` a single level deep.
1563    *
1564    * @static
1565    * @memberOf _
1566    * @since 0.1.0
1567    * @category Array
1568    * @param {Array} array The array to flatten.
1569    * @returns {Array} Returns the new flattened array.
1570    * @example
1571    *
1572    * _.flatten([1, [2, [3, [4]], 5]]);
1573    * // => [1, 2, [3, [4]], 5]
1574    */
1575   function flatten(array) {
1576     var length = array == null ? 0 : array.length;
1577     return length ? baseFlatten(array, 1) : [];
1578   }
1579
1580   /**
1581    * Recursively flattens `array`.
1582    *
1583    * @static
1584    * @memberOf _
1585    * @since 3.0.0
1586    * @category Array
1587    * @param {Array} array The array to flatten.
1588    * @returns {Array} Returns the new flattened array.
1589    * @example
1590    *
1591    * _.flattenDeep([1, [2, [3, [4]], 5]]);
1592    * // => [1, 2, 3, 4, 5]
1593    */
1594   function flattenDeep(array) {
1595     var length = array == null ? 0 : array.length;
1596     return length ? baseFlatten(array, INFINITY) : [];
1597   }
1598
1599   /**
1600    * Gets the first element of `array`.
1601    *
1602    * @static
1603    * @memberOf _
1604    * @since 0.1.0
1605    * @alias first
1606    * @category Array
1607    * @param {Array} array The array to query.
1608    * @returns {*} Returns the first element of `array`.
1609    * @example
1610    *
1611    * _.head([1, 2, 3]);
1612    * // => 1
1613    *
1614    * _.head([]);
1615    * // => undefined
1616    */
1617   function head(array) {
1618     return (array && array.length) ? array[0] : undefined;
1619   }
1620
1621   /**
1622    * Gets the index at which the first occurrence of `value` is found in `array`
1623    * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1624    * for equality comparisons. If `fromIndex` is negative, it's used as the
1625    * offset from the end of `array`.
1626    *
1627    * @static
1628    * @memberOf _
1629    * @since 0.1.0
1630    * @category Array
1631    * @param {Array} array The array to inspect.
1632    * @param {*} value The value to search for.
1633    * @param {number} [fromIndex=0] The index to search from.
1634    * @returns {number} Returns the index of the matched value, else `-1`.
1635    * @example
1636    *
1637    * _.indexOf([1, 2, 1, 2], 2);
1638    * // => 1
1639    *
1640    * // Search from the `fromIndex`.
1641    * _.indexOf([1, 2, 1, 2], 2, 2);
1642    * // => 3
1643    */
1644   function indexOf(array, value, fromIndex) {
1645     var length = array == null ? 0 : array.length;
1646     if (typeof fromIndex == 'number') {
1647       fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
1648     } else {
1649       fromIndex = 0;
1650     }
1651     var index = (fromIndex || 0) - 1,
1652         isReflexive = value === value;
1653
1654     while (++index < length) {
1655       var other = array[index];
1656       if ((isReflexive ? other === value : other !== other)) {
1657         return index;
1658       }
1659     }
1660     return -1;
1661   }
1662
1663   /**
1664    * Gets the last element of `array`.
1665    *
1666    * @static
1667    * @memberOf _
1668    * @since 0.1.0
1669    * @category Array
1670    * @param {Array} array The array to query.
1671    * @returns {*} Returns the last element of `array`.
1672    * @example
1673    *
1674    * _.last([1, 2, 3]);
1675    * // => 3
1676    */
1677   function last(array) {
1678     var length = array == null ? 0 : array.length;
1679     return length ? array[length - 1] : undefined;
1680   }
1681
1682   /**
1683    * Creates a slice of `array` from `start` up to, but not including, `end`.
1684    *
1685    * **Note:** This method is used instead of
1686    * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
1687    * returned.
1688    *
1689    * @static
1690    * @memberOf _
1691    * @since 3.0.0
1692    * @category Array
1693    * @param {Array} array The array to slice.
1694    * @param {number} [start=0] The start position.
1695    * @param {number} [end=array.length] The end position.
1696    * @returns {Array} Returns the slice of `array`.
1697    */
1698   function slice(array, start, end) {
1699     var length = array == null ? 0 : array.length;
1700     start = start == null ? 0 : +start;
1701     end = end === undefined ? length : +end;
1702     return length ? baseSlice(array, start, end) : [];
1703   }
1704
1705   /*------------------------------------------------------------------------*/
1706
1707   /**
1708    * Creates a `lodash` wrapper instance that wraps `value` with explicit method
1709    * chain sequences enabled. The result of such sequences must be unwrapped
1710    * with `_#value`.
1711    *
1712    * @static
1713    * @memberOf _
1714    * @since 1.3.0
1715    * @category Seq
1716    * @param {*} value The value to wrap.
1717    * @returns {Object} Returns the new `lodash` wrapper instance.
1718    * @example
1719    *
1720    * var users = [
1721    *   { 'user': 'barney',  'age': 36 },
1722    *   { 'user': 'fred',    'age': 40 },
1723    *   { 'user': 'pebbles', 'age': 1 }
1724    * ];
1725    *
1726    * var youngest = _
1727    *   .chain(users)
1728    *   .sortBy('age')
1729    *   .map(function(o) {
1730    *     return o.user + ' is ' + o.age;
1731    *   })
1732    *   .head()
1733    *   .value();
1734    * // => 'pebbles is 1'
1735    */
1736   function chain(value) {
1737     var result = lodash(value);
1738     result.__chain__ = true;
1739     return result;
1740   }
1741
1742   /**
1743    * This method invokes `interceptor` and returns `value`. The interceptor
1744    * is invoked with one argument; (value). The purpose of this method is to
1745    * "tap into" a method chain sequence in order to modify intermediate results.
1746    *
1747    * @static
1748    * @memberOf _
1749    * @since 0.1.0
1750    * @category Seq
1751    * @param {*} value The value to provide to `interceptor`.
1752    * @param {Function} interceptor The function to invoke.
1753    * @returns {*} Returns `value`.
1754    * @example
1755    *
1756    * _([1, 2, 3])
1757    *  .tap(function(array) {
1758    *    // Mutate input array.
1759    *    array.pop();
1760    *  })
1761    *  .reverse()
1762    *  .value();
1763    * // => [2, 1]
1764    */
1765   function tap(value, interceptor) {
1766     interceptor(value);
1767     return value;
1768   }
1769
1770   /**
1771    * This method is like `_.tap` except that it returns the result of `interceptor`.
1772    * The purpose of this method is to "pass thru" values replacing intermediate
1773    * results in a method chain sequence.
1774    *
1775    * @static
1776    * @memberOf _
1777    * @since 3.0.0
1778    * @category Seq
1779    * @param {*} value The value to provide to `interceptor`.
1780    * @param {Function} interceptor The function to invoke.
1781    * @returns {*} Returns the result of `interceptor`.
1782    * @example
1783    *
1784    * _('  abc  ')
1785    *  .chain()
1786    *  .trim()
1787    *  .thru(function(value) {
1788    *    return [value];
1789    *  })
1790    *  .value();
1791    * // => ['abc']
1792    */
1793   function thru(value, interceptor) {
1794     return interceptor(value);
1795   }
1796
1797   /**
1798    * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
1799    *
1800    * @name chain
1801    * @memberOf _
1802    * @since 0.1.0
1803    * @category Seq
1804    * @returns {Object} Returns the new `lodash` wrapper instance.
1805    * @example
1806    *
1807    * var users = [
1808    *   { 'user': 'barney', 'age': 36 },
1809    *   { 'user': 'fred',   'age': 40 }
1810    * ];
1811    *
1812    * // A sequence without explicit chaining.
1813    * _(users).head();
1814    * // => { 'user': 'barney', 'age': 36 }
1815    *
1816    * // A sequence with explicit chaining.
1817    * _(users)
1818    *   .chain()
1819    *   .head()
1820    *   .pick('user')
1821    *   .value();
1822    * // => { 'user': 'barney' }
1823    */
1824   function wrapperChain() {
1825     return chain(this);
1826   }
1827
1828   /**
1829    * Executes the chain sequence to resolve the unwrapped value.
1830    *
1831    * @name value
1832    * @memberOf _
1833    * @since 0.1.0
1834    * @alias toJSON, valueOf
1835    * @category Seq
1836    * @returns {*} Returns the resolved unwrapped value.
1837    * @example
1838    *
1839    * _([1, 2, 3]).value();
1840    * // => [1, 2, 3]
1841    */
1842   function wrapperValue() {
1843     return baseWrapperValue(this.__wrapped__, this.__actions__);
1844   }
1845
1846   /*------------------------------------------------------------------------*/
1847
1848   /**
1849    * Checks if `predicate` returns truthy for **all** elements of `collection`.
1850    * Iteration is stopped once `predicate` returns falsey. The predicate is
1851    * invoked with three arguments: (value, index|key, collection).
1852    *
1853    * **Note:** This method returns `true` for
1854    * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
1855    * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
1856    * elements of empty collections.
1857    *
1858    * @static
1859    * @memberOf _
1860    * @since 0.1.0
1861    * @category Collection
1862    * @param {Array|Object} collection The collection to iterate over.
1863    * @param {Function} [predicate=_.identity] The function invoked per iteration.
1864    * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
1865    * @returns {boolean} Returns `true` if all elements pass the predicate check,
1866    *  else `false`.
1867    * @example
1868    *
1869    * _.every([true, 1, null, 'yes'], Boolean);
1870    * // => false
1871    *
1872    * var users = [
1873    *   { 'user': 'barney', 'age': 36, 'active': false },
1874    *   { 'user': 'fred',   'age': 40, 'active': false }
1875    * ];
1876    *
1877    * // The `_.matches` iteratee shorthand.
1878    * _.every(users, { 'user': 'barney', 'active': false });
1879    * // => false
1880    *
1881    * // The `_.matchesProperty` iteratee shorthand.
1882    * _.every(users, ['active', false]);
1883    * // => true
1884    *
1885    * // The `_.property` iteratee shorthand.
1886    * _.every(users, 'active');
1887    * // => false
1888    */
1889   function every(collection, predicate, guard) {
1890     predicate = guard ? undefined : predicate;
1891     return baseEvery(collection, baseIteratee(predicate));
1892   }
1893
1894   /**
1895    * Iterates over elements of `collection`, returning an array of all elements
1896    * `predicate` returns truthy for. The predicate is invoked with three
1897    * arguments: (value, index|key, collection).
1898    *
1899    * **Note:** Unlike `_.remove`, this method returns a new array.
1900    *
1901    * @static
1902    * @memberOf _
1903    * @since 0.1.0
1904    * @category Collection
1905    * @param {Array|Object} collection The collection to iterate over.
1906    * @param {Function} [predicate=_.identity] The function invoked per iteration.
1907    * @returns {Array} Returns the new filtered array.
1908    * @see _.reject
1909    * @example
1910    *
1911    * var users = [
1912    *   { 'user': 'barney', 'age': 36, 'active': true },
1913    *   { 'user': 'fred',   'age': 40, 'active': false }
1914    * ];
1915    *
1916    * _.filter(users, function(o) { return !o.active; });
1917    * // => objects for ['fred']
1918    *
1919    * // The `_.matches` iteratee shorthand.
1920    * _.filter(users, { 'age': 36, 'active': true });
1921    * // => objects for ['barney']
1922    *
1923    * // The `_.matchesProperty` iteratee shorthand.
1924    * _.filter(users, ['active', false]);
1925    * // => objects for ['fred']
1926    *
1927    * // The `_.property` iteratee shorthand.
1928    * _.filter(users, 'active');
1929    * // => objects for ['barney']
1930    */
1931   function filter(collection, predicate) {
1932     return baseFilter(collection, baseIteratee(predicate));
1933   }
1934
1935   /**
1936    * Iterates over elements of `collection`, returning the first element
1937    * `predicate` returns truthy for. The predicate is invoked with three
1938    * arguments: (value, index|key, collection).
1939    *
1940    * @static
1941    * @memberOf _
1942    * @since 0.1.0
1943    * @category Collection
1944    * @param {Array|Object} collection The collection to inspect.
1945    * @param {Function} [predicate=_.identity] The function invoked per iteration.
1946    * @param {number} [fromIndex=0] The index to search from.
1947    * @returns {*} Returns the matched element, else `undefined`.
1948    * @example
1949    *
1950    * var users = [
1951    *   { 'user': 'barney',  'age': 36, 'active': true },
1952    *   { 'user': 'fred',    'age': 40, 'active': false },
1953    *   { 'user': 'pebbles', 'age': 1,  'active': true }
1954    * ];
1955    *
1956    * _.find(users, function(o) { return o.age < 40; });
1957    * // => object for 'barney'
1958    *
1959    * // The `_.matches` iteratee shorthand.
1960    * _.find(users, { 'age': 1, 'active': true });
1961    * // => object for 'pebbles'
1962    *
1963    * // The `_.matchesProperty` iteratee shorthand.
1964    * _.find(users, ['active', false]);
1965    * // => object for 'fred'
1966    *
1967    * // The `_.property` iteratee shorthand.
1968    * _.find(users, 'active');
1969    * // => object for 'barney'
1970    */
1971   var find = createFind(findIndex);
1972
1973   /**
1974    * Iterates over elements of `collection` and invokes `iteratee` for each element.
1975    * The iteratee is invoked with three arguments: (value, index|key, collection).
1976    * Iteratee functions may exit iteration early by explicitly returning `false`.
1977    *
1978    * **Note:** As with other "Collections" methods, objects with a "length"
1979    * property are iterated like arrays. To avoid this behavior use `_.forIn`
1980    * or `_.forOwn` for object iteration.
1981    *
1982    * @static
1983    * @memberOf _
1984    * @since 0.1.0
1985    * @alias each
1986    * @category Collection
1987    * @param {Array|Object} collection The collection to iterate over.
1988    * @param {Function} [iteratee=_.identity] The function invoked per iteration.
1989    * @returns {Array|Object} Returns `collection`.
1990    * @see _.forEachRight
1991    * @example
1992    *
1993    * _.forEach([1, 2], function(value) {
1994    *   console.log(value);
1995    * });
1996    * // => Logs `1` then `2`.
1997    *
1998    * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
1999    *   console.log(key);
2000    * });
2001    * // => Logs 'a' then 'b' (iteration order is not guaranteed).
2002    */
2003   function forEach(collection, iteratee) {
2004     return baseEach(collection, baseIteratee(iteratee));
2005   }
2006
2007   /**
2008    * Creates an array of values by running each element in `collection` thru
2009    * `iteratee`. The iteratee is invoked with three arguments:
2010    * (value, index|key, collection).
2011    *
2012    * Many lodash methods are guarded to work as iteratees for methods like
2013    * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
2014    *
2015    * The guarded methods are:
2016    * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
2017    * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
2018    * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
2019    * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
2020    *
2021    * @static
2022    * @memberOf _
2023    * @since 0.1.0
2024    * @category Collection
2025    * @param {Array|Object} collection The collection to iterate over.
2026    * @param {Function} [iteratee=_.identity] The function invoked per iteration.
2027    * @returns {Array} Returns the new mapped array.
2028    * @example
2029    *
2030    * function square(n) {
2031    *   return n * n;
2032    * }
2033    *
2034    * _.map([4, 8], square);
2035    * // => [16, 64]
2036    *
2037    * _.map({ 'a': 4, 'b': 8 }, square);
2038    * // => [16, 64] (iteration order is not guaranteed)
2039    *
2040    * var users = [
2041    *   { 'user': 'barney' },
2042    *   { 'user': 'fred' }
2043    * ];
2044    *
2045    * // The `_.property` iteratee shorthand.
2046    * _.map(users, 'user');
2047    * // => ['barney', 'fred']
2048    */
2049   function map(collection, iteratee) {
2050     return baseMap(collection, baseIteratee(iteratee));
2051   }
2052
2053   /**
2054    * Reduces `collection` to a value which is the accumulated result of running
2055    * each element in `collection` thru `iteratee`, where each successive
2056    * invocation is supplied the return value of the previous. If `accumulator`
2057    * is not given, the first element of `collection` is used as the initial
2058    * value. The iteratee is invoked with four arguments:
2059    * (accumulator, value, index|key, collection).
2060    *
2061    * Many lodash methods are guarded to work as iteratees for methods like
2062    * `_.reduce`, `_.reduceRight`, and `_.transform`.
2063    *
2064    * The guarded methods are:
2065    * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
2066    * and `sortBy`
2067    *
2068    * @static
2069    * @memberOf _
2070    * @since 0.1.0
2071    * @category Collection
2072    * @param {Array|Object} collection The collection to iterate over.
2073    * @param {Function} [iteratee=_.identity] The function invoked per iteration.
2074    * @param {*} [accumulator] The initial value.
2075    * @returns {*} Returns the accumulated value.
2076    * @see _.reduceRight
2077    * @example
2078    *
2079    * _.reduce([1, 2], function(sum, n) {
2080    *   return sum + n;
2081    * }, 0);
2082    * // => 3
2083    *
2084    * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
2085    *   (result[value] || (result[value] = [])).push(key);
2086    *   return result;
2087    * }, {});
2088    * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
2089    */
2090   function reduce(collection, iteratee, accumulator) {
2091     return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach);
2092   }
2093
2094   /**
2095    * Gets the size of `collection` by returning its length for array-like
2096    * values or the number of own enumerable string keyed properties for objects.
2097    *
2098    * @static
2099    * @memberOf _
2100    * @since 0.1.0
2101    * @category Collection
2102    * @param {Array|Object|string} collection The collection to inspect.
2103    * @returns {number} Returns the collection size.
2104    * @example
2105    *
2106    * _.size([1, 2, 3]);
2107    * // => 3
2108    *
2109    * _.size({ 'a': 1, 'b': 2 });
2110    * // => 2
2111    *
2112    * _.size('pebbles');
2113    * // => 7
2114    */
2115   function size(collection) {
2116     if (collection == null) {
2117       return 0;
2118     }
2119     collection = isArrayLike(collection) ? collection : nativeKeys(collection);
2120     return collection.length;
2121   }
2122
2123   /**
2124    * Checks if `predicate` returns truthy for **any** element of `collection`.
2125    * Iteration is stopped once `predicate` returns truthy. The predicate is
2126    * invoked with three arguments: (value, index|key, collection).
2127    *
2128    * @static
2129    * @memberOf _
2130    * @since 0.1.0
2131    * @category Collection
2132    * @param {Array|Object} collection The collection to iterate over.
2133    * @param {Function} [predicate=_.identity] The function invoked per iteration.
2134    * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2135    * @returns {boolean} Returns `true` if any element passes the predicate check,
2136    *  else `false`.
2137    * @example
2138    *
2139    * _.some([null, 0, 'yes', false], Boolean);
2140    * // => true
2141    *
2142    * var users = [
2143    *   { 'user': 'barney', 'active': true },
2144    *   { 'user': 'fred',   'active': false }
2145    * ];
2146    *
2147    * // The `_.matches` iteratee shorthand.
2148    * _.some(users, { 'user': 'barney', 'active': false });
2149    * // => false
2150    *
2151    * // The `_.matchesProperty` iteratee shorthand.
2152    * _.some(users, ['active', false]);
2153    * // => true
2154    *
2155    * // The `_.property` iteratee shorthand.
2156    * _.some(users, 'active');
2157    * // => true
2158    */
2159   function some(collection, predicate, guard) {
2160     predicate = guard ? undefined : predicate;
2161     return baseSome(collection, baseIteratee(predicate));
2162   }
2163
2164   /**
2165    * Creates an array of elements, sorted in ascending order by the results of
2166    * running each element in a collection thru each iteratee. This method
2167    * performs a stable sort, that is, it preserves the original sort order of
2168    * equal elements. The iteratees are invoked with one argument: (value).
2169    *
2170    * @static
2171    * @memberOf _
2172    * @since 0.1.0
2173    * @category Collection
2174    * @param {Array|Object} collection The collection to iterate over.
2175    * @param {...(Function|Function[])} [iteratees=[_.identity]]
2176    *  The iteratees to sort by.
2177    * @returns {Array} Returns the new sorted array.
2178    * @example
2179    *
2180    * var users = [
2181    *   { 'user': 'fred',   'age': 48 },
2182    *   { 'user': 'barney', 'age': 36 },
2183    *   { 'user': 'fred',   'age': 40 },
2184    *   { 'user': 'barney', 'age': 34 }
2185    * ];
2186    *
2187    * _.sortBy(users, [function(o) { return o.user; }]);
2188    * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
2189    *
2190    * _.sortBy(users, ['user', 'age']);
2191    * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
2192    */
2193   function sortBy(collection, iteratee) {
2194     var index = 0;
2195     iteratee = baseIteratee(iteratee);
2196
2197     return baseMap(baseMap(collection, function(value, key, collection) {
2198       return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) };
2199     }).sort(function(object, other) {
2200       return compareAscending(object.criteria, other.criteria) || (object.index - other.index);
2201     }), baseProperty('value'));
2202   }
2203
2204   /*------------------------------------------------------------------------*/
2205
2206   /**
2207    * Creates a function that invokes `func`, with the `this` binding and arguments
2208    * of the created function, while it's called less than `n` times. Subsequent
2209    * calls to the created function return the result of the last `func` invocation.
2210    *
2211    * @static
2212    * @memberOf _
2213    * @since 3.0.0
2214    * @category Function
2215    * @param {number} n The number of calls at which `func` is no longer invoked.
2216    * @param {Function} func The function to restrict.
2217    * @returns {Function} Returns the new restricted function.
2218    * @example
2219    *
2220    * jQuery(element).on('click', _.before(5, addContactToList));
2221    * // => Allows adding up to 4 contacts to the list.
2222    */
2223   function before(n, func) {
2224     var result;
2225     if (typeof func != 'function') {
2226       throw new TypeError(FUNC_ERROR_TEXT);
2227     }
2228     n = toInteger(n);
2229     return function() {
2230       if (--n > 0) {
2231         result = func.apply(this, arguments);
2232       }
2233       if (n <= 1) {
2234         func = undefined;
2235       }
2236       return result;
2237     };
2238   }
2239
2240   /**
2241    * Creates a function that invokes `func` with the `this` binding of `thisArg`
2242    * and `partials` prepended to the arguments it receives.
2243    *
2244    * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
2245    * may be used as a placeholder for partially applied arguments.
2246    *
2247    * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
2248    * property of bound functions.
2249    *
2250    * @static
2251    * @memberOf _
2252    * @since 0.1.0
2253    * @category Function
2254    * @param {Function} func The function to bind.
2255    * @param {*} thisArg The `this` binding of `func`.
2256    * @param {...*} [partials] The arguments to be partially applied.
2257    * @returns {Function} Returns the new bound function.
2258    * @example
2259    *
2260    * function greet(greeting, punctuation) {
2261    *   return greeting + ' ' + this.user + punctuation;
2262    * }
2263    *
2264    * var object = { 'user': 'fred' };
2265    *
2266    * var bound = _.bind(greet, object, 'hi');
2267    * bound('!');
2268    * // => 'hi fred!'
2269    *
2270    * // Bound with placeholders.
2271    * var bound = _.bind(greet, object, _, '!');
2272    * bound('hi');
2273    * // => 'hi fred!'
2274    */
2275   var bind = baseRest(function(func, thisArg, partials) {
2276     return createPartial(func, BIND_FLAG | PARTIAL_FLAG, thisArg, partials);
2277   });
2278
2279   /**
2280    * Defers invoking the `func` until the current call stack has cleared. Any
2281    * additional arguments are provided to `func` when it's invoked.
2282    *
2283    * @static
2284    * @memberOf _
2285    * @since 0.1.0
2286    * @category Function
2287    * @param {Function} func The function to defer.
2288    * @param {...*} [args] The arguments to invoke `func` with.
2289    * @returns {number} Returns the timer id.
2290    * @example
2291    *
2292    * _.defer(function(text) {
2293    *   console.log(text);
2294    * }, 'deferred');
2295    * // => Logs 'deferred' after one millisecond.
2296    */
2297   var defer = baseRest(function(func, args) {
2298     return baseDelay(func, 1, args);
2299   });
2300
2301   /**
2302    * Invokes `func` after `wait` milliseconds. Any additional arguments are
2303    * provided to `func` when it's invoked.
2304    *
2305    * @static
2306    * @memberOf _
2307    * @since 0.1.0
2308    * @category Function
2309    * @param {Function} func The function to delay.
2310    * @param {number} wait The number of milliseconds to delay invocation.
2311    * @param {...*} [args] The arguments to invoke `func` with.
2312    * @returns {number} Returns the timer id.
2313    * @example
2314    *
2315    * _.delay(function(text) {
2316    *   console.log(text);
2317    * }, 1000, 'later');
2318    * // => Logs 'later' after one second.
2319    */
2320   var delay = baseRest(function(func, wait, args) {
2321     return baseDelay(func, toNumber(wait) || 0, args);
2322   });
2323
2324   /**
2325    * Creates a function that negates the result of the predicate `func`. The
2326    * `func` predicate is invoked with the `this` binding and arguments of the
2327    * created function.
2328    *
2329    * @static
2330    * @memberOf _
2331    * @since 3.0.0
2332    * @category Function
2333    * @param {Function} predicate The predicate to negate.
2334    * @returns {Function} Returns the new negated function.
2335    * @example
2336    *
2337    * function isEven(n) {
2338    *   return n % 2 == 0;
2339    * }
2340    *
2341    * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
2342    * // => [1, 3, 5]
2343    */
2344   function negate(predicate) {
2345     if (typeof predicate != 'function') {
2346       throw new TypeError(FUNC_ERROR_TEXT);
2347     }
2348     return function() {
2349       var args = arguments;
2350       return !predicate.apply(this, args);
2351     };
2352   }
2353
2354   /**
2355    * Creates a function that is restricted to invoking `func` once. Repeat calls
2356    * to the function return the value of the first invocation. The `func` is
2357    * invoked with the `this` binding and arguments of the created function.
2358    *
2359    * @static
2360    * @memberOf _
2361    * @since 0.1.0
2362    * @category Function
2363    * @param {Function} func The function to restrict.
2364    * @returns {Function} Returns the new restricted function.
2365    * @example
2366    *
2367    * var initialize = _.once(createApplication);
2368    * initialize();
2369    * initialize();
2370    * // => `createApplication` is invoked once
2371    */
2372   function once(func) {
2373     return before(2, func);
2374   }
2375
2376   /*------------------------------------------------------------------------*/
2377
2378   /**
2379    * Creates a shallow clone of `value`.
2380    *
2381    * **Note:** This method is loosely based on the
2382    * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
2383    * and supports cloning arrays, array buffers, booleans, date objects, maps,
2384    * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
2385    * arrays. The own enumerable properties of `arguments` objects are cloned
2386    * as plain objects. An empty object is returned for uncloneable values such
2387    * as error objects, functions, DOM nodes, and WeakMaps.
2388    *
2389    * @static
2390    * @memberOf _
2391    * @since 0.1.0
2392    * @category Lang
2393    * @param {*} value The value to clone.
2394    * @returns {*} Returns the cloned value.
2395    * @see _.cloneDeep
2396    * @example
2397    *
2398    * var objects = [{ 'a': 1 }, { 'b': 2 }];
2399    *
2400    * var shallow = _.clone(objects);
2401    * console.log(shallow[0] === objects[0]);
2402    * // => true
2403    */
2404   function clone(value) {
2405     if (!isObject(value)) {
2406       return value;
2407     }
2408     return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value));
2409   }
2410
2411   /**
2412    * Performs a
2413    * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2414    * comparison between two values to determine if they are equivalent.
2415    *
2416    * @static
2417    * @memberOf _
2418    * @since 4.0.0
2419    * @category Lang
2420    * @param {*} value The value to compare.
2421    * @param {*} other The other value to compare.
2422    * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2423    * @example
2424    *
2425    * var object = { 'a': 1 };
2426    * var other = { 'a': 1 };
2427    *
2428    * _.eq(object, object);
2429    * // => true
2430    *
2431    * _.eq(object, other);
2432    * // => false
2433    *
2434    * _.eq('a', 'a');
2435    * // => true
2436    *
2437    * _.eq('a', Object('a'));
2438    * // => false
2439    *
2440    * _.eq(NaN, NaN);
2441    * // => true
2442    */
2443   function eq(value, other) {
2444     return value === other || (value !== value && other !== other);
2445   }
2446
2447   /**
2448    * Checks if `value` is likely an `arguments` object.
2449    *
2450    * @static
2451    * @memberOf _
2452    * @since 0.1.0
2453    * @category Lang
2454    * @param {*} value The value to check.
2455    * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2456    *  else `false`.
2457    * @example
2458    *
2459    * _.isArguments(function() { return arguments; }());
2460    * // => true
2461    *
2462    * _.isArguments([1, 2, 3]);
2463    * // => false
2464    */
2465   var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
2466     return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
2467       !propertyIsEnumerable.call(value, 'callee');
2468   };
2469
2470   /**
2471    * Checks if `value` is classified as an `Array` object.
2472    *
2473    * @static
2474    * @memberOf _
2475    * @since 0.1.0
2476    * @category Lang
2477    * @param {*} value The value to check.
2478    * @returns {boolean} Returns `true` if `value` is an array, else `false`.
2479    * @example
2480    *
2481    * _.isArray([1, 2, 3]);
2482    * // => true
2483    *
2484    * _.isArray(document.body.children);
2485    * // => false
2486    *
2487    * _.isArray('abc');
2488    * // => false
2489    *
2490    * _.isArray(_.noop);
2491    * // => false
2492    */
2493   var isArray = Array.isArray;
2494
2495   /**
2496    * Checks if `value` is array-like. A value is considered array-like if it's
2497    * not a function and has a `value.length` that's an integer greater than or
2498    * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2499    *
2500    * @static
2501    * @memberOf _
2502    * @since 4.0.0
2503    * @category Lang
2504    * @param {*} value The value to check.
2505    * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2506    * @example
2507    *
2508    * _.isArrayLike([1, 2, 3]);
2509    * // => true
2510    *
2511    * _.isArrayLike(document.body.children);
2512    * // => true
2513    *
2514    * _.isArrayLike('abc');
2515    * // => true
2516    *
2517    * _.isArrayLike(_.noop);
2518    * // => false
2519    */
2520   function isArrayLike(value) {
2521     return value != null && isLength(value.length) && !isFunction(value);
2522   }
2523
2524   /**
2525    * Checks if `value` is classified as a boolean primitive or object.
2526    *
2527    * @static
2528    * @memberOf _
2529    * @since 0.1.0
2530    * @category Lang
2531    * @param {*} value The value to check.
2532    * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
2533    * @example
2534    *
2535    * _.isBoolean(false);
2536    * // => true
2537    *
2538    * _.isBoolean(null);
2539    * // => false
2540    */
2541   function isBoolean(value) {
2542     return value === true || value === false ||
2543       (isObjectLike(value) && baseGetTag(value) == boolTag);
2544   }
2545
2546   /**
2547    * Checks if `value` is classified as a `Date` object.
2548    *
2549    * @static
2550    * @memberOf _
2551    * @since 0.1.0
2552    * @category Lang
2553    * @param {*} value The value to check.
2554    * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
2555    * @example
2556    *
2557    * _.isDate(new Date);
2558    * // => true
2559    *
2560    * _.isDate('Mon April 23 2012');
2561    * // => false
2562    */
2563   var isDate = baseIsDate;
2564
2565   /**
2566    * Checks if `value` is an empty object, collection, map, or set.
2567    *
2568    * Objects are considered empty if they have no own enumerable string keyed
2569    * properties.
2570    *
2571    * Array-like values such as `arguments` objects, arrays, buffers, strings, or
2572    * jQuery-like collections are considered empty if they have a `length` of `0`.
2573    * Similarly, maps and sets are considered empty if they have a `size` of `0`.
2574    *
2575    * @static
2576    * @memberOf _
2577    * @since 0.1.0
2578    * @category Lang
2579    * @param {*} value The value to check.
2580    * @returns {boolean} Returns `true` if `value` is empty, else `false`.
2581    * @example
2582    *
2583    * _.isEmpty(null);
2584    * // => true
2585    *
2586    * _.isEmpty(true);
2587    * // => true
2588    *
2589    * _.isEmpty(1);
2590    * // => true
2591    *
2592    * _.isEmpty([1, 2, 3]);
2593    * // => false
2594    *
2595    * _.isEmpty({ 'a': 1 });
2596    * // => false
2597    */
2598   function isEmpty(value) {
2599     if (isArrayLike(value) &&
2600         (isArray(value) || isString(value) ||
2601           isFunction(value.splice) || isArguments(value))) {
2602       return !value.length;
2603     }
2604     return !nativeKeys(value).length;
2605   }
2606
2607   /**
2608    * Performs a deep comparison between two values to determine if they are
2609    * equivalent.
2610    *
2611    * **Note:** This method supports comparing arrays, array buffers, booleans,
2612    * date objects, error objects, maps, numbers, `Object` objects, regexes,
2613    * sets, strings, symbols, and typed arrays. `Object` objects are compared
2614    * by their own, not inherited, enumerable properties. Functions and DOM
2615    * nodes are **not** supported.
2616    *
2617    * @static
2618    * @memberOf _
2619    * @since 0.1.0
2620    * @category Lang
2621    * @param {*} value The value to compare.
2622    * @param {*} other The other value to compare.
2623    * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2624    * @example
2625    *
2626    * var object = { 'a': 1 };
2627    * var other = { 'a': 1 };
2628    *
2629    * _.isEqual(object, other);
2630    * // => true
2631    *
2632    * object === other;
2633    * // => false
2634    */
2635   function isEqual(value, other) {
2636     return baseIsEqual(value, other);
2637   }
2638
2639   /**
2640    * Checks if `value` is a finite primitive number.
2641    *
2642    * **Note:** This method is based on
2643    * [`Number.isFinite`](https://mdn.io/Number/isFinite).
2644    *
2645    * @static
2646    * @memberOf _
2647    * @since 0.1.0
2648    * @category Lang
2649    * @param {*} value The value to check.
2650    * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
2651    * @example
2652    *
2653    * _.isFinite(3);
2654    * // => true
2655    *
2656    * _.isFinite(Number.MIN_VALUE);
2657    * // => true
2658    *
2659    * _.isFinite(Infinity);
2660    * // => false
2661    *
2662    * _.isFinite('3');
2663    * // => false
2664    */
2665   function isFinite(value) {
2666     return typeof value == 'number' && nativeIsFinite(value);
2667   }
2668
2669   /**
2670    * Checks if `value` is classified as a `Function` object.
2671    *
2672    * @static
2673    * @memberOf _
2674    * @since 0.1.0
2675    * @category Lang
2676    * @param {*} value The value to check.
2677    * @returns {boolean} Returns `true` if `value` is a function, else `false`.
2678    * @example
2679    *
2680    * _.isFunction(_);
2681    * // => true
2682    *
2683    * _.isFunction(/abc/);
2684    * // => false
2685    */
2686   function isFunction(value) {
2687     if (!isObject(value)) {
2688       return false;
2689     }
2690     // The use of `Object#toString` avoids issues with the `typeof` operator
2691     // in Safari 9 which returns 'object' for typed arrays and other constructors.
2692     var tag = baseGetTag(value);
2693     return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
2694   }
2695
2696   /**
2697    * Checks if `value` is a valid array-like length.
2698    *
2699    * **Note:** This method is loosely based on
2700    * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2701    *
2702    * @static
2703    * @memberOf _
2704    * @since 4.0.0
2705    * @category Lang
2706    * @param {*} value The value to check.
2707    * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2708    * @example
2709    *
2710    * _.isLength(3);
2711    * // => true
2712    *
2713    * _.isLength(Number.MIN_VALUE);
2714    * // => false
2715    *
2716    * _.isLength(Infinity);
2717    * // => false
2718    *
2719    * _.isLength('3');
2720    * // => false
2721    */
2722   function isLength(value) {
2723     return typeof value == 'number' &&
2724       value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2725   }
2726
2727   /**
2728    * Checks if `value` is the
2729    * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
2730    * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
2731    *
2732    * @static
2733    * @memberOf _
2734    * @since 0.1.0
2735    * @category Lang
2736    * @param {*} value The value to check.
2737    * @returns {boolean} Returns `true` if `value` is an object, else `false`.
2738    * @example
2739    *
2740    * _.isObject({});
2741    * // => true
2742    *
2743    * _.isObject([1, 2, 3]);
2744    * // => true
2745    *
2746    * _.isObject(_.noop);
2747    * // => true
2748    *
2749    * _.isObject(null);
2750    * // => false
2751    */
2752   function isObject(value) {
2753     var type = typeof value;
2754     return value != null && (type == 'object' || type == 'function');
2755   }
2756
2757   /**
2758    * Checks if `value` is object-like. A value is object-like if it's not `null`
2759    * and has a `typeof` result of "object".
2760    *
2761    * @static
2762    * @memberOf _
2763    * @since 4.0.0
2764    * @category Lang
2765    * @param {*} value The value to check.
2766    * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2767    * @example
2768    *
2769    * _.isObjectLike({});
2770    * // => true
2771    *
2772    * _.isObjectLike([1, 2, 3]);
2773    * // => true
2774    *
2775    * _.isObjectLike(_.noop);
2776    * // => false
2777    *
2778    * _.isObjectLike(null);
2779    * // => false
2780    */
2781   function isObjectLike(value) {
2782     return value != null && typeof value == 'object';
2783   }
2784
2785   /**
2786    * Checks if `value` is `NaN`.
2787    *
2788    * **Note:** This method is based on
2789    * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
2790    * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
2791    * `undefined` and other non-number values.
2792    *
2793    * @static
2794    * @memberOf _
2795    * @since 0.1.0
2796    * @category Lang
2797    * @param {*} value The value to check.
2798    * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
2799    * @example
2800    *
2801    * _.isNaN(NaN);
2802    * // => true
2803    *
2804    * _.isNaN(new Number(NaN));
2805    * // => true
2806    *
2807    * isNaN(undefined);
2808    * // => true
2809    *
2810    * _.isNaN(undefined);
2811    * // => false
2812    */
2813   function isNaN(value) {
2814     // An `NaN` primitive is the only value that is not equal to itself.
2815     // Perform the `toStringTag` check first to avoid errors with some
2816     // ActiveX objects in IE.
2817     return isNumber(value) && value != +value;
2818   }
2819
2820   /**
2821    * Checks if `value` is `null`.
2822    *
2823    * @static
2824    * @memberOf _
2825    * @since 0.1.0
2826    * @category Lang
2827    * @param {*} value The value to check.
2828    * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
2829    * @example
2830    *
2831    * _.isNull(null);
2832    * // => true
2833    *
2834    * _.isNull(void 0);
2835    * // => false
2836    */
2837   function isNull(value) {
2838     return value === null;
2839   }
2840
2841   /**
2842    * Checks if `value` is classified as a `Number` primitive or object.
2843    *
2844    * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
2845    * classified as numbers, use the `_.isFinite` method.
2846    *
2847    * @static
2848    * @memberOf _
2849    * @since 0.1.0
2850    * @category Lang
2851    * @param {*} value The value to check.
2852    * @returns {boolean} Returns `true` if `value` is a number, else `false`.
2853    * @example
2854    *
2855    * _.isNumber(3);
2856    * // => true
2857    *
2858    * _.isNumber(Number.MIN_VALUE);
2859    * // => true
2860    *
2861    * _.isNumber(Infinity);
2862    * // => true
2863    *
2864    * _.isNumber('3');
2865    * // => false
2866    */
2867   function isNumber(value) {
2868     return typeof value == 'number' ||
2869       (isObjectLike(value) && baseGetTag(value) == numberTag);
2870   }
2871
2872   /**
2873    * Checks if `value` is classified as a `RegExp` object.
2874    *
2875    * @static
2876    * @memberOf _
2877    * @since 0.1.0
2878    * @category Lang
2879    * @param {*} value The value to check.
2880    * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
2881    * @example
2882    *
2883    * _.isRegExp(/abc/);
2884    * // => true
2885    *
2886    * _.isRegExp('/abc/');
2887    * // => false
2888    */
2889   var isRegExp = baseIsRegExp;
2890
2891   /**
2892    * Checks if `value` is classified as a `String` primitive or object.
2893    *
2894    * @static
2895    * @since 0.1.0
2896    * @memberOf _
2897    * @category Lang
2898    * @param {*} value The value to check.
2899    * @returns {boolean} Returns `true` if `value` is a string, else `false`.
2900    * @example
2901    *
2902    * _.isString('abc');
2903    * // => true
2904    *
2905    * _.isString(1);
2906    * // => false
2907    */
2908   function isString(value) {
2909     return typeof value == 'string' ||
2910       (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
2911   }
2912
2913   /**
2914    * Checks if `value` is `undefined`.
2915    *
2916    * @static
2917    * @since 0.1.0
2918    * @memberOf _
2919    * @category Lang
2920    * @param {*} value The value to check.
2921    * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
2922    * @example
2923    *
2924    * _.isUndefined(void 0);
2925    * // => true
2926    *
2927    * _.isUndefined(null);
2928    * // => false
2929    */
2930   function isUndefined(value) {
2931     return value === undefined;
2932   }
2933
2934   /**
2935    * Converts `value` to an array.
2936    *
2937    * @static
2938    * @since 0.1.0
2939    * @memberOf _
2940    * @category Lang
2941    * @param {*} value The value to convert.
2942    * @returns {Array} Returns the converted array.
2943    * @example
2944    *
2945    * _.toArray({ 'a': 1, 'b': 2 });
2946    * // => [1, 2]
2947    *
2948    * _.toArray('abc');
2949    * // => ['a', 'b', 'c']
2950    *
2951    * _.toArray(1);
2952    * // => []
2953    *
2954    * _.toArray(null);
2955    * // => []
2956    */
2957   function toArray(value) {
2958     if (!isArrayLike(value)) {
2959       return values(value);
2960     }
2961     return value.length ? copyArray(value) : [];
2962   }
2963
2964   /**
2965    * Converts `value` to an integer.
2966    *
2967    * **Note:** This method is loosely based on
2968    * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
2969    *
2970    * @static
2971    * @memberOf _
2972    * @since 4.0.0
2973    * @category Lang
2974    * @param {*} value The value to convert.
2975    * @returns {number} Returns the converted integer.
2976    * @example
2977    *
2978    * _.toInteger(3.2);
2979    * // => 3
2980    *
2981    * _.toInteger(Number.MIN_VALUE);
2982    * // => 0
2983    *
2984    * _.toInteger(Infinity);
2985    * // => 1.7976931348623157e+308
2986    *
2987    * _.toInteger('3.2');
2988    * // => 3
2989    */
2990   var toInteger = Number;
2991
2992   /**
2993    * Converts `value` to a number.
2994    *
2995    * @static
2996    * @memberOf _
2997    * @since 4.0.0
2998    * @category Lang
2999    * @param {*} value The value to process.
3000    * @returns {number} Returns the number.
3001    * @example
3002    *
3003    * _.toNumber(3.2);
3004    * // => 3.2
3005    *
3006    * _.toNumber(Number.MIN_VALUE);
3007    * // => 5e-324
3008    *
3009    * _.toNumber(Infinity);
3010    * // => Infinity
3011    *
3012    * _.toNumber('3.2');
3013    * // => 3.2
3014    */
3015   var toNumber = Number;
3016
3017   /**
3018    * Converts `value` to a string. An empty string is returned for `null`
3019    * and `undefined` values. The sign of `-0` is preserved.
3020    *
3021    * @static
3022    * @memberOf _
3023    * @since 4.0.0
3024    * @category Lang
3025    * @param {*} value The value to convert.
3026    * @returns {string} Returns the converted string.
3027    * @example
3028    *
3029    * _.toString(null);
3030    * // => ''
3031    *
3032    * _.toString(-0);
3033    * // => '-0'
3034    *
3035    * _.toString([1, 2, 3]);
3036    * // => '1,2,3'
3037    */
3038   function toString(value) {
3039     if (typeof value == 'string') {
3040       return value;
3041     }
3042     return value == null ? '' : (value + '');
3043   }
3044
3045   /*------------------------------------------------------------------------*/
3046
3047   /**
3048    * Assigns own enumerable string keyed properties of source objects to the
3049    * destination object. Source objects are applied from left to right.
3050    * Subsequent sources overwrite property assignments of previous sources.
3051    *
3052    * **Note:** This method mutates `object` and is loosely based on
3053    * [`Object.assign`](https://mdn.io/Object/assign).
3054    *
3055    * @static
3056    * @memberOf _
3057    * @since 0.10.0
3058    * @category Object
3059    * @param {Object} object The destination object.
3060    * @param {...Object} [sources] The source objects.
3061    * @returns {Object} Returns `object`.
3062    * @see _.assignIn
3063    * @example
3064    *
3065    * function Foo() {
3066    *   this.a = 1;
3067    * }
3068    *
3069    * function Bar() {
3070    *   this.c = 3;
3071    * }
3072    *
3073    * Foo.prototype.b = 2;
3074    * Bar.prototype.d = 4;
3075    *
3076    * _.assign({ 'a': 0 }, new Foo, new Bar);
3077    * // => { 'a': 1, 'c': 3 }
3078    */
3079   var assign = createAssigner(function(object, source) {
3080     copyObject(source, nativeKeys(source), object);
3081   });
3082
3083   /**
3084    * This method is like `_.assign` except that it iterates over own and
3085    * inherited source properties.
3086    *
3087    * **Note:** This method mutates `object`.
3088    *
3089    * @static
3090    * @memberOf _
3091    * @since 4.0.0
3092    * @alias extend
3093    * @category Object
3094    * @param {Object} object The destination object.
3095    * @param {...Object} [sources] The source objects.
3096    * @returns {Object} Returns `object`.
3097    * @see _.assign
3098    * @example
3099    *
3100    * function Foo() {
3101    *   this.a = 1;
3102    * }
3103    *
3104    * function Bar() {
3105    *   this.c = 3;
3106    * }
3107    *
3108    * Foo.prototype.b = 2;
3109    * Bar.prototype.d = 4;
3110    *
3111    * _.assignIn({ 'a': 0 }, new Foo, new Bar);
3112    * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
3113    */
3114   var assignIn = createAssigner(function(object, source) {
3115     copyObject(source, nativeKeysIn(source), object);
3116   });
3117
3118   /**
3119    * This method is like `_.assignIn` except that it accepts `customizer`
3120    * which is invoked to produce the assigned values. If `customizer` returns
3121    * `undefined`, assignment is handled by the method instead. The `customizer`
3122    * is invoked with five arguments: (objValue, srcValue, key, object, source).
3123    *
3124    * **Note:** This method mutates `object`.
3125    *
3126    * @static
3127    * @memberOf _
3128    * @since 4.0.0
3129    * @alias extendWith
3130    * @category Object
3131    * @param {Object} object The destination object.
3132    * @param {...Object} sources The source objects.
3133    * @param {Function} [customizer] The function to customize assigned values.
3134    * @returns {Object} Returns `object`.
3135    * @see _.assignWith
3136    * @example
3137    *
3138    * function customizer(objValue, srcValue) {
3139    *   return _.isUndefined(objValue) ? srcValue : objValue;
3140    * }
3141    *
3142    * var defaults = _.partialRight(_.assignInWith, customizer);
3143    *
3144    * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
3145    * // => { 'a': 1, 'b': 2 }
3146    */
3147   var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
3148     copyObject(source, keysIn(source), object, customizer);
3149   });
3150
3151   /**
3152    * Creates an object that inherits from the `prototype` object. If a
3153    * `properties` object is given, its own enumerable string keyed properties
3154    * are assigned to the created object.
3155    *
3156    * @static
3157    * @memberOf _
3158    * @since 2.3.0
3159    * @category Object
3160    * @param {Object} prototype The object to inherit from.
3161    * @param {Object} [properties] The properties to assign to the object.
3162    * @returns {Object} Returns the new object.
3163    * @example
3164    *
3165    * function Shape() {
3166    *   this.x = 0;
3167    *   this.y = 0;
3168    * }
3169    *
3170    * function Circle() {
3171    *   Shape.call(this);
3172    * }
3173    *
3174    * Circle.prototype = _.create(Shape.prototype, {
3175    *   'constructor': Circle
3176    * });
3177    *
3178    * var circle = new Circle;
3179    * circle instanceof Circle;
3180    * // => true
3181    *
3182    * circle instanceof Shape;
3183    * // => true
3184    */
3185   function create(prototype, properties) {
3186     var result = baseCreate(prototype);
3187     return properties == null ? result : assign(result, properties);
3188   }
3189
3190   /**
3191    * Assigns own and inherited enumerable string keyed properties of source
3192    * objects to the destination object for all destination properties that
3193    * resolve to `undefined`. Source objects are applied from left to right.
3194    * Once a property is set, additional values of the same property are ignored.
3195    *
3196    * **Note:** This method mutates `object`.
3197    *
3198    * @static
3199    * @since 0.1.0
3200    * @memberOf _
3201    * @category Object
3202    * @param {Object} object The destination object.
3203    * @param {...Object} [sources] The source objects.
3204    * @returns {Object} Returns `object`.
3205    * @see _.defaultsDeep
3206    * @example
3207    *
3208    * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
3209    * // => { 'a': 1, 'b': 2 }
3210    */
3211   var defaults = baseRest(function(args) {
3212     args.push(undefined, assignInDefaults);
3213     return assignInWith.apply(undefined, args);
3214   });
3215
3216   /**
3217    * Checks if `path` is a direct property of `object`.
3218    *
3219    * @static
3220    * @since 0.1.0
3221    * @memberOf _
3222    * @category Object
3223    * @param {Object} object The object to query.
3224    * @param {Array|string} path The path to check.
3225    * @returns {boolean} Returns `true` if `path` exists, else `false`.
3226    * @example
3227    *
3228    * var object = { 'a': { 'b': 2 } };
3229    * var other = _.create({ 'a': _.create({ 'b': 2 }) });
3230    *
3231    * _.has(object, 'a');
3232    * // => true
3233    *
3234    * _.has(object, 'a.b');
3235    * // => true
3236    *
3237    * _.has(object, ['a', 'b']);
3238    * // => true
3239    *
3240    * _.has(other, 'a');
3241    * // => false
3242    */
3243   function has(object, path) {
3244     return object != null && hasOwnProperty.call(object, path);
3245   }
3246
3247   /**
3248    * Creates an array of the own enumerable property names of `object`.
3249    *
3250    * **Note:** Non-object values are coerced to objects. See the
3251    * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
3252    * for more details.
3253    *
3254    * @static
3255    * @since 0.1.0
3256    * @memberOf _
3257    * @category Object
3258    * @param {Object} object The object to query.
3259    * @returns {Array} Returns the array of property names.
3260    * @example
3261    *
3262    * function Foo() {
3263    *   this.a = 1;
3264    *   this.b = 2;
3265    * }
3266    *
3267    * Foo.prototype.c = 3;
3268    *
3269    * _.keys(new Foo);
3270    * // => ['a', 'b'] (iteration order is not guaranteed)
3271    *
3272    * _.keys('hi');
3273    * // => ['0', '1']
3274    */
3275   var keys = nativeKeys;
3276
3277   /**
3278    * Creates an array of the own and inherited enumerable property names of `object`.
3279    *
3280    * **Note:** Non-object values are coerced to objects.
3281    *
3282    * @static
3283    * @memberOf _
3284    * @since 3.0.0
3285    * @category Object
3286    * @param {Object} object The object to query.
3287    * @returns {Array} Returns the array of property names.
3288    * @example
3289    *
3290    * function Foo() {
3291    *   this.a = 1;
3292    *   this.b = 2;
3293    * }
3294    *
3295    * Foo.prototype.c = 3;
3296    *
3297    * _.keysIn(new Foo);
3298    * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
3299    */
3300   var keysIn = nativeKeysIn;
3301
3302   /**
3303    * Creates an object composed of the picked `object` properties.
3304    *
3305    * @static
3306    * @since 0.1.0
3307    * @memberOf _
3308    * @category Object
3309    * @param {Object} object The source object.
3310    * @param {...(string|string[])} [props] The property identifiers to pick.
3311    * @returns {Object} Returns the new object.
3312    * @example
3313    *
3314    * var object = { 'a': 1, 'b': '2', 'c': 3 };
3315    *
3316    * _.pick(object, ['a', 'c']);
3317    * // => { 'a': 1, 'c': 3 }
3318    */
3319   var pick = flatRest(function(object, props) {
3320     return object == null ? {} : basePick(object, baseMap(props, toKey));
3321   });
3322
3323   /**
3324    * This method is like `_.get` except that if the resolved value is a
3325    * function it's invoked with the `this` binding of its parent object and
3326    * its result is returned.
3327    *
3328    * @static
3329    * @since 0.1.0
3330    * @memberOf _
3331    * @category Object
3332    * @param {Object} object The object to query.
3333    * @param {Array|string} path The path of the property to resolve.
3334    * @param {*} [defaultValue] The value returned for `undefined` resolved values.
3335    * @returns {*} Returns the resolved value.
3336    * @example
3337    *
3338    * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
3339    *
3340    * _.result(object, 'a[0].b.c1');
3341    * // => 3
3342    *
3343    * _.result(object, 'a[0].b.c2');
3344    * // => 4
3345    *
3346    * _.result(object, 'a[0].b.c3', 'default');
3347    * // => 'default'
3348    *
3349    * _.result(object, 'a[0].b.c3', _.constant('default'));
3350    * // => 'default'
3351    */
3352   function result(object, path, defaultValue) {
3353     var value = object == null ? undefined : object[path];
3354     if (value === undefined) {
3355       value = defaultValue;
3356     }
3357     return isFunction(value) ? value.call(object) : value;
3358   }
3359
3360   /**
3361    * Creates an array of the own enumerable string keyed property values of `object`.
3362    *
3363    * **Note:** Non-object values are coerced to objects.
3364    *
3365    * @static
3366    * @since 0.1.0
3367    * @memberOf _
3368    * @category Object
3369    * @param {Object} object The object to query.
3370    * @returns {Array} Returns the array of property values.
3371    * @example
3372    *
3373    * function Foo() {
3374    *   this.a = 1;
3375    *   this.b = 2;
3376    * }
3377    *
3378    * Foo.prototype.c = 3;
3379    *
3380    * _.values(new Foo);
3381    * // => [1, 2] (iteration order is not guaranteed)
3382    *
3383    * _.values('hi');
3384    * // => ['h', 'i']
3385    */
3386   function values(object) {
3387     return object == null ? [] : baseValues(object, keys(object));
3388   }
3389
3390   /*------------------------------------------------------------------------*/
3391
3392   /**
3393    * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
3394    * corresponding HTML entities.
3395    *
3396    * **Note:** No other characters are escaped. To escape additional
3397    * characters use a third-party library like [_he_](https://mths.be/he).
3398    *
3399    * Though the ">" character is escaped for symmetry, characters like
3400    * ">" and "/" don't need escaping in HTML and have no special meaning
3401    * unless they're part of a tag or unquoted attribute value. See
3402    * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
3403    * (under "semi-related fun fact") for more details.
3404    *
3405    * When working with HTML you should always
3406    * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
3407    * XSS vectors.
3408    *
3409    * @static
3410    * @since 0.1.0
3411    * @memberOf _
3412    * @category String
3413    * @param {string} [string=''] The string to escape.
3414    * @returns {string} Returns the escaped string.
3415    * @example
3416    *
3417    * _.escape('fred, barney, & pebbles');
3418    * // => 'fred, barney, &amp; pebbles'
3419    */
3420   function escape(string) {
3421     string = toString(string);
3422     return (string && reHasUnescapedHtml.test(string))
3423       ? string.replace(reUnescapedHtml, escapeHtmlChar)
3424       : string;
3425   }
3426
3427   /*------------------------------------------------------------------------*/
3428
3429   /**
3430    * This method returns the first argument it receives.
3431    *
3432    * @static
3433    * @since 0.1.0
3434    * @memberOf _
3435    * @category Util
3436    * @param {*} value Any value.
3437    * @returns {*} Returns `value`.
3438    * @example
3439    *
3440    * var object = { 'a': 1 };
3441    *
3442    * console.log(_.identity(object) === object);
3443    * // => true
3444    */
3445   function identity(value) {
3446     return value;
3447   }
3448
3449   /**
3450    * Creates a function that invokes `func` with the arguments of the created
3451    * function. If `func` is a property name, the created function returns the
3452    * property value for a given element. If `func` is an array or object, the
3453    * created function returns `true` for elements that contain the equivalent
3454    * source properties, otherwise it returns `false`.
3455    *
3456    * @static
3457    * @since 4.0.0
3458    * @memberOf _
3459    * @category Util
3460    * @param {*} [func=_.identity] The value to convert to a callback.
3461    * @returns {Function} Returns the callback.
3462    * @example
3463    *
3464    * var users = [
3465    *   { 'user': 'barney', 'age': 36, 'active': true },
3466    *   { 'user': 'fred',   'age': 40, 'active': false }
3467    * ];
3468    *
3469    * // The `_.matches` iteratee shorthand.
3470    * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
3471    * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
3472    *
3473    * // The `_.matchesProperty` iteratee shorthand.
3474    * _.filter(users, _.iteratee(['user', 'fred']));
3475    * // => [{ 'user': 'fred', 'age': 40 }]
3476    *
3477    * // The `_.property` iteratee shorthand.
3478    * _.map(users, _.iteratee('user'));
3479    * // => ['barney', 'fred']
3480    *
3481    * // Create custom iteratee shorthands.
3482    * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
3483    *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
3484    *     return func.test(string);
3485    *   };
3486    * });
3487    *
3488    * _.filter(['abc', 'def'], /ef/);
3489    * // => ['def']
3490    */
3491   var iteratee = baseIteratee;
3492
3493   /**
3494    * Creates a function that performs a partial deep comparison between a given
3495    * object and `source`, returning `true` if the given object has equivalent
3496    * property values, else `false`.
3497    *
3498    * **Note:** The created function is equivalent to `_.isMatch` with `source`
3499    * partially applied.
3500    *
3501    * Partial comparisons will match empty array and empty object `source`
3502    * values against any array or object value, respectively. See `_.isEqual`
3503    * for a list of supported value comparisons.
3504    *
3505    * @static
3506    * @memberOf _
3507    * @since 3.0.0
3508    * @category Util
3509    * @param {Object} source The object of property values to match.
3510    * @returns {Function} Returns the new spec function.
3511    * @example
3512    *
3513    * var objects = [
3514    *   { 'a': 1, 'b': 2, 'c': 3 },
3515    *   { 'a': 4, 'b': 5, 'c': 6 }
3516    * ];
3517    *
3518    * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
3519    * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
3520    */
3521   function matches(source) {
3522     return baseMatches(assign({}, source));
3523   }
3524
3525   /**
3526    * Adds all own enumerable string keyed function properties of a source
3527    * object to the destination object. If `object` is a function, then methods
3528    * are added to its prototype as well.
3529    *
3530    * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
3531    * avoid conflicts caused by modifying the original.
3532    *
3533    * @static
3534    * @since 0.1.0
3535    * @memberOf _
3536    * @category Util
3537    * @param {Function|Object} [object=lodash] The destination object.
3538    * @param {Object} source The object of functions to add.
3539    * @param {Object} [options={}] The options object.
3540    * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
3541    * @returns {Function|Object} Returns `object`.
3542    * @example
3543    *
3544    * function vowels(string) {
3545    *   return _.filter(string, function(v) {
3546    *     return /[aeiou]/i.test(v);
3547    *   });
3548    * }
3549    *
3550    * _.mixin({ 'vowels': vowels });
3551    * _.vowels('fred');
3552    * // => ['e']
3553    *
3554    * _('fred').vowels().value();
3555    * // => ['e']
3556    *
3557    * _.mixin({ 'vowels': vowels }, { 'chain': false });
3558    * _('fred').vowels();
3559    * // => ['e']
3560    */
3561   function mixin(object, source, options) {
3562     var props = keys(source),
3563         methodNames = baseFunctions(source, props);
3564
3565     if (options == null &&
3566         !(isObject(source) && (methodNames.length || !props.length))) {
3567       options = source;
3568       source = object;
3569       object = this;
3570       methodNames = baseFunctions(source, keys(source));
3571     }
3572     var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
3573         isFunc = isFunction(object);
3574
3575     baseEach(methodNames, function(methodName) {
3576       var func = source[methodName];
3577       object[methodName] = func;
3578       if (isFunc) {
3579         object.prototype[methodName] = function() {
3580           var chainAll = this.__chain__;
3581           if (chain || chainAll) {
3582             var result = object(this.__wrapped__),
3583                 actions = result.__actions__ = copyArray(this.__actions__);
3584
3585             actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
3586             result.__chain__ = chainAll;
3587             return result;
3588           }
3589           return func.apply(object, arrayPush([this.value()], arguments));
3590         };
3591       }
3592     });
3593
3594     return object;
3595   }
3596
3597   /**
3598    * Reverts the `_` variable to its previous value and returns a reference to
3599    * the `lodash` function.
3600    *
3601    * @static
3602    * @since 0.1.0
3603    * @memberOf _
3604    * @category Util
3605    * @returns {Function} Returns the `lodash` function.
3606    * @example
3607    *
3608    * var lodash = _.noConflict();
3609    */
3610   function noConflict() {
3611     if (root._ === this) {
3612       root._ = oldDash;
3613     }
3614     return this;
3615   }
3616
3617   /**
3618    * This method returns `undefined`.
3619    *
3620    * @static
3621    * @memberOf _
3622    * @since 2.3.0
3623    * @category Util
3624    * @example
3625    *
3626    * _.times(2, _.noop);
3627    * // => [undefined, undefined]
3628    */
3629   function noop() {
3630     // No operation performed.
3631   }
3632
3633   /**
3634    * Generates a unique ID. If `prefix` is given, the ID is appended to it.
3635    *
3636    * @static
3637    * @since 0.1.0
3638    * @memberOf _
3639    * @category Util
3640    * @param {string} [prefix=''] The value to prefix the ID with.
3641    * @returns {string} Returns the unique ID.
3642    * @example
3643    *
3644    * _.uniqueId('contact_');
3645    * // => 'contact_104'
3646    *
3647    * _.uniqueId();
3648    * // => '105'
3649    */
3650   function uniqueId(prefix) {
3651     var id = ++idCounter;
3652     return toString(prefix) + id;
3653   }
3654
3655   /*------------------------------------------------------------------------*/
3656
3657   /**
3658    * Computes the maximum value of `array`. If `array` is empty or falsey,
3659    * `undefined` is returned.
3660    *
3661    * @static
3662    * @since 0.1.0
3663    * @memberOf _
3664    * @category Math
3665    * @param {Array} array The array to iterate over.
3666    * @returns {*} Returns the maximum value.
3667    * @example
3668    *
3669    * _.max([4, 2, 8, 6]);
3670    * // => 8
3671    *
3672    * _.max([]);
3673    * // => undefined
3674    */
3675   function max(array) {
3676     return (array && array.length)
3677       ? baseExtremum(array, identity, baseGt)
3678       : undefined;
3679   }
3680
3681   /**
3682    * Computes the minimum value of `array`. If `array` is empty or falsey,
3683    * `undefined` is returned.
3684    *
3685    * @static
3686    * @since 0.1.0
3687    * @memberOf _
3688    * @category Math
3689    * @param {Array} array The array to iterate over.
3690    * @returns {*} Returns the minimum value.
3691    * @example
3692    *
3693    * _.min([4, 2, 8, 6]);
3694    * // => 2
3695    *
3696    * _.min([]);
3697    * // => undefined
3698    */
3699   function min(array) {
3700     return (array && array.length)
3701       ? baseExtremum(array, identity, baseLt)
3702       : undefined;
3703   }
3704
3705   /*------------------------------------------------------------------------*/
3706
3707   // Add methods that return wrapped values in chain sequences.
3708   lodash.assignIn = assignIn;
3709   lodash.before = before;
3710   lodash.bind = bind;
3711   lodash.chain = chain;
3712   lodash.compact = compact;
3713   lodash.concat = concat;
3714   lodash.create = create;
3715   lodash.defaults = defaults;
3716   lodash.defer = defer;
3717   lodash.delay = delay;
3718   lodash.filter = filter;
3719   lodash.flatten = flatten;
3720   lodash.flattenDeep = flattenDeep;
3721   lodash.iteratee = iteratee;
3722   lodash.keys = keys;
3723   lodash.map = map;
3724   lodash.matches = matches;
3725   lodash.mixin = mixin;
3726   lodash.negate = negate;
3727   lodash.once = once;
3728   lodash.pick = pick;
3729   lodash.slice = slice;
3730   lodash.sortBy = sortBy;
3731   lodash.tap = tap;
3732   lodash.thru = thru;
3733   lodash.toArray = toArray;
3734   lodash.values = values;
3735
3736   // Add aliases.
3737   lodash.extend = assignIn;
3738
3739   // Add methods to `lodash.prototype`.
3740   mixin(lodash, lodash);
3741
3742   /*------------------------------------------------------------------------*/
3743
3744   // Add methods that return unwrapped values in chain sequences.
3745   lodash.clone = clone;
3746   lodash.escape = escape;
3747   lodash.every = every;
3748   lodash.find = find;
3749   lodash.forEach = forEach;
3750   lodash.has = has;
3751   lodash.head = head;
3752   lodash.identity = identity;
3753   lodash.indexOf = indexOf;
3754   lodash.isArguments = isArguments;
3755   lodash.isArray = isArray;
3756   lodash.isBoolean = isBoolean;
3757   lodash.isDate = isDate;
3758   lodash.isEmpty = isEmpty;
3759   lodash.isEqual = isEqual;
3760   lodash.isFinite = isFinite;
3761   lodash.isFunction = isFunction;
3762   lodash.isNaN = isNaN;
3763   lodash.isNull = isNull;
3764   lodash.isNumber = isNumber;
3765   lodash.isObject = isObject;
3766   lodash.isRegExp = isRegExp;
3767   lodash.isString = isString;
3768   lodash.isUndefined = isUndefined;
3769   lodash.last = last;
3770   lodash.max = max;
3771   lodash.min = min;
3772   lodash.noConflict = noConflict;
3773   lodash.noop = noop;
3774   lodash.reduce = reduce;
3775   lodash.result = result;
3776   lodash.size = size;
3777   lodash.some = some;
3778   lodash.uniqueId = uniqueId;
3779
3780   // Add aliases.
3781   lodash.each = forEach;
3782   lodash.first = head;
3783
3784   mixin(lodash, (function() {
3785     var source = {};
3786     baseForOwn(lodash, function(func, methodName) {
3787       if (!hasOwnProperty.call(lodash.prototype, methodName)) {
3788         source[methodName] = func;
3789       }
3790     });
3791     return source;
3792   }()), { 'chain': false });
3793
3794   /*------------------------------------------------------------------------*/
3795
3796   /**
3797    * The semantic version number.
3798    *
3799    * @static
3800    * @memberOf _
3801    * @type {string}
3802    */
3803   lodash.VERSION = VERSION;
3804
3805   // Add `Array` methods to `lodash.prototype`.
3806   baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
3807     var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName],
3808         chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
3809         retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName);
3810
3811     lodash.prototype[methodName] = function() {
3812       var args = arguments;
3813       if (retUnwrapped && !this.__chain__) {
3814         var value = this.value();
3815         return func.apply(isArray(value) ? value : [], args);
3816       }
3817       return this[chainName](function(value) {
3818         return func.apply(isArray(value) ? value : [], args);
3819       });
3820     };
3821   });
3822
3823   // Add chain sequence methods to the `lodash` wrapper.
3824   lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
3825
3826   /*--------------------------------------------------------------------------*/
3827
3828   // Some AMD build optimizers, like r.js, check for condition patterns like:
3829   if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
3830     // Expose Lodash on the global object to prevent errors when Lodash is
3831     // loaded by a script tag in the presence of an AMD loader.
3832     // See http://requirejs.org/docs/errors.html#mismatch for more details.
3833     // Use `_.noConflict` to remove Lodash from the global object.
3834     root._ = lodash;
3835
3836     // Define as an anonymous module so, through path mapping, it can be
3837     // referenced as the "underscore" module.
3838     define(function() {
3839       return lodash;
3840     });
3841   }
3842   // Check for `exports` after `define` in case a build optimizer adds it.
3843   else if (freeModule) {
3844     // Export for Node.js.
3845     (freeModule.exports = lodash)._ = lodash;
3846     // Export for CommonJS support.
3847     freeExports._ = lodash;
3848   }
3849   else {
3850     // Export to the global object.
3851     root._ = lodash;
3852   }
3853 }.call(this));