PageSourceSearch

https://www.sportingkc.com/assets/js/vendors-_yarn_cache_lodash-np…?_t=0b045822d29665d4728e

js sportingkc.com collected 2026-09-24 09:17:37 UTC 544,954 bytes, 17,216 lines download raw bytes

1(self["webpackChunk_mlssoccer_netcore"] = self["webpackChunk_mlssoccer_netcore"] || []).push([["vendors-_yarn_cache_lodash-npm-4_17_21-6382451519-c08619c038_zip_node_modules_lodash_lodash_js"],{
2
vendor: 544,605 bytes, lines 3-17213
3/***/ "./.yarn/cache/lodash-npm-4.17.21-6382451519-c08619c038.zip/node_modules/lodash/lodash.js":
4/*!************************************************************************************************!*\
5  !*** ./.yarn/cache/lodash-npm-4.17.21-6382451519-c08619c038.zip/node_modules/lodash/lodash.js ***!
6  \************************************************************************************************/
7/***/ (function(module, exports, __webpack_require__) {
8
9/* module decorator */ module = __webpack_require__.nmd(module);
10var __WEBPACK_AMD_DEFINE_RESULT__;/**
11 * @license
12 * Lodash <https://lodash.com/>
13 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
14 * Released under MIT license <https://lodash.com/license>
15 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
16 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
17 */
18;(function() {
19
20  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
21  var undefined;
22
23  /** Used as the semantic version number. */
24  var VERSION = '4.17.21';
25
26  /** Used as the size to enable large array optimizations. */
27  var LARGE_ARRAY_SIZE = 200;
28
29  /** Error message constants. */
30  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
31      FUNC_ERROR_TEXT = 'Expected a function',
32      INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
33
34  /** Used to stand-in for `undefined` hash values. */
35  var HASH_UNDEFINED = '__lodash_hash_undefined__';
36
37  /** Used as the maximum memoize cache size. */
38  var MAX_MEMOIZE_SIZE = 500;
39
40  /** Used as the internal argument placeholder. */
41  var PLACEHOLDER = '__lodash_placeholder__';
42
43  /** Used to compose bitmasks for cloning. */
44  var CLONE_DEEP_FLAG = 1,
45      CLONE_FLAT_FLAG = 2,
46      CLONE_SYMBOLS_FLAG = 4;
47
48  /** Used to compose bitmasks for value comparisons. */
49  var COMPARE_PARTIAL_FLAG = 1,
50      COMPARE_UNORDERED_FLAG = 2;
51
52  /** Used to compose bitmasks for function metadata. */
53  var WRAP_BIND_FLAG = 1,
54      WRAP_BIND_KEY_FLAG = 2,
55      WRAP_CURRY_BOUND_FLAG = 4,
56      WRAP_CURRY_FLAG = 8,
57      WRAP_CURRY_RIGHT_FLAG = 16,
58      WRAP_PARTIAL_FLAG = 32,
59      WRAP_PARTIAL_RIGHT_FLAG = 64,
60      WRAP_ARY_FLAG = 128,
61      WRAP_REARG_FLAG = 256,
62      WRAP_FLIP_FLAG = 512;
63
64  /** Used as default options for `_.truncate`. */
65  var DEFAULT_TRUNC_LENGTH = 30,
66      DEFAULT_TRUNC_OMISSION = '...';
67
68  /** Used to detect hot functions by number of calls within a span of milliseconds. */
69  var HOT_COUNT = 800,
70      HOT_SPAN = 16;
71
72  /** Used to indicate the type of lazy iteratees. */
73  var LAZY_FILTER_FLAG = 1,
74      LAZY_MAP_FLAG = 2,
75      LAZY_WHILE_FLAG = 3;
76
77  /** Used as references for various `Number` constants. */
78  var INFINITY = 1 / 0,
79      MAX_SAFE_INTEGER = 9007199254740991,
80      MAX_INTEGER = 1.7976931348623157e+308,
81      NAN = 0 / 0;
82
83  /** Used as references for the maximum length and index of an array. */
84  var MAX_ARRAY_LENGTH = 4294967295,
85      MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
86      HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
87
88  /** Used to associate wrap methods with their bit flags. */
89  var wrapFlags = [
90    ['ary', WRAP_ARY_FLAG],
91    ['bind', WRAP_BIND_FLAG],
92    ['bindKey', WRAP_BIND_KEY_FLAG],
93    ['curry', WRAP_CURRY_FLAG],
94    ['curryRight', WRAP_CURRY_RIGHT_FLAG],
95    ['flip', WRAP_FLIP_FLAG],
96    ['partial', WRAP_PARTIAL_FLAG],
97    ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
98    ['rearg', WRAP_REARG_FLAG]
99  ];
100
101  /** `Object#toString` result references. */
102  var argsTag = '[object Arguments]',
103      arrayTag = '[object Array]',
104      asyncTag = '[object AsyncFunction]',
105      boolTag = '[object Boolean]',
106      dateTag = '[object Date]',
107      domExcTag = '[object DOMException]',
108      errorTag = '[object Error]',
109      funcTag = '[object Function]',
110      genTag = '[object GeneratorFunction]',
111      mapTag = '[object Map]',
112      numberTag = '[object Number]',
113      nullTag = '[object Null]',
114      objectTag = '[object Object]',
115      promiseTag = '[object Promise]',
116      proxyTag = '[object Proxy]',
117      regexpTag = '[object RegExp]',
118      setTag = '[object Set]',
119      stringTag = '[object String]',
120      symbolTag = '[object Symbol]',
121      undefinedTag = '[object Undefined]',
122      weakMapTag = '[object WeakMap]',
123      weakSetTag = '[object WeakSet]';
124
125  var arrayBufferTag = '[object ArrayBuffer]',
126      dataViewTag = '[object DataView]',
127      float32Tag = '[object Float32Array]',
128      float64Tag = '[object Float64Array]',
129      int8Tag = '[object Int8Array]',
130      int16Tag = '[object Int16Array]',
131      int32Tag = '[object Int32Array]',
132      uint8Tag = '[object Uint8Array]',
133      uint8ClampedTag = '[object Uint8ClampedArray]',
134      uint16Tag = '[object Uint16Array]',
135      uint32Tag = '[object Uint32Array]';
136
137  /** Used to match empty string literals in compiled template source. */
138  var reEmptyStringLeading = /\b__p \+= '';/g,
139      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
140      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
141
142  /** Used to match HTML entities and HTML characters. */
143  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
144      reUnescapedHtml = /[&<>"']/g,
145      reHasEscapedHtml = RegExp(reEscapedHtml.source),
146      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
147
148  /** Used to match template delimiters. */
149  var reEscape = /<%-([\s\S]+?)%>/g,
150      reEvaluate = /<%([\s\S]+?)%>/g,
151      reInterpolate = /<%=([\s\S]+?)%>/g;
152
153  /** Used to match property names within property paths. */
154  var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
155      reIsPlainProp = /^\w*$/,
156      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
157
158  /**
159   * Used to match `RegExp`
160   * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
161   */
162  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
163      reHasRegExpChar = RegExp(reRegExpChar.source);
164
165  /** Used to match leading whitespace. */
166  var reTrimStart = /^\s+/;
167
168  /** Used to match a single whitespace character. */
169  var reWhitespace = /\s/;
170
171  /** Used to match wrap detail comments. */
172  var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
173      reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
174      reSplitDetails = /,? & /;
175
176  /** Used to match words composed of alphanumeric characters. */
177  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
178
179  /**
180   * Used to validate the `validate` option in `_.template` variable.
181   *
182   * Forbids characters which could potentially change the meaning of the function argument definition:
183   * - "()," (modification of function parameters)
184   * - "=" (default value)
185   * - "[]{}" (destructuring of function parameters)
186   * - "/" (beginning of a comment)
187   * - whitespace
188   */
189  var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
190
191  /** Used to match backslashes in property paths. */
192  var reEscapeChar = /\\(\\)?/g;
193
194  /**
195   * Used to match
196   * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
197   */
198  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
199
200  /** Used to match `RegExp` flags from their coerced string values. */
201  var reFlags = /\w*$/;
202
203  /** Used to detect bad signed hexadecimal string values. */
204  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
205
206  /** Used to detect binary string values. */
207  var reIsBinary = /^0b[01]+$/i;
208
209  /** Used to detect host constructors (Safari). */
210  var reIsHostCtor = /^\[object .+?Constructor\]$/;
211
212  /** Used to detect octal string values. */
213  var reIsOctal = /^0o[0-7]+$/i;
214
215  /** Used to detect unsigned integer values. */
216  var reIsUint = /^(?:0|[1-9]\d*)$/;
217
218  /** Used to match Latin Unicode letters (excluding mathematical operators). */
219  var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
220
221  /** Used to ensure capturing order of template delimiters. */
222  var reNoMatch = /($^)/;
223
224  /** Used to match unescaped characters in compiled string literals. */
225  var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
226
227  /** Used to compose unicode character classes. */
228  var rsAstralRange = '\\ud800-\\udfff',
229      rsComboMarksRange = '\\u0300-\\u036f',
230      reComboHalfMarksRange = '\\ufe20-\\ufe2f',
231      rsComboSymbolsRange = '\\u20d0-\\u20ff',
232      rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
233      rsDingbatRange = '\\u2700-\\u27bf',
234      rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
235      rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
236      rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
237      rsPunctuationRange = '\\u2000-\\u206f',
238      rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
239      rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
240      rsVarRange = '\\ufe0e\\ufe0f',
241      rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
242
243  /** Used to compose unicode capture groups. */
244  var rsApos = "['\u2019]",
245      rsAstral = '[' + rsAstralRange + ']',
246      rsBreak = '[' + rsBreakRange + ']',
247      rsCombo = '[' + rsComboRange + ']',
248      rsDigits = '\\d+',
249      rsDingbat = '[' + rsDingbatRange + ']',
250      rsLower = '[' + rsLowerRange + ']',
251      rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
252      rsFitz = '\\ud83c[\\udffb-\\udfff]',
253      rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
254      rsNonAstral = '[^' + rsAstralRange + ']',
255      rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
256      rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
257      rsUpper = '[' + rsUpperRange + ']',
258      rsZWJ = '\\u200d';
259
260  /** Used to compose unicode regexes. */
261  var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
262      rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
263      rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
264      rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
265      reOptMod = rsModifier + '?',
266      rsOptVar = '[' + rsVarRange + ']?',
267      rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
268      rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
269      rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
270      rsSeq = rsOptVar + reOptMod + rsOptJoin,
271      rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
272      rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
273
274  /** Used to match apostrophes. */
275  var reApos = RegExp(rsApos, 'g');
276
277  /**
278   * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
279   * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
280   */
281  var reComboMark = RegExp(rsCombo, 'g');
282
283  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
284  var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
285
286  /** Used to match complex or compound words. */
287  var reUnicodeWord = RegExp([
288    rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
289    rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
290    rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
291    rsUpper + '+' + rsOptContrUpper,
292    rsOrdUpper,
293    rsOrdLower,
294    rsDigits,
295    rsEmoji
296  ].join('|'), 'g');
297
298  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
299  var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange  + rsComboRange + rsVarRange + ']');
300
301  /** Used to detect strings that need a more robust regexp to match words. */
302  var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
303
304  /** Used to assign default `context` object properties. */
305  var contextProps = [
306    'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
307    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
308    'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
309    'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
310    '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
311  ];
312
313  /** Used to make template sourceURLs easier to identify. */
314  var templateCounter = -1;
315
316  /** Used to identify `toStringTag` values of typed arrays. */
317  var typedArrayTags = {};
318  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
319  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
320  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
321  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
322  typedArrayTags[uint32Tag] = true;
323  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
324  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
325  typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
326  typedArrayTags[errorTag] = typedArrayTags[funcTag] =
327  typedArrayTags[mapTag] = typedArrayTags[numberTag] =
328  typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
329  typedArrayTags[setTag] = typedArrayTags[stringTag] =
330  typedArrayTags[weakMapTag] = false;
331
332  /** Used to identify `toStringTag` values supported by `_.clone`. */
333  var cloneableTags = {};
334  cloneableTags[argsTag] = cloneableTags[arrayTag] =
335  cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
336  cloneableTags[boolTag] = cloneableTags[dateTag] =
337  cloneableTags[float32Tag] = cloneableTags[float64Tag] =
338  cloneableTags[int8Tag] = cloneableTags[int16Tag] =
339  cloneableTags[int32Tag] = cloneableTags[mapTag] =
340  cloneableTags[numberTag] = cloneableTags[objectTag] =
341  cloneableTags[regexpTag] = cloneableTags[setTag] =
342  cloneableTags[stringTag] = cloneableTags[symbolTag] =
343  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
344  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
345  cloneableTags[errorTag] = cloneableTags[funcTag] =
346  cloneableTags[weakMapTag] = false;
347
348  /** Used to map Latin Unicode letters to basic Latin letters. */
349  var deburredLetters = {
350    // Latin-1 Supplement block.
351    '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
352    '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
353    '\xc7': 'C',  '\xe7': 'c',
354    '\xd0': 'D',  '\xf0': 'd',
355    '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
356    '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
357    '\xcc': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
358    '\xec': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
359    '\xd1': 'N',  '\xf1': 'n',
360    '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
361    '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
362    '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
363    '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
364    '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
365    '\xc6': 'Ae', '\xe6': 'ae',
366    '\xde': 'Th', '\xfe': 'th',
367    '\xdf': 'ss',
368    // Latin Extended-A block.
369    '\u0100': 'A',  '\u0102': 'A', '\u0104': 'A',
370    '\u0101': 'a',  '\u0103': 'a', '\u0105': 'a',
371    '\u0106': 'C',  '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
372    '\u0107': 'c',  '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
373    '\u010e': 'D',  '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
374    '\u0112': 'E',  '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
375    '\u0113': 'e',  '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
376    '\u011c': 'G',  '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
377    '\u011d': 'g',  '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
378    '\u0124': 'H',  '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
379    '\u0128': 'I',  '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
380    '\u0129': 'i',  '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
381    '\u0134': 'J',  '\u0135': 'j',
382    '\u0136': 'K',  '\u0137': 'k', '\u0138': 'k',
383    '\u0139': 'L',  '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
384    '\u013a': 'l',  '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
385    '\u0143': 'N',  '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
386    '\u0144': 'n',  '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
387    '\u014c': 'O',  '\u014e': 'O', '\u0150': 'O',
388    '\u014d': 'o',  '\u014f': 'o', '\u0151': 'o',
389    '\u0154': 'R',  '\u0156': 'R', '\u0158': 'R',
390    '\u0155': 'r',  '\u0157': 'r', '\u0159': 'r',
391    '\u015a': 'S',  '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
392    '\u015b': 's',  '\u015d': 's', '\u015f': 's', '\u0161': 's',
393    '\u0162': 'T',  '\u0164': 'T', '\u0166': 'T',
394    '\u0163': 't',  '\u0165': 't', '\u0167': 't',
395    '\u0168': 'U',  '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
396    '\u0169': 'u',  '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
397    '\u0174': 'W',  '\u0175': 'w',
398    '\u0176': 'Y',  '\u0177': 'y', '\u0178': 'Y',
399    '\u0179': 'Z',  '\u017b': 'Z', '\u017d': 'Z',
400    '\u017a': 'z',  '\u017c': 'z', '\u017e': 'z',
401    '\u0132': 'IJ', '\u0133': 'ij',
402    '\u0152': 'Oe', '\u0153': 'oe',
403    '\u0149': "'n", '\u017f': 's'
404  };
405
406  /** Used to map characters to HTML entities. */
407  var htmlEscapes = {
408    '&': '&amp;',
409    '<': '&lt;',
410    '>': '&gt;',
411    '"': '&quot;',
412    "'": '&#39;'
413  };
414
415  /** Used to map HTML entities to characters. */
416  var htmlUnescapes = {
417    '&amp;': '&',
418    '&lt;': '<',
419    '&gt;': '>',
420    '&quot;': '"',
421    '&#39;': "'"
422  };
423
424  /** Used to escape characters for inclusion in compiled string literals. */
425  var stringEscapes = {
426    '\\': '\\',
427    "'": "'",
428    '\n': 'n',
429    '\r': 'r',
430    '\u2028': 'u2028',
431    '\u2029': 'u2029'
432  };
433
434  /** Built-in method references without a dependency on `root`. */
435  var freeParseFloat = parseFloat,
436      freeParseInt = parseInt;
437
438  /** Detect free variable `global` from Node.js. */
439  var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
440
441  /** Detect free variable `self`. */
442  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
443
444  /** Used as a reference to the global object. */
445  var root = freeGlobal || freeSelf || Function('return this')();
446
447  /** Detect free variable `exports`. */
448  var freeExports =  true && exports && !exports.nodeType && exports;
449
450  /** Detect free variable `module`. */
451  var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
452
453  /** Detect the popular CommonJS extension `module.exports`. */
454  var moduleExports = freeModule && freeModule.exports === freeExports;
455
456  /** Detect free variable `process` from Node.js. */
457  var freeProcess = moduleExports && freeGlobal.process;
458
459  /** Used to access faster Node.js helpers. */
460  var nodeUtil = (function() {
461    try {
462      // Use `util.types` for Node.js 10+.
463      var types = freeModule && freeModule.require && freeModule.require('util').types;
464
465      if (types) {
466        return types;
467      }
468
469      // Legacy `process.binding('util')` for Node.js < 10.
470      return freeProcess && freeProcess.binding && freeProcess.binding('util');
471    } catch (e) {}
472  }());
473
474  /* Node.js helper references. */
475  var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
476      nodeIsDate = nodeUtil && nodeUtil.isDate,
477      nodeIsMap = nodeUtil && nodeUtil.isMap,
478      nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
479      nodeIsSet = nodeUtil && nodeUtil.isSet,
480      nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
481
482  /*--------------------------------------------------------------------------*/
483
484  /**
485   * A faster alternative to `Function#apply`, this function invokes `func`
486   * with the `this` binding of `thisArg` and the arguments of `args`.
487   *
488   * @private
489   * @param {Function} func The function to invoke.
490   * @param {*} thisArg The `this` binding of `func`.
491   * @param {Array} args The arguments to invoke `func` with.
492   * @returns {*} Returns the result of `func`.
493   */
494  function apply(func, thisArg, args) {
495    switch (args.length) {
496      case 0: return func.call(thisArg);
497      case 1: return func.call(thisArg, args[0]);
498      case 2: return func.call(thisArg, args[0], args[1]);
499      case 3: return func.call(thisArg, args[0], args[1], args[2]);
500    }
501    return func.apply(thisArg, args);
502  }
503
504  /**
505   * A specialized version of `baseAggregator` for arrays.
506   *
507   * @private
508   * @param {Array} [array] The array to iterate over.
509   * @param {Function} setter The function to set `accumulator` values.
510   * @param {Function} iteratee The iteratee to transform keys.
511   * @param {Object} accumulator The initial aggregated object.
512   * @returns {Function} Returns `accumulator`.
513   */
514  function arrayAggregator(array, setter, iteratee, accumulator) {
515    var index = -1,
516        length = array == null ? 0 : array.length;
517
518    while (++index < length) {
519      var value = array[index];
520      setter(accumulator, value, iteratee(value), array);
521    }
522    return accumulator;
523  }
524
525  /**
526   * A specialized version of `_.forEach` for arrays without support for
527   * iteratee shorthands.
528   *
529   * @private
530   * @param {Array} [array] The array to iterate over.
531   * @param {Function} iteratee The function invoked per iteration.
532   * @returns {Array} Returns `array`.
533   */
534  function arrayEach(array, iteratee) {
535    var index = -1,
536        length = array == null ? 0 : array.length;
537
538    while (++index < length) {
539      if (iteratee(array[index], index, array) === false) {
540        break;
541      }
542    }
543    return array;
544  }
545
546  /**
547   * A specialized version of `_.forEachRight` for arrays without support for
548   * iteratee shorthands.
549   *
550   * @private
551   * @param {Array} [array] The array to iterate over.
552   * @param {Function} iteratee The function invoked per iteration.
553   * @returns {Array} Returns `array`.
554   */
555  function arrayEachRight(array, iteratee) {
556    var length = array == null ? 0 : array.length;
557
558    while (length--) {
559      if (iteratee(array[length], length, array) === false) {
560        break;
561      }
562    }
563    return array;
564  }
565
566  /**
567   * A specialized version of `_.every` for arrays without support for
568   * iteratee shorthands.
569   *
570   * @private
571   * @param {Array} [array] The array to iterate over.
572   * @param {Function} predicate The function invoked per iteration.
573   * @returns {boolean} Returns `true` if all elements pass the predicate check,
574   *  else `false`.
575   */
576  function arrayEvery(array, predicate) {
577    var index = -1,
578        length = array == null ? 0 : array.length;
579
580    while (++index < length) {
581      if (!predicate(array[index], index, array)) {
582        return false;
583      }
584    }
585    return true;
586  }
587
588  /**
589   * A specialized version of `_.filter` for arrays without support for
590   * iteratee shorthands.
591   *
592   * @private
593   * @param {Array} [array] The array to iterate over.
594   * @param {Function} predicate The function invoked per iteration.
595   * @returns {Array} Returns the new filtered array.
596   */
597  function arrayFilter(array, predicate) {
598    var index = -1,
599        length = array == null ? 0 : array.length,
600        resIndex = 0,
601        result = [];
602
603    while (++index < length) {
604      var value = array[index];
605      if (predicate(value, index, array)) {
606        result[resIndex++] = value;
607      }
608    }
609    return result;
610  }
611
612  /**
613   * A specialized version of `_.includes` for arrays without support for
614   * specifying an index to search from.
615   *
616   * @private
617   * @param {Array} [array] The array to inspect.
618   * @param {*} target The value to search for.
619   * @returns {boolean} Returns `true` if `target` is found, else `false`.
620   */
621  function arrayIncludes(array, value) {
622    var length = array == null ? 0 : array.length;
623    return !!length && baseIndexOf(array, value, 0) > -1;
624  }
625
626  /**
627   * This function is like `arrayIncludes` except that it accepts a comparator.
628   *
629   * @private
630   * @param {Array} [array] The array to inspect.
631   * @param {*} target The value to search for.
632   * @param {Function} comparator The comparator invoked per element.
633   * @returns {boolean} Returns `true` if `target` is found, else `false`.
634   */
635  function arrayIncludesWith(array, value, comparator) {
636    var index = -1,
637        length = array == null ? 0 : array.length;
638
639    while (++index < length) {
640      if (comparator(value, array[index])) {
641        return true;
642      }
643    }
644    return false;
645  }
646
647  /**
648   * A specialized version of `_.map` for arrays without support for iteratee
649   * shorthands.
650   *
651   * @private
652   * @param {Array} [array] The array to iterate over.
653   * @param {Function} iteratee The function invoked per iteration.
654   * @returns {Array} Returns the new mapped array.
655   */
656  function arrayMap(array, iteratee) {
657    var index = -1,
658        length = array == null ? 0 : array.length,
659        result = Array(length);
660
661    while (++index < length) {
662      result[index] = iteratee(array[index], index, array);
663    }
664    return result;
665  }
666
667  /**
668   * Appends the elements of `values` to `array`.
669   *
670   * @private
671   * @param {Array} array The array to modify.
672   * @param {Array} values The values to append.
673   * @returns {Array} Returns `array`.
674   */
675  function arrayPush(array, values) {
676    var index = -1,
677        length = values.length,
678        offset = array.length;
679
680    while (++index < length) {
681      array[offset + index] = values[index];
682    }
683    return array;
684  }
685
686  /**
687   * A specialized version of `_.reduce` for arrays without support for
688   * iteratee shorthands.
689   *
690   * @private
691   * @param {Array} [array] The array to iterate over.
692   * @param {Function} iteratee The function invoked per iteration.
693   * @param {*} [accumulator] The initial value.
694   * @param {boolean} [initAccum] Specify using the first element of `array` as
695   *  the initial value.
696   * @returns {*} Returns the accumulated value.
697   */
698  function arrayReduce(array, iteratee, accumulator, initAccum) {
699    var index = -1,
700        length = array == null ? 0 : array.length;
701
702    if (initAccum && length) {
703      accumulator = array[++index];
704    }
705    while (++index < length) {
706      accumulator = iteratee(accumulator, array[index], index, array);
707    }
708    return accumulator;
709  }
710
711  /**
712   * A specialized version of `_.reduceRight` for arrays without support for
713   * iteratee shorthands.
714   *
715   * @private
716   * @param {Array} [array] The array to iterate over.
717   * @param {Function} iteratee The function invoked per iteration.
718   * @param {*} [accumulator] The initial value.
719   * @param {boolean} [initAccum] Specify using the last element of `array` as
720   *  the initial value.
721   * @returns {*} Returns the accumulated value.
722   */
723  function arrayReduceRight(array, iteratee, accumulator, initAccum) {
724    var length = array == null ? 0 : array.length;
725    if (initAccum && length) {
726      accumulator = array[--length];
727    }
728    while (length--) {
729      accumulator = iteratee(accumulator, array[length], length, array);
730    }
731    return accumulator;
732  }
733
734  /**
735   * A specialized version of `_.some` for arrays without support for iteratee
736   * shorthands.
737   *
738   * @private
739   * @param {Array} [array] The array to iterate over.
740   * @param {Function} predicate The function invoked per iteration.
741   * @returns {boolean} Returns `true` if any element passes the predicate check,
742   *  else `false`.
743   */
744  function arraySome(array, predicate) {
745    var index = -1,
746        length = array == null ? 0 : array.length;
747
748    while (++index < length) {
749      if (predicate(array[index], index, array)) {
750        return true;
751      }
752    }
753    return false;
754  }
755
756  /**
757   * Gets the size of an ASCII `string`.
758   *
759   * @private
760   * @param {string} string The string inspect.
761   * @returns {number} Returns the string size.
762   */
763  var asciiSize = baseProperty('length');
764
765  /**
766   * Converts an ASCII `string` to an array.
767   *
768   * @private
769   * @param {string} string The string to convert.
770   * @returns {Array} Returns the converted array.
771   */
772  function asciiToArray(string) {
773    return string.split('');
774  }
775
776  /**
777   * Splits an ASCII `string` into an array of its words.
778   *
779   * @private
780   * @param {string} The string to inspect.
781   * @returns {Array} Returns the words of `string`.
782   */
783  function asciiWords(string) {
784    return string.match(reAsciiWord) || [];
785  }
786
787  /**
788   * The base implementation of methods like `_.findKey` and `_.findLastKey`,
789   * without support for iteratee shorthands, which iterates over `collection`
790   * using `eachFunc`.
791   *
792   * @private
793   * @param {Array|Object} collection The collection to inspect.
794   * @param {Function} predicate The function invoked per iteration.
795   * @param {Function} eachFunc The function to iterate over `collection`.
796   * @returns {*} Returns the found element or its key, else `undefined`.
797   */
798  function baseFindKey(collection, predicate, eachFunc) {
799    var result;
800    eachFunc(collection, function(value, key, collection) {
801      if (predicate(value, key, collection)) {
802        result = key;
803        return false;
804      }
805    });
806    return result;
807  }
808
809  /**
810   * The base implementation of `_.findIndex` and `_.findLastIndex` without
811   * support for iteratee shorthands.
812   *
813   * @private
814   * @param {Array} array The array to inspect.
815   * @param {Function} predicate The function invoked per iteration.
816   * @param {number} fromIndex The index to search from.
817   * @param {boolean} [fromRight] Specify iterating from right to left.
818   * @returns {number} Returns the index of the matched value, else `-1`.
819   */
820  function baseFindIndex(array, predicate, fromIndex, fromRight) {
821    var length = array.length,
822        index = fromIndex + (fromRight ? 1 : -1);
823
824    while ((fromRight ? index-- : ++index < length)) {
825      if (predicate(array[index], index, array)) {
826        return index;
827      }
828    }
829    return -1;
830  }
831
832  /**
833   * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
834   *
835   * @private
836   * @param {Array} array The array to inspect.
837   * @param {*} value The value to search for.
838   * @param {number} fromIndex The index to search from.
839   * @returns {number} Returns the index of the matched value, else `-1`.
840   */
841  function baseIndexOf(array, value, fromIndex) {
842    return value === value
843      ? strictIndexOf(array, value, fromIndex)
844      : baseFindIndex(array, baseIsNaN, fromIndex);
845  }
846
847  /**
848   * This function is like `baseIndexOf` except that it accepts a comparator.
849   *
850   * @private
851   * @param {Array} array The array to inspect.
852   * @param {*} value The value to search for.
853   * @param {number} fromIndex The index to search from.
854   * @param {Function} comparator The comparator invoked per element.
855   * @returns {number} Returns the index of the matched value, else `-1`.
856   */
857  function baseIndexOfWith(array, value, fromIndex, comparator) {
858    var index = fromIndex - 1,
859        length = array.length;
860
861    while (++index < length) {
862      if (comparator(array[index], value)) {
863        return index;
864      }
865    }
866    return -1;
867  }
868
869  /**
870   * The base implementation of `_.isNaN` without support for number objects.
871   *
872   * @private
873   * @param {*} value The value to check.
874   * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
875   */
876  function baseIsNaN(value) {
877    return value !== value;
878  }
879
880  /**
881   * The base implementation of `_.mean` and `_.meanBy` without support for
882   * iteratee shorthands.
883   *
884   * @private
885   * @param {Array} array The array to iterate over.
886   * @param {Function} iteratee The function invoked per iteration.
887   * @returns {number} Returns the mean.
888   */
889  function baseMean(array, iteratee) {
890    var length = array == null ? 0 : array.length;
891    return length ? (baseSum(array, iteratee) / length) : NAN;
892  }
893
894  /**
895   * The base implementation of `_.property` without support for deep paths.
896   *
897   * @private
898   * @param {string} key The key of the property to get.
899   * @returns {Function} Returns the new accessor function.
900   */
901  function baseProperty(key) {
902    return function(object) {
903      return object == null ? undefined : object[key];
904    };
905  }
906
907  /**
908   * The base implementation of `_.propertyOf` without support for deep paths.
909   *
910   * @private
911   * @param {Object} object The object to query.
912   * @returns {Function} Returns the new accessor function.
913   */
914  function basePropertyOf(object) {
915    return function(key) {
916      return object == null ? undefined : object[key];
917    };
918  }
919
920  /**
921   * The base implementation of `_.reduce` and `_.reduceRight`, without support
922   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
923   *
924   * @private
925   * @param {Array|Object} collection The collection to iterate over.
926   * @param {Function} iteratee The function invoked per iteration.
927   * @param {*} accumulator The initial value.
928   * @param {boolean} initAccum Specify using the first or last element of
929   *  `collection` as the initial value.
930   * @param {Function} eachFunc The function to iterate over `collection`.
931   * @returns {*} Returns the accumulated value.
932   */
933  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
934    eachFunc(collection, function(value, index, collection) {
935      accumulator = initAccum
936        ? (initAccum = false, value)
937        : iteratee(accumulator, value, index, collection);
938    });
939    return accumulator;
940  }
941
942  /**
943   * The base implementation of `_.sortBy` which uses `comparer` to define the
944   * sort order of `array` and replaces criteria objects with their corresponding
945   * values.
946   *
947   * @private
948   * @param {Array} array The array to sort.
949   * @param {Function} comparer The function to define sort order.
950   * @returns {Array} Returns `array`.
951   */
952  function baseSortBy(array, comparer) {
953    var length = array.length;
954
955    array.sort(comparer);
956    while (length--) {
957      array[length] = array[length].value;
958    }
959    return array;
960  }
961
962  /**
963   * The base implementation of `_.sum` and `_.sumBy` without support for
964   * iteratee shorthands.
965   *
966   * @private
967   * @param {Array} array The array to iterate over.
968   * @param {Function} iteratee The function invoked per iteration.
969   * @returns {number} Returns the sum.
970   */
971  function baseSum(array, iteratee) {
972    var result,
973        index = -1,
974        length = array.length;
975
976    while (++index < length) {
977      var current = iteratee(array[index]);
978      if (current !== undefined) {
979        result = result === undefined ? current : (result + current);
980      }
981    }
982    return result;
983  }
984
985  /**
986   * The base implementation of `_.times` without support for iteratee shorthands
987   * or max array length checks.
988   *
989   * @private
990   * @param {number} n The number of times to invoke `iteratee`.
991   * @param {Function} iteratee The function invoked per iteration.
992   * @returns {Array} Returns the array of results.
993   */
994  function baseTimes(n, iteratee) {
995    var index = -1,
996        result = Array(n);
997
998    while (++index < n) {
999      result[index] = iteratee(index);
1000    }
1001    return result;
1002  }
1003
1004  /**
1005   * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
1006   * of key-value pairs for `object` corresponding to the property names of `props`.
1007   *
1008   * @private
1009   * @param {Object} object The object to query.
1010   * @param {Array} props The property names to get values for.
1011   * @returns {Object} Returns the key-value pairs.
1012   */
1013  function baseToPairs(object, props) {
1014    return arrayMap(props, function(key) {
1015      return [key, object[key]];
1016    });
1017  }
1018
1019  /**
1020   * The base implementation of `_.trim`.
1021   *
1022   * @private
1023   * @param {string} string The string to trim.
1024   * @returns {string} Returns the trimmed string.
1025   */
1026  function baseTrim(string) {
1027    return string
1028      ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
1029      : string;
1030  }
1031
1032  /**
1033   * The base implementation of `_.unary` without support for storing metadata.
1034   *
1035   * @private
1036   * @param {Function} func The function to cap arguments for.
1037   * @returns {Function} Returns the new capped function.
1038   */
1039  function baseUnary(func) {
1040    return function(value) {
1041      return func(value);
1042    };
1043  }
1044
1045  /**
1046   * The base implementation of `_.values` and `_.valuesIn` which creates an
1047   * array of `object` property values corresponding to the property names
1048   * of `props`.
1049   *
1050   * @private
1051   * @param {Object} object The object to query.
1052   * @param {Array} props The property names to get values for.
1053   * @returns {Object} Returns the array of property values.
1054   */
1055  function baseValues(object, props) {
1056    return arrayMap(props, function(key) {
1057      return object[key];
1058    });
1059  }
1060
1061  /**
1062   * Checks if a `cache` value for `key` exists.
1063   *
1064   * @private
1065   * @param {Object} cache The cache to query.
1066   * @param {string} key The key of the entry to check.
1067   * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1068   */
1069  function cacheHas(cache, key) {
1070    return cache.has(key);
1071  }
1072
1073  /**
1074   * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
1075   * that is not found in the character symbols.
1076   *
1077   * @private
1078   * @param {Array} strSymbols The string symbols to inspect.
1079   * @param {Array} chrSymbols The character symbols to find.
1080   * @returns {number} Returns the index of the first unmatched string symbol.
1081   */
1082  function charsStartIndex(strSymbols, chrSymbols) {
1083    var index = -1,
1084        length = strSymbols.length;
1085
1086    while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
1087    return index;
1088  }
1089
1090  /**
1091   * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
1092   * that is not found in the character symbols.
1093   *
1094   * @private
1095   * @param {Array} strSymbols The string symbols to inspect.
1096   * @param {Array} chrSymbols The character symbols to find.
1097   * @returns {number} Returns the index of the last unmatched string symbol.
1098   */
1099  function charsEndIndex(strSymbols, chrSymbols) {
1100    var index = strSymbols.length;
1101
1102    while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
1103    return index;
1104  }
1105
1106  /**
1107   * Gets the number of `placeholder` occurrences in `array`.
1108   *
1109   * @private
1110   * @param {Array} array The array to inspect.
1111   * @param {*} placeholder The placeholder to search for.
1112   * @returns {number} Returns the placeholder count.
1113   */
1114  function countHolders(array, placeholder) {
1115    var length = array.length,
1116        result = 0;
1117
1118    while (length--) {
1119      if (array[length] === placeholder) {
1120        ++result;
1121      }
1122    }
1123    return result;
1124  }
1125
1126  /**
1127   * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
1128   * letters to basic Latin letters.
1129   *
1130   * @private
1131   * @param {string} letter The matched letter to deburr.
1132   * @returns {string} Returns the deburred letter.
1133   */
1134  var deburrLetter = basePropertyOf(deburredLetters);
1135
1136  /**
1137   * Used by `_.escape` to convert characters to HTML entities.
1138   *
1139   * @private
1140   * @param {string} chr The matched character to escape.
1141   * @returns {string} Returns the escaped character.
1142   */
1143  var escapeHtmlChar = basePropertyOf(htmlEscapes);
1144
1145  /**
1146   * Used by `_.template` to escape characters for inclusion in compiled string literals.
1147   *
1148   * @private
1149   * @param {string} chr The matched character to escape.
1150   * @returns {string} Returns the escaped character.
1151   */
1152  function escapeStringChar(chr) {
1153    return '\\' + stringEscapes[chr];
1154  }
1155
1156  /**
1157   * Gets the value at `key` of `object`.
1158   *
1159   * @private
1160   * @param {Object} [object] The object to query.
1161   * @param {string} key The key of the property to get.
1162   * @returns {*} Returns the property value.
1163   */
1164  function getValue(object, key) {
1165    return object == null ? undefined : object[key];
1166  }
1167
1168  /**
1169   * Checks if `string` contains Unicode symbols.
1170   *
1171   * @private
1172   * @param {string} string The string to inspect.
1173   * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1174   */
1175  function hasUnicode(string) {
1176    return reHasUnicode.test(string);
1177  }
1178
1179  /**
1180   * Checks if `string` contains a word composed of Unicode symbols.
1181   *
1182   * @private
1183   * @param {string} string The string to inspect.
1184   * @returns {boolean} Returns `true` if a word is found, else `false`.
1185   */
1186  function hasUnicodeWord(string) {
1187    return reHasUnicodeWord.test(string);
1188  }
1189
1190  /**
1191   * Converts `iterator` to an array.
1192   *
1193   * @private
1194   * @param {Object} iterator The iterator to convert.
1195   * @returns {Array} Returns the converted array.
1196   */
1197  function iteratorToArray(iterator) {
1198    var data,
1199        result = [];
1200
1201    while (!(data = iterator.next()).done) {
1202      result.push(data.value);
1203    }
1204    return result;
1205  }
1206
1207  /**
1208   * Converts `map` to its key-value pairs.
1209   *
1210   * @private
1211   * @param {Object} map The map to convert.
1212   * @returns {Array} Returns the key-value pairs.
1213   */
1214  function mapToArray(map) {
1215    var index = -1,
1216        result = Array(map.size);
1217
1218    map.forEach(function(value, key) {
1219      result[++index] = [key, value];
1220    });
1221    return result;
1222  }
1223
1224  /**
1225   * Creates a unary function that invokes `func` with its argument transformed.
1226   *
1227   * @private
1228   * @param {Function} func The function to wrap.
1229   * @param {Function} transform The argument transform.
1230   * @returns {Function} Returns the new function.
1231   */
1232  function overArg(func, transform) {
1233    return function(arg) {
1234      return func(transform(arg));
1235    };
1236  }
1237
1238  /**
1239   * Replaces all `placeholder` elements in `array` with an internal placeholder
1240   * and returns an array of their indexes.
1241   *
1242   * @private
1243   * @param {Array} array The array to modify.
1244   * @param {*} placeholder The placeholder to replace.
1245   * @returns {Array} Returns the new array of placeholder indexes.
1246   */
1247  function replaceHolders(array, placeholder) {
1248    var index = -1,
1249        length = array.length,
1250        resIndex = 0,
1251        result = [];
1252
1253    while (++index < length) {
1254      var value = array[index];
1255      if (value === placeholder || value === PLACEHOLDER) {
1256        array[index] = PLACEHOLDER;
1257        result[resIndex++] = index;
1258      }
1259    }
1260    return result;
1261  }
1262
1263  /**
1264   * Converts `set` to an array of its values.
1265   *
1266   * @private
1267   * @param {Object} set The set to convert.
1268   * @returns {Array} Returns the values.
1269   */
1270  function setToArray(set) {
1271    var index = -1,
1272        result = Array(set.size);
1273
1274    set.forEach(function(value) {
1275      result[++index] = value;
1276    });
1277    return result;
1278  }
1279
1280  /**
1281   * Converts `set` to its value-value pairs.
1282   *
1283   * @private
1284   * @param {Object} set The set to convert.
1285   * @returns {Array} Returns the value-value pairs.
1286   */
1287  function setToPairs(set) {
1288    var index = -1,
1289        result = Array(set.size);
1290
1291    set.forEach(function(value) {
1292      result[++index] = [value, value];
1293    });
1294    return result;
1295  }
1296
1297  /**
1298   * A specialized version of `_.indexOf` which performs strict equality
1299   * comparisons of values, i.e. `===`.
1300   *
1301   * @private
1302   * @param {Array} array The array to inspect.
1303   * @param {*} value The value to search for.
1304   * @param {number} fromIndex The index to search from.
1305   * @returns {number} Returns the index of the matched value, else `-1`.
1306   */
1307  function strictIndexOf(array, value, fromIndex) {
1308    var index = fromIndex - 1,
1309        length = array.length;
1310
1311    while (++index < length) {
1312      if (array[index] === value) {
1313        return index;
1314      }
1315    }
1316    return -1;
1317  }
1318
1319  /**
1320   * A specialized version of `_.lastIndexOf` which performs strict equality
1321   * comparisons of values, i.e. `===`.
1322   *
1323   * @private
1324   * @param {Array} array The array to inspect.
1325   * @param {*} value The value to search for.
1326   * @param {number} fromIndex The index to search from.
1327   * @returns {number} Returns the index of the matched value, else `-1`.
1328   */
1329  function strictLastIndexOf(array, value, fromIndex) {
1330    var index = fromIndex + 1;
1331    while (index--) {
1332      if (array[index] === value) {
1333        return index;
1334      }
1335    }
1336    return index;
1337  }
1338
1339  /**
1340   * Gets the number of symbols in `string`.
1341   *
1342   * @private
1343   * @param {string} string The string to inspect.
1344   * @returns {number} Returns the string size.
1345   */
1346  function stringSize(string) {
1347    return hasUnicode(string)
1348      ? unicodeSize(string)
1349      : asciiSize(string);
1350  }
1351
1352  /**
1353   * Converts `string` to an array.
1354   *
1355   * @private
1356   * @param {string} string The string to convert.
1357   * @returns {Array} Returns the converted array.
1358   */
1359  function stringToArray(string) {
1360    return hasUnicode(string)
1361      ? unicodeToArray(string)
1362      : asciiToArray(string);
1363  }
1364
1365  /**
1366   * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
1367   * character of `string`.
1368   *
1369   * @private
1370   * @param {string} string The string to inspect.
1371   * @returns {number} Returns the index of the last non-whitespace character.
1372   */
1373  function trimmedEndIndex(string) {
1374    var index = string.length;
1375
1376    while (index-- && reWhitespace.test(string.charAt(index))) {}
1377    return index;
1378  }
1379
1380  /**
1381   * Used by `_.unescape` to convert HTML entities to characters.
1382   *
1383   * @private
1384   * @param {string} chr The matched character to unescape.
1385   * @returns {string} Returns the unescaped character.
1386   */
1387  var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
1388
1389  /**
1390   * Gets the size of a Unicode `string`.
1391   *
1392   * @private
1393   * @param {string} string The string inspect.
1394   * @returns {number} Returns the string size.
1395   */
1396  function unicodeSize(string) {
1397    var result = reUnicode.lastIndex = 0;
1398    while (reUnicode.test(string)) {
1399      ++result;
1400    }
1401    return result;
1402  }
1403
1404  /**
1405   * Converts a Unicode `string` to an array.
1406   *
1407   * @private
1408   * @param {string} string The string to convert.
1409   * @returns {Array} Returns the converted array.
1410   */
1411  function unicodeToArray(string) {
1412    return string.match(reUnicode) || [];
1413  }
1414
1415  /**
1416   * Splits a Unicode `string` into an array of its words.
1417   *
1418   * @private
1419   * @param {string} The string to inspect.
1420   * @returns {Array} Returns the words of `string`.
1421   */
1422  function unicodeWords(string) {
1423    return string.match(reUnicodeWord) || [];
1424  }
1425
1426  /*--------------------------------------------------------------------------*/
1427
1428  /**
1429   * Create a new pristine `lodash` function using the `context` object.
1430   *
1431   * @static
1432   * @memberOf _
1433   * @since 1.1.0
1434   * @category Util
1435   * @param {Object} [context=root] The context object.
1436   * @returns {Function} Returns a new `lodash` function.
1437   * @example
1438   *
1439   * _.mixin({ 'foo': _.constant('foo') });
1440   *
1441   * var lodash = _.runInContext();
1442   * lodash.mixin({ 'bar': lodash.constant('bar') });
1443   *
1444   * _.isFunction(_.foo);
1445   * // => true
1446   * _.isFunction(_.bar);
1447   * // => false
1448   *
1449   * lodash.isFunction(lodash.foo);
1450   * // => false
1451   * lodash.isFunction(lodash.bar);
1452   * // => true
1453   *
1454   * // Create a suped-up `defer` in Node.js.
1455   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
1456   */
1457  var runInContext = (function runInContext(context) {
1458    context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
1459
1460    /** Built-in constructor references. */
1461    var Array = context.Array,
1462        Date = context.Date,
1463        Error = context.Error,
1464        Function = context.Function,
1465        Math = context.Math,
1466        Object = context.Object,
1467        RegExp = context.RegExp,
1468        String = context.String,
1469        TypeError = context.TypeError;
1470
1471    /** Used for built-in method references. */
1472    var arrayProto = Array.prototype,
1473        funcProto = Function.prototype,
1474        objectProto = Object.prototype;
1475
1476    /** Used to detect overreaching core-js shims. */
1477    var coreJsData = context['__core-js_shared__'];
1478
1479    /** Used to resolve the decompiled source of functions. */
1480    var funcToString = funcProto.toString;
1481
1482    /** Used to check objects for own properties. */
1483    var hasOwnProperty = objectProto.hasOwnProperty;
1484
1485    /** Used to generate unique IDs. */
1486    var idCounter = 0;
1487
1488    /** Used to detect methods masquerading as native. */
1489    var maskSrcKey = (function() {
1490      var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1491      return uid ? ('Symbol(src)_1.' + uid) : '';
1492    }());
1493
1494    /**
1495     * Used to resolve the
1496     * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1497     * of values.
1498     */
1499    var nativeObjectToString = objectProto.toString;
1500
1501    /** Used to infer the `Object` constructor. */
1502    var objectCtorString = funcToString.call(Object);
1503
1504    /** Used to restore the original `_` reference in `_.noConflict`. */
1505    var oldDash = root._;
1506
1507    /** Used to detect if a method is native. */
1508    var reIsNative = RegExp('^' +
1509      funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
1510      .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1511    );
1512
1513    /** Built-in value references. */
1514    var Buffer = moduleExports ? context.Buffer : undefined,
1515        Symbol = context.Symbol,
1516        Uint8Array = context.Uint8Array,
1517        allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
1518        getPrototype = overArg(Object.getPrototypeOf, Object),
1519        objectCreate = Object.create,
1520        propertyIsEnumerable = objectProto.propertyIsEnumerable,
1521        splice = arrayProto.splice,
1522        spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
1523        symIterator = Symbol ? Symbol.iterator : undefined,
1524        symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1525
1526    var defineProperty = (function() {
1527      try {
1528        var func = getNative(Object, 'defineProperty');
1529        func({}, '', {});
1530        return func;
1531      } catch (e) {}
1532    }());
1533
1534    /** Mocked built-ins. */
1535    var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
1536        ctxNow = Date && Date.now !== root.Date.now && Date.now,
1537        ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1538
1539    /* Built-in method references for those with the same name as other `lodash` methods. */
1540    var nativeCeil = Math.ceil,
1541        nativeFloor = Math.floor,
1542        nativeGetSymbols = Object.getOwnPropertySymbols,
1543        nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
1544        nativeIsFinite = context.isFinite,
1545        nativeJoin = arrayProto.join,
1546        nativeKeys = overArg(Object.keys, Object),
1547        nativeMax = Math.max,
1548        nativeMin = Math.min,
1549        nativeNow = Date.now,
1550        nativeParseInt = context.parseInt,
1551        nativeRandom = Math.random,
1552        nativeReverse = arrayProto.reverse;
1553
1554    /* Built-in method references that are verified to be native. */
1555    var DataView = getNative(context, 'DataView'),
1556        Map = getNative(context, 'Map'),
1557        Promise = getNative(context, 'Promise'),
1558        Set = getNative(context, 'Set'),
1559        WeakMap = getNative(context, 'WeakMap'),
1560        nativeCreate = getNative(Object, 'create');
1561
1562    /** Used to store function metadata. */
1563    var metaMap = WeakMap && new WeakMap;
1564
1565    /** Used to lookup unminified function names. */
1566    var realNames = {};
1567
1568    /** Used to detect maps, sets, and weakmaps. */
1569    var dataViewCtorString = toSource(DataView),
1570        mapCtorString = toSource(Map),
1571        promiseCtorString = toSource(Promise),
1572        setCtorString = toSource(Set),
1573        weakMapCtorString = toSource(WeakMap);
1574
1575    /** Used to convert symbols to primitives and strings. */
1576    var symbolProto = Symbol ? Symbol.prototype : undefined,
1577        symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
1578        symbolToString = symbolProto ? symbolProto.toString : undefined;
1579
1580    /*------------------------------------------------------------------------*/
1581
1582    /**
1583     * Creates a `lodash` object which wraps `value` to enable implicit method
1584     * chain sequences. Methods that operate on and return arrays, collections,
1585     * and functions can be chained together. Methods that retrieve a single value
1586     * or may return a primitive value will automatically end the chain sequence
1587     * and return the unwrapped value. Otherwise, the value must be unwrapped
1588     * with `_#value`.
1589     *
1590     * Explicit chain sequences, which must be unwrapped with `_#value`, may be
1591     * enabled using `_.chain`.
1592     *
1593     * The execution of chained methods is lazy, that is, it's deferred until
1594     * `_#value` is implicitly or explicitly called.
1595     *
1596     * Lazy evaluation allows several methods to support shortcut fusion.
1597     * Shortcut fusion is an optimization to merge iteratee calls; this avoids
1598     * the creation of intermediate arrays and can greatly reduce the number of
1599     * iteratee executions. Sections of a chain sequence qualify for shortcut
1600     * fusion if the section is applied to an array and iteratees accept only
1601     * one argument. The heuristic for whether a section qualifies for shortcut
1602     * fusion is subject to change.
1603     *
1604     * Chaining is supported in custom builds as long as the `_#value` method is
1605     * directly or indirectly included in the build.
1606     *
1607     * In addition to lodash methods, wrappers have `Array` and `String` methods.
1608     *
1609     * The wrapper `Array` methods are:
1610     * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
1611     *
1612     * The wrapper `String` methods are:
1613     * `replace` and `split`
1614     *
1615     * The wrapper methods that support shortcut fusion are:
1616     * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
1617     * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
1618     * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
1619     *
1620     * The chainable wrapper methods are:
1621     * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
1622     * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
1623     * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
1624     * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
1625     * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
1626     * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
1627     * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
1628     * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
1629     * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
1630     * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
1631     * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
1632     * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
1633     * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
1634     * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
1635     * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
1636     * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
1637     * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
1638     * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
1639     * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
1640     * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
1641     * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
1642     * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
1643     * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
1644     * `zipObject`, `zipObjectDeep`, and `zipWith`
1645     *
1646     * The wrapper methods that are **not** chainable by default are:
1647     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
1648     * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
1649     * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
1650     * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
1651     * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
1652     * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
1653     * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
1654     * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
1655     * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
1656     * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
1657     * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
1658     * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
1659     * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
1660     * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
1661     * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
1662     * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
1663     * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
1664     * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
1665     * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
1666     * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
1667     * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
1668     * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
1669     * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
1670     * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
1671     * `upperFirst`, `value`, and `words`
1672     *
1673     * @name _
1674     * @constructor
1675     * @category Seq
1676     * @param {*} value The value to wrap in a `lodash` instance.
1677     * @returns {Object} Returns the new `lodash` wrapper instance.
1678     * @example
1679     *
1680     * function square(n) {
1681     *   return n * n;
1682     * }
1683     *
1684     * var wrapped = _([1, 2, 3]);
1685     *
1686     * // Returns an unwrapped value.
1687     * wrapped.reduce(_.add);
1688     * // => 6
1689     *
1690     * // Returns a wrapped value.
1691     * var squares = wrapped.map(square);
1692     *
1693     * _.isArray(squares);
1694     * // => false
1695     *
1696     * _.isArray(squares.value());
1697     * // => true
1698     */
1699    function lodash(value) {
1700      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
1701        if (value instanceof LodashWrapper) {
1702          return value;
1703        }
1704        if (hasOwnProperty.call(value, '__wrapped__')) {
1705          return wrapperClone(value);
1706        }
1707      }
1708      return new LodashWrapper(value);
1709    }
1710
1711    /**
1712     * The base implementation of `_.create` without support for assigning
1713     * properties to the created object.
1714     *
1715     * @private
1716     * @param {Object} proto The object to inherit from.
1717     * @returns {Object} Returns the new object.
1718     */
1719    var baseCreate = (function() {
1720      function object() {}
1721      return function(proto) {
1722        if (!isObject(proto)) {
1723          return {};
1724        }
1725        if (objectCreate) {
1726          return objectCreate(proto);
1727        }
1728        object.prototype = proto;
1729        var result = new object;
1730        object.prototype = undefined;
1731        return result;
1732      };
1733    }());
1734
1735    /**
1736     * The function whose prototype chain sequence wrappers inherit from.
1737     *
1738     * @private
1739     */
1740    function baseLodash() {
1741      // No operation performed.
1742    }
1743
1744    /**
1745     * The base constructor for creating `lodash` wrapper objects.
1746     *
1747     * @private
1748     * @param {*} value The value to wrap.
1749     * @param {boolean} [chainAll] Enable explicit method chain sequences.
1750     */
1751    function LodashWrapper(value, chainAll) {
1752      this.__wrapped__ = value;
1753      this.__actions__ = [];
1754      this.__chain__ = !!chainAll;
1755      this.__index__ = 0;
1756      this.__values__ = undefined;
1757    }
1758
1759    /**
1760     * By default, the template delimiters used by lodash are like those in
1761     * embedded Ruby (ERB) as well as ES2015 template strings. Change the
1762     * following template settings to use alternative delimiters.
1763     *
1764     * @static
1765     * @memberOf _
1766     * @type {Object}
1767     */
1768    lodash.templateSettings = {
1769
1770      /**
1771       * Used to detect `data` property values to be HTML-escaped.
1772       *
1773       * @memberOf _.templateSettings
1774       * @type {RegExp}
1775       */
1776      'escape': reEscape,
1777
1778      /**
1779       * Used to detect code to be evaluated.
1780       *
1781       * @memberOf _.templateSettings
1782       * @type {RegExp}
1783       */
1784      'evaluate': reEvaluate,
1785
1786      /**
1787       * Used to detect `data` property values to inject.
1788       *
1789       * @memberOf _.templateSettings
1790       * @type {RegExp}
1791       */
1792      'interpolate': reInterpolate,
1793
1794      /**
1795       * Used to reference the data object in the template text.
1796       *
1797       * @memberOf _.templateSettings
1798       * @type {string}
1799       */
1800      'variable': '',
1801
1802      /**
1803       * Used to import variables into the compiled template.
1804       *
1805       * @memberOf _.templateSettings
1806       * @type {Object}
1807       */
1808      'imports': {
1809
1810        /**
1811         * A reference to the `lodash` function.
1812         *
1813         * @memberOf _.templateSettings.imports
1814         * @type {Function}
1815         */
1816        '_': lodash
1817      }
1818    };
1819
1820    // Ensure wrappers are instances of `baseLodash`.
1821    lodash.prototype = baseLodash.prototype;
1822    lodash.prototype.constructor = lodash;
1823
1824    LodashWrapper.prototype = baseCreate(baseLodash.prototype);
1825    LodashWrapper.prototype.constructor = LodashWrapper;
1826
1827    /*------------------------------------------------------------------------*/
1828
1829    /**
1830     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
1831     *
1832     * @private
1833     * @constructor
1834     * @param {*} value The value to wrap.
1835     */
1836    function LazyWrapper(value) {
1837      this.__wrapped__ = value;
1838      this.__actions__ = [];
1839      this.__dir__ = 1;
1840      this.__filtered__ = false;
1841      this.__iteratees__ = [];
1842      this.__takeCount__ = MAX_ARRAY_LENGTH;
1843      this.__views__ = [];
1844    }
1845
1846    /**
1847     * Creates a clone of the lazy wrapper object.
1848     *
1849     * @private
1850     * @name clone
1851     * @memberOf LazyWrapper
1852     * @returns {Object} Returns the cloned `LazyWrapper` object.
1853     */
1854    function lazyClone() {
1855      var result = new LazyWrapper(this.__wrapped__);
1856      result.__actions__ = copyArray(this.__actions__);
1857      result.__dir__ = this.__dir__;
1858      result.__filtered__ = this.__filtered__;
1859      result.__iteratees__ = copyArray(this.__iteratees__);
1860      result.__takeCount__ = this.__takeCount__;
1861      result.__views__ = copyArray(this.__views__);
1862      return result;
1863    }
1864
1865    /**
1866     * Reverses the direction of lazy iteration.
1867     *
1868     * @private
1869     * @name reverse
1870     * @memberOf LazyWrapper
1871     * @returns {Object} Returns the new reversed `LazyWrapper` object.
1872     */
1873    function lazyReverse() {
1874      if (this.__filtered__) {
1875        var result = new LazyWrapper(this);
1876        result.__dir__ = -1;
1877        result.__filtered__ = true;
1878      } else {
1879        result = this.clone();
1880        result.__dir__ *= -1;
1881      }
1882      return result;
1883    }
1884
1885    /**
1886     * Extracts the unwrapped value from its lazy wrapper.
1887     *
1888     * @private
1889     * @name value
1890     * @memberOf LazyWrapper
1891     * @returns {*} Returns the unwrapped value.
1892     */
1893    function lazyValue() {
1894      var array = this.__wrapped__.value(),
1895          dir = this.__dir__,
1896          isArr = isArray(array),
1897          isRight = dir < 0,
1898          arrLength = isArr ? array.length : 0,
1899          view = getView(0, arrLength, this.__views__),
1900          start = view.start,
1901          end = view.end,
1902          length = end - start,
1903          index = isRight ? end : (start - 1),
1904          iteratees = this.__iteratees__,
1905          iterLength = iteratees.length,
1906          resIndex = 0,
1907          takeCount = nativeMin(length, this.__takeCount__);
1908
1909      if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
1910        return baseWrapperValue(array, this.__actions__);
1911      }
1912      var result = [];
1913
1914      outer:
1915      while (length-- && resIndex < takeCount) {
1916        index += dir;
1917
1918        var iterIndex = -1,
1919            value = array[index];
1920
1921        while (++iterIndex < iterLength) {
1922          var data = iteratees[iterIndex],
1923              iteratee = data.iteratee,
1924              type = data.type,
1925              computed = iteratee(value);
1926
1927          if (type == LAZY_MAP_FLAG) {
1928            value = computed;
1929          } else if (!computed) {
1930            if (type == LAZY_FILTER_FLAG) {
1931              continue outer;
1932            } else {
1933              break outer;
1934            }
1935          }
1936        }
1937        result[resIndex++] = value;
1938      }
1939      return result;
1940    }
1941
1942    // Ensure `LazyWrapper` is an instance of `baseLodash`.
1943    LazyWrapper.prototype = baseCreate(baseLodash.prototype);
1944    LazyWrapper.prototype.constructor = LazyWrapper;
1945
1946    /*------------------------------------------------------------------------*/
1947
1948    /**
1949     * Creates a hash object.
1950     *
1951     * @private
1952     * @constructor
1953     * @param {Array} [entries] The key-value pairs to cache.
1954     */
1955    function Hash(entries) {
1956      var index = -1,
1957          length = entries == null ? 0 : entries.length;
1958
1959      this.clear();
1960      while (++index < length) {
1961        var entry = entries[index];
1962        this.set(entry[0], entry[1]);
1963      }
1964    }
1965
1966    /**
1967     * Removes all key-value entries from the hash.
1968     *
1969     * @private
1970     * @name clear
1971     * @memberOf Hash
1972     */
1973    function hashClear() {
1974      this.__data__ = nativeCreate ? nativeCreate(null) : {};
1975      this.size = 0;
1976    }
1977
1978    /**
1979     * Removes `key` and its value from the hash.
1980     *
1981     * @private
1982     * @name delete
1983     * @memberOf Hash
1984     * @param {Object} hash The hash to modify.
1985     * @param {string} key The key of the value to remove.
1986     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1987     */
1988    function hashDelete(key) {
1989      var result = this.has(key) && delete this.__data__[key];
1990      this.size -= result ? 1 : 0;
1991      return result;
1992    }
1993
1994    /**
1995     * Gets the hash value for `key`.
1996     *
1997     * @private
1998     * @name get
1999     * @memberOf Hash
2000     * @param {string} key The key of the value to get.
2001     * @returns {*} Returns the entry value.
2002     */
2003    function hashGet(key) {
2004      var data = this.__data__;
2005      if (nativeCreate) {
2006        var result = data[key];
2007        return result === HASH_UNDEFINED ? undefined : result;
2008      }
2009      return hasOwnProperty.call(data, key) ? data[key] : undefined;
2010    }
2011
2012    /**
2013     * Checks if a hash value for `key` exists.
2014     *
2015     * @private
2016     * @name has
2017     * @memberOf Hash
2018     * @param {string} key The key of the entry to check.
2019     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2020     */
2021    function hashHas(key) {
2022      var data = this.__data__;
2023      return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
2024    }
2025
2026    /**
2027     * Sets the hash `key` to `value`.
2028     *
2029     * @private
2030     * @name set
2031     * @memberOf Hash
2032     * @param {string} key The key of the value to set.
2033     * @param {*} value The value to set.
2034     * @returns {Object} Returns the hash instance.
2035     */
2036    function hashSet(key, value) {
2037      var data = this.__data__;
2038      this.size += this.has(key) ? 0 : 1;
2039      data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
2040      return this;
2041    }
2042
2043    // Add methods to `Hash`.
2044    Hash.prototype.clear = hashClear;
2045    Hash.prototype['delete'] = hashDelete;
2046    Hash.prototype.get = hashGet;
2047    Hash.prototype.has = hashHas;
2048    Hash.prototype.set = hashSet;
2049
2050    /*------------------------------------------------------------------------*/
2051
2052    /**
2053     * Creates an list cache object.
2054     *
2055     * @private
2056     * @constructor
2057     * @param {Array} [entries] The key-value pairs to cache.
2058     */
2059    function ListCache(entries) {
2060      var index = -1,
2061          length = entries == null ? 0 : entries.length;
2062
2063      this.clear();
2064      while (++index < length) {
2065        var entry = entries[index];
2066        this.set(entry[0], entry[1]);
2067      }
2068    }
2069
2070    /**
2071     * Removes all key-value entries from the list cache.
2072     *
2073     * @private
2074     * @name clear
2075     * @memberOf ListCache
2076     */
2077    function listCacheClear() {
2078      this.__data__ = [];
2079      this.size = 0;
2080    }
2081
2082    /**
2083     * Removes `key` and its value from the list cache.
2084     *
2085     * @private
2086     * @name delete
2087     * @memberOf ListCache
2088     * @param {string} key The key of the value to remove.
2089     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2090     */
2091    function listCacheDelete(key) {
2092      var data = this.__data__,
2093          index = assocIndexOf(data, key);
2094
2095      if (index < 0) {
2096        return false;
2097      }
2098      var lastIndex = data.length - 1;
2099      if (index == lastIndex) {
2100        data.pop();
2101      } else {
2102        splice.call(data, index, 1);
2103      }
2104      --this.size;
2105      return true;
2106    }
2107
2108    /**
2109     * Gets the list cache value for `key`.
2110     *
2111     * @private
2112     * @name get
2113     * @memberOf ListCache
2114     * @param {string} key The key of the value to get.
2115     * @returns {*} Returns the entry value.
2116     */
2117    function listCacheGet(key) {
2118      var data = this.__data__,
2119          index = assocIndexOf(data, key);
2120
2121      return index < 0 ? undefined : data[index][1];
2122    }
2123
2124    /**
2125     * Checks if a list cache value for `key` exists.
2126     *
2127     * @private
2128     * @name has
2129     * @memberOf ListCache
2130     * @param {string} key The key of the entry to check.
2131     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2132     */
2133    function listCacheHas(key) {
2134      return assocIndexOf(this.__data__, key) > -1;
2135    }
2136
2137    /**
2138     * Sets the list cache `key` to `value`.
2139     *
2140     * @private
2141     * @name set
2142     * @memberOf ListCache
2143     * @param {string} key The key of the value to set.
2144     * @param {*} value The value to set.
2145     * @returns {Object} Returns the list cache instance.
2146     */
2147    function listCacheSet(key, value) {
2148      var data = this.__data__,
2149          index = assocIndexOf(data, key);
2150
2151      if (index < 0) {
2152        ++this.size;
2153        data.push([key, value]);
2154      } else {
2155        data[index][1] = value;
2156      }
2157      return this;
2158    }
2159
2160    // Add methods to `ListCache`.
2161    ListCache.prototype.clear = listCacheClear;
2162    ListCache.prototype['delete'] = listCacheDelete;
2163    ListCache.prototype.get = listCacheGet;
2164    ListCache.prototype.has = listCacheHas;
2165    ListCache.prototype.set = listCacheSet;
2166
2167    /*------------------------------------------------------------------------*/
2168
2169    /**
2170     * Creates a map cache object to store key-value pairs.
2171     *
2172     * @private
2173     * @constructor
2174     * @param {Array} [entries] The key-value pairs to cache.
2175     */
2176    function MapCache(entries) {
2177      var index = -1,
2178          length = entries == null ? 0 : entries.length;
2179
2180      this.clear();
2181      while (++index < length) {
2182        var entry = entries[index];
2183        this.set(entry[0], entry[1]);
2184      }
2185    }
2186
2187    /**
2188     * Removes all key-value entries from the map.
2189     *
2190     * @private
2191     * @name clear
2192     * @memberOf MapCache
2193     */
2194    function mapCacheClear() {
2195      this.size = 0;
2196      this.__data__ = {
2197        'hash': new Hash,
2198        'map': new (Map || ListCache),
2199        'string': new Hash
2200      };
2201    }
2202
2203    /**
2204     * Removes `key` and its value from the map.
2205     *
2206     * @private
2207     * @name delete
2208     * @memberOf MapCache
2209     * @param {string} key The key of the value to remove.
2210     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2211     */
2212    function mapCacheDelete(key) {
2213      var result = getMapData(this, key)['delete'](key);
2214      this.size -= result ? 1 : 0;
2215      return result;
2216    }
2217
2218    /**
2219     * Gets the map value for `key`.
2220     *
2221     * @private
2222     * @name get
2223     * @memberOf MapCache
2224     * @param {string} key The key of the value to get.
2225     * @returns {*} Returns the entry value.
2226     */
2227    function mapCacheGet(key) {
2228      return getMapData(this, key).get(key);
2229    }
2230
2231    /**
2232     * Checks if a map value for `key` exists.
2233     *
2234     * @private
2235     * @name has
2236     * @memberOf MapCache
2237     * @param {string} key The key of the entry to check.
2238     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2239     */
2240    function mapCacheHas(key) {
2241      return getMapData(this, key).has(key);
2242    }
2243
2244    /**
2245     * Sets the map `key` to `value`.
2246     *
2247     * @private
2248     * @name set
2249     * @memberOf MapCache
2250     * @param {string} key The key of the value to set.
2251     * @param {*} value The value to set.
2252     * @returns {Object} Returns the map cache instance.
2253     */
2254    function mapCacheSet(key, value) {
2255      var data = getMapData(this, key),
2256          size = data.size;
2257
2258      data.set(key, value);
2259      this.size += data.size == size ? 0 : 1;
2260      return this;
2261    }
2262
2263    // Add methods to `MapCache`.
2264    MapCache.prototype.clear = mapCacheClear;
2265    MapCache.prototype['delete'] = mapCacheDelete;
2266    MapCache.prototype.get = mapCacheGet;
2267    MapCache.prototype.has = mapCacheHas;
2268    MapCache.prototype.set = mapCacheSet;
2269
2270    /*------------------------------------------------------------------------*/
2271
2272    /**
2273     *
2274     * Creates an array cache object to store unique values.
2275     *
2276     * @private
2277     * @constructor
2278     * @param {Array} [values] The values to cache.
2279     */
2280    function SetCache(values) {
2281      var index = -1,
2282          length = values == null ? 0 : values.length;
2283
2284      this.__data__ = new MapCache;
2285      while (++index < length) {
2286        this.add(values[index]);
2287      }
2288    }
2289
2290    /**
2291     * Adds `value` to the array cache.
2292     *
2293     * @private
2294     * @name add
2295     * @memberOf SetCache
2296     * @alias push
2297     * @param {*} value The value to cache.
2298     * @returns {Object} Returns the cache instance.
2299     */
2300    function setCacheAdd(value) {
2301      this.__data__.set(value, HASH_UNDEFINED);
2302      return this;
2303    }
2304
2305    /**
2306     * Checks if `value` is in the array cache.
2307     *
2308     * @private
2309     * @name has
2310     * @memberOf SetCache
2311     * @param {*} value The value to search for.
2312     * @returns {number} Returns `true` if `value` is found, else `false`.
2313     */
2314    function setCacheHas(value) {
2315      return this.__data__.has(value);
2316    }
2317
2318    // Add methods to `SetCache`.
2319    SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
2320    SetCache.prototype.has = setCacheHas;
2321
2322    /*------------------------------------------------------------------------*/
2323
2324    /**
2325     * Creates a stack cache object to store key-value pairs.
2326     *
2327     * @private
2328     * @constructor
2329     * @param {Array} [entries] The key-value pairs to cache.
2330     */
2331    function Stack(entries) {
2332      var data = this.__data__ = new ListCache(entries);
2333      this.size = data.size;
2334    }
2335
2336    /**
2337     * Removes all key-value entries from the stack.
2338     *
2339     * @private
2340     * @name clear
2341     * @memberOf Stack
2342     */
2343    function stackClear() {
2344      this.__data__ = new ListCache;
2345      this.size = 0;
2346    }
2347
2348    /**
2349     * Removes `key` and its value from the stack.
2350     *
2351     * @private
2352     * @name delete
2353     * @memberOf Stack
2354     * @param {string} key The key of the value to remove.
2355     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2356     */
2357    function stackDelete(key) {
2358      var data = this.__data__,
2359          result = data['delete'](key);
2360
2361      this.size = data.size;
2362      return result;
2363    }
2364
2365    /**
2366     * Gets the stack value for `key`.
2367     *
2368     * @private
2369     * @name get
2370     * @memberOf Stack
2371     * @param {string} key The key of the value to get.
2372     * @returns {*} Returns the entry value.
2373     */
2374    function stackGet(key) {
2375      return this.__data__.get(key);
2376    }
2377
2378    /**
2379     * Checks if a stack value for `key` exists.
2380     *
2381     * @private
2382     * @name has
2383     * @memberOf Stack
2384     * @param {string} key The key of the entry to check.
2385     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2386     */
2387    function stackHas(key) {
2388      return this.__data__.has(key);
2389    }
2390
2391    /**
2392     * Sets the stack `key` to `value`.
2393     *
2394     * @private
2395     * @name set
2396     * @memberOf Stack
2397     * @param {string} key The key of the value to set.
2398     * @param {*} value The value to set.
2399     * @returns {Object} Returns the stack cache instance.
2400     */
2401    function stackSet(key, value) {
2402      var data = this.__data__;
2403      if (data instanceof ListCache) {
2404        var pairs = data.__data__;
2405        if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2406          pairs.push([key, value]);
2407          this.size = ++data.size;
2408          return this;
2409        }
2410        data = this.__data__ = new MapCache(pairs);
2411      }
2412      data.set(key, value);
2413      this.size = data.size;
2414      return this;
2415    }
2416
2417    // Add methods to `Stack`.
2418    Stack.prototype.clear = stackClear;
2419    Stack.prototype['delete'] = stackDelete;
2420    Stack.prototype.get = stackGet;
2421    Stack.prototype.has = stackHas;
2422    Stack.prototype.set = stackSet;
2423
2424    /*------------------------------------------------------------------------*/
2425
2426    /**
2427     * Creates an array of the enumerable property names of the array-like `value`.
2428     *
2429     * @private
2430     * @param {*} value The value to query.
2431     * @param {boolean} inherited Specify returning inherited property names.
2432     * @returns {Array} Returns the array of property names.
2433     */
2434    function arrayLikeKeys(value, inherited) {
2435      var isArr = isArray(value),
2436          isArg = !isArr && isArguments(value),
2437          isBuff = !isArr && !isArg && isBuffer(value),
2438          isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2439          skipIndexes = isArr || isArg || isBuff || isType,
2440          result = skipIndexes ? baseTimes(value.length, String) : [],
2441          length = result.length;
2442
2443      for (var key in value) {
2444        if ((inherited || hasOwnProperty.call(value, key)) &&
2445            !(skipIndexes && (
2446               // Safari 9 has enumerable `arguments.length` in strict mode.
2447               key == 'length' ||
2448               // Node.js 0.10 has enumerable non-index properties on buffers.
2449               (isBuff && (key == 'offset' || key == 'parent')) ||
2450               // PhantomJS 2 has enumerable non-index properties on typed arrays.
2451               (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2452               // Skip index properties.
2453               isIndex(key, length)
2454            ))) {
2455          result.push(key);
2456        }
2457      }
2458      return result;
2459    }
2460
2461    /**
2462     * A specialized version of `_.sample` for arrays.
2463     *
2464     * @private
2465     * @param {Array} array The array to sample.
2466     * @returns {*} Returns the random element.
2467     */
2468    function arraySample(array) {
2469      var length = array.length;
2470      return length ? array[baseRandom(0, length - 1)] : undefined;
2471    }
2472
2473    /**
2474     * A specialized version of `_.sampleSize` for arrays.
2475     *
2476     * @private
2477     * @param {Array} array The array to sample.
2478     * @param {number} n The number of elements to sample.
2479     * @returns {Array} Returns the random elements.
2480     */
2481    function arraySampleSize(array, n) {
2482      return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
2483    }
2484
2485    /**
2486     * A specialized version of `_.shuffle` for arrays.
2487     *
2488     * @private
2489     * @param {Array} array The array to shuffle.
2490     * @returns {Array} Returns the new shuffled array.
2491     */
2492    function arrayShuffle(array) {
2493      return shuffleSelf(copyArray(array));
2494    }
2495
2496    /**
2497     * This function is like `assignValue` except that it doesn't assign
2498     * `undefined` values.
2499     *
2500     * @private
2501     * @param {Object} object The object to modify.
2502     * @param {string} key The key of the property to assign.
2503     * @param {*} value The value to assign.
2504     */
2505    function assignMergeValue(object, key, value) {
2506      if ((value !== undefined && !eq(object[key], value)) ||
2507          (value === undefined && !(key in object))) {
2508        baseAssignValue(object, key, value);
2509      }
2510    }
2511
2512    /**
2513     * Assigns `value` to `key` of `object` if the existing value is not equivalent
2514     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2515     * for equality comparisons.
2516     *
2517     * @private
2518     * @param {Object} object The object to modify.
2519     * @param {string} key The key of the property to assign.
2520     * @param {*} value The value to assign.
2521     */
2522    function assignValue(object, key, value) {
2523      var objValue = object[key];
2524      if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
2525          (value === undefined && !(key in object))) {
2526        baseAssignValue(object, key, value);
2527      }
2528    }
2529
2530    /**
2531     * Gets the index at which the `key` is found in `array` of key-value pairs.
2532     *
2533     * @private
2534     * @param {Array} array The array to inspect.
2535     * @param {*} key The key to search for.
2536     * @returns {number} Returns the index of the matched value, else `-1`.
2537     */
2538    function assocIndexOf(array, key) {
2539      var length = array.length;
2540      while (length--) {
2541        if (eq(array[length][0], key)) {
2542          return length;
2543        }
2544      }
2545      return -1;
2546    }
2547
2548    /**
2549     * Aggregates elements of `collection` on `accumulator` with keys transformed
2550     * by `iteratee` and values set by `setter`.
2551     *
2552     * @private
2553     * @param {Array|Object} collection The collection to iterate over.
2554     * @param {Function} setter The function to set `accumulator` values.
2555     * @param {Function} iteratee The iteratee to transform keys.
2556     * @param {Object} accumulator The initial aggregated object.
2557     * @returns {Function} Returns `accumulator`.
2558     */
2559    function baseAggregator(collection, setter, iteratee, accumulator) {
2560      baseEach(collection, function(value, key, collection) {
2561        setter(accumulator, value, iteratee(value), collection);
2562      });
2563      return accumulator;
2564    }
2565
2566    /**
2567     * The base implementation of `_.assign` without support for multiple sources
2568     * or `customizer` functions.
2569     *
2570     * @private
2571     * @param {Object} object The destination object.
2572     * @param {Object} source The source object.
2573     * @returns {Object} Returns `object`.
2574     */
2575    function baseAssign(object, source) {
2576      return object && copyObject(source, keys(source), object);
2577    }
2578
2579    /**
2580     * The base implementation of `_.assignIn` without support for multiple sources
2581     * or `customizer` functions.
2582     *
2583     * @private
2584     * @param {Object} object The destination object.
2585     * @param {Object} source The source object.
2586     * @returns {Object} Returns `object`.
2587     */
2588    function baseAssignIn(object, source) {
2589      return object && copyObject(source, keysIn(source), object);
2590    }
2591
2592    /**
2593     * The base implementation of `assignValue` and `assignMergeValue` without
2594     * value checks.
2595     *
2596     * @private
2597     * @param {Object} object The object to modify.
2598     * @param {string} key The key of the property to assign.
2599     * @param {*} value The value to assign.
2600     */
2601    function baseAssignValue(object, key, value) {
2602      if (key == '__proto__' && defineProperty) {
2603        defineProperty(object, key, {
2604          'configurable': true,
2605          'enumerable': true,
2606          'value': value,
2607          'writable': true
2608        });
2609      } else {
2610        object[key] = value;
2611      }
2612    }
2613
2614    /**
2615     * The base implementation of `_.at` without support for individual paths.
2616     *
2617     * @private
2618     * @param {Object} object The object to iterate over.
2619     * @param {string[]} paths The property paths to pick.
2620     * @returns {Array} Returns the picked elements.
2621     */
2622    function baseAt(object, paths) {
2623      var index = -1,
2624          length = paths.length,
2625          result = Array(length),
2626          skip = object == null;
2627
2628      while (++index < length) {
2629        result[index] = skip ? undefined : get(object, paths[index]);
2630      }
2631      return result;
2632    }
2633
2634    /**
2635     * The base implementation of `_.clamp` which doesn't coerce arguments.
2636     *
2637     * @private
2638     * @param {number} number The number to clamp.
2639     * @param {number} [lower] The lower bound.
2640     * @param {number} upper The upper bound.
2641     * @returns {number} Returns the clamped number.
2642     */
2643    function baseClamp(number, lower, upper) {
2644      if (number === number) {
2645        if (upper !== undefined) {
2646          number = number <= upper ? number : upper;
2647        }
2648        if (lower !== undefined) {
2649          number = number >= lower ? number : lower;
2650        }
2651      }
2652      return number;
2653    }
2654
2655    /**
2656     * The base implementation of `_.clone` and `_.cloneDeep` which tracks
2657     * traversed objects.
2658     *
2659     * @private
2660     * @param {*} value The value to clone.
2661     * @param {boolean} bitmask The bitmask flags.
2662     *  1 - Deep clone
2663     *  2 - Flatten inherited properties
2664     *  4 - Clone symbols
2665     * @param {Function} [customizer] The function to customize cloning.
2666     * @param {string} [key] The key of `value`.
2667     * @param {Object} [object] The parent object of `value`.
2668     * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
2669     * @returns {*} Returns the cloned value.
2670     */
2671    function baseClone(value, bitmask, customizer, key, object, stack) {
2672      var result,
2673          isDeep = bitmask & CLONE_DEEP_FLAG,
2674          isFlat = bitmask & CLONE_FLAT_FLAG,
2675          isFull = bitmask & CLONE_SYMBOLS_FLAG;
2676
2677      if (customizer) {
2678        result = object ? customizer(value, key, object, stack) : customizer(value);
2679      }
2680      if (result !== undefined) {
2681        return result;
2682      }
2683      if (!isObject(value)) {
2684        return value;
2685      }
2686      var isArr = isArray(value);
2687      if (isArr) {
2688        result = initCloneArray(value);
2689        if (!isDeep) {
2690          return copyArray(value, result);
2691        }
2692      } else {
2693        var tag = getTag(value),
2694            isFunc = tag == funcTag || tag == genTag;
2695
2696        if (isBuffer(value)) {
2697          return cloneBuffer(value, isDeep);
2698        }
2699        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
2700          result = (isFlat || isFunc) ? {} : initCloneObject(value);
2701          if (!isDeep) {
2702            return isFlat
2703              ? copySymbolsIn(value, baseAssignIn(result, value))
2704              : copySymbols(value, baseAssign(result, value));
2705          }
2706        } else {
2707          if (!cloneableTags[tag]) {
2708            return object ? value : {};
2709          }
2710          result = initCloneByTag(value, tag, isDeep);
2711        }
2712      }
2713      // Check for circular references and return its corresponding clone.
2714      stack || (stack = new Stack);
2715      var stacked = stack.get(value);
2716      if (stacked) {
2717        return stacked;
2718      }
2719      stack.set(value, result);
2720
2721      if (isSet(value)) {
2722        value.forEach(function(subValue) {
2723          result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
2724        });
2725      } else if (isMap(value)) {
2726        value.forEach(function(subValue, key) {
2727          result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
2728        });
2729      }
2730
2731      var keysFunc = isFull
2732        ? (isFlat ? getAllKeysIn : getAllKeys)
2733        : (isFlat ? keysIn : keys);
2734
2735      var props = isArr ? undefined : keysFunc(value);
2736      arrayEach(props || value, function(subValue, key) {
2737        if (props) {
2738          key = subValue;
2739          subValue = value[key];
2740        }
2741        // Recursively populate clone (susceptible to call stack limits).
2742        assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
2743      });
2744      return result;
2745    }
2746
2747    /**
2748     * The base implementation of `_.conforms` which doesn't clone `source`.
2749     *
2750     * @private
2751     * @param {Object} source The object of property predicates to conform to.
2752     * @returns {Function} Returns the new spec function.
2753     */
2754    function baseConforms(source) {
2755      var props = keys(source);
2756      return function(object) {
2757        return baseConformsTo(object, source, props);
2758      };
2759    }
2760
2761    /**
2762     * The base implementation of `_.conformsTo` which accepts `props` to check.
2763     *
2764     * @private
2765     * @param {Object} object The object to inspect.
2766     * @param {Object} source The object of property predicates to conform to.
2767     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
2768     */
2769    function baseConformsTo(object, source, props) {
2770      var length = props.length;
2771      if (object == null) {
2772        return !length;
2773      }
2774      object = Object(object);
2775      while (length--) {
2776        var key = props[length],
2777            predicate = source[key],
2778            value = object[key];
2779
2780        if ((value === undefined && !(key in object)) || !predicate(value)) {
2781          return false;
2782        }
2783      }
2784      return true;
2785    }
2786
2787    /**
2788     * The base implementation of `_.delay` and `_.defer` which accepts `args`
2789     * to provide to `func`.
2790     *
2791     * @private
2792     * @param {Function} func The function to delay.
2793     * @param {number} wait The number of milliseconds to delay invocation.
2794     * @param {Array} args The arguments to provide to `func`.
2795     * @returns {number|Object} Returns the timer id or timeout object.
2796     */
2797    function baseDelay(func, wait, args) {
2798      if (typeof func != 'function') {
2799        throw new TypeError(FUNC_ERROR_TEXT);
2800      }
2801      return setTimeout(function() { func.apply(undefined, args); }, wait);
2802    }
2803
2804    /**
2805     * The base implementation of methods like `_.difference` without support
2806     * for excluding multiple arrays or iteratee shorthands.
2807     *
2808     * @private
2809     * @param {Array} array The array to inspect.
2810     * @param {Array} values The values to exclude.
2811     * @param {Function} [iteratee] The iteratee invoked per element.
2812     * @param {Function} [comparator] The comparator invoked per element.
2813     * @returns {Array} Returns the new array of filtered values.
2814     */
2815    function baseDifference(array, values, iteratee, comparator) {
2816      var index = -1,
2817          includes = arrayIncludes,
2818          isCommon = true,
2819          length = array.length,
2820          result = [],
2821          valuesLength = values.length;
2822
2823      if (!length) {
2824        return result;
2825      }
2826      if (iteratee) {
2827        values = arrayMap(values, baseUnary(iteratee));
2828      }
2829      if (comparator) {
2830        includes = arrayIncludesWith;
2831        isCommon = false;
2832      }
2833      else if (values.length >= LARGE_ARRAY_SIZE) {
2834        includes = cacheHas;
2835        isCommon = false;
2836        values = new SetCache(values);
2837      }
2838      outer:
2839      while (++index < length) {
2840        var value = array[index],
2841            computed = iteratee == null ? value : iteratee(value);
2842
2843        value = (comparator || value !== 0) ? value : 0;
2844        if (isCommon && computed === computed) {
2845          var valuesIndex = valuesLength;
2846          while (valuesIndex--) {
2847            if (values[valuesIndex] === computed) {
2848              continue outer;
2849            }
2850          }
2851          result.push(value);
2852        }
2853        else if (!includes(values, computed, comparator)) {
2854          result.push(value);
2855        }
2856      }
2857      return result;
2858    }
2859
2860    /**
2861     * The base implementation of `_.forEach` without support for iteratee shorthands.
2862     *
2863     * @private
2864     * @param {Array|Object} collection The collection to iterate over.
2865     * @param {Function} iteratee The function invoked per iteration.
2866     * @returns {Array|Object} Returns `collection`.
2867     */
2868    var baseEach = createBaseEach(baseForOwn);
2869
2870    /**
2871     * The base implementation of `_.forEachRight` without support for iteratee shorthands.
2872     *
2873     * @private
2874     * @param {Array|Object} collection The collection to iterate over.
2875     * @param {Function} iteratee The function invoked per iteration.
2876     * @returns {Array|Object} Returns `collection`.
2877     */
2878    var baseEachRight = createBaseEach(baseForOwnRight, true);
2879
2880    /**
2881     * The base implementation of `_.every` without support for iteratee shorthands.
2882     *
2883     * @private
2884     * @param {Array|Object} collection The collection to iterate over.
2885     * @param {Function} predicate The function invoked per iteration.
2886     * @returns {boolean} Returns `true` if all elements pass the predicate check,
2887     *  else `false`
2888     */
2889    function baseEvery(collection, predicate) {
2890      var result = true;
2891      baseEach(collection, function(value, index, collection) {
2892        result = !!predicate(value, index, collection);
2893        return result;
2894      });
2895      return result;
2896    }
2897
2898    /**
2899     * The base implementation of methods like `_.max` and `_.min` which accepts a
2900     * `comparator` to determine the extremum value.
2901     *
2902     * @private
2903     * @param {Array} array The array to iterate over.
2904     * @param {Function} iteratee The iteratee invoked per iteration.
2905     * @param {Function} comparator The comparator used to compare values.
2906     * @returns {*} Returns the extremum value.
2907     */
2908    function baseExtremum(array, iteratee, comparator) {
2909      var index = -1,
2910          length = array.length;
2911
2912      while (++index < length) {
2913        var value = array[index],
2914            current = iteratee(value);
2915
2916        if (current != null && (computed === undefined
2917              ? (current === current && !isSymbol(current))
2918              : comparator(current, computed)
2919            )) {
2920          var computed = current,
2921              result = value;
2922        }
2923      }
2924      return result;
2925    }
2926
2927    /**
2928     * The base implementation of `_.fill` without an iteratee call guard.
2929     *
2930     * @private
2931     * @param {Array} array The array to fill.
2932     * @param {*} value The value to fill `array` with.
2933     * @param {number} [start=0] The start position.
2934     * @param {number} [end=array.length] The end position.
2935     * @returns {Array} Returns `array`.
2936     */
2937    function baseFill(array, value, start, end) {
2938      var length = array.length;
2939
2940      start = toInteger(start);
2941      if (start < 0) {
2942        start = -start > length ? 0 : (length + start);
2943      }
2944      end = (end === undefined || end > length) ? length : toInteger(end);
2945      if (end < 0) {
2946        end += length;
2947      }
2948      end = start > end ? 0 : toLength(end);
2949      while (start < end) {
2950        array[start++] = value;
2951      }
2952      return array;
2953    }
2954
2955    /**
2956     * The base implementation of `_.filter` without support for iteratee shorthands.
2957     *
2958     * @private
2959     * @param {Array|Object} collection The collection to iterate over.
2960     * @param {Function} predicate The function invoked per iteration.
2961     * @returns {Array} Returns the new filtered array.
2962     */
2963    function baseFilter(collection, predicate) {
2964      var result = [];
2965      baseEach(collection, function(value, index, collection) {
2966        if (predicate(value, index, collection)) {
2967          result.push(value);
2968        }
2969      });
2970      return result;
2971    }
2972
2973    /**
2974     * The base implementation of `_.flatten` with support for restricting flattening.
2975     *
2976     * @private
2977     * @param {Array} array The array to flatten.
2978     * @param {number} depth The maximum recursion depth.
2979     * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2980     * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2981     * @param {Array} [result=[]] The initial result value.
2982     * @returns {Array} Returns the new flattened array.
2983     */
2984    function baseFlatten(array, depth, predicate, isStrict, result) {
2985      var index = -1,
2986          length = array.length;
2987
2988      predicate || (predicate = isFlattenable);
2989      result || (result = []);
2990
2991      while (++index < length) {
2992        var value = array[index];
2993        if (depth > 0 && predicate(value)) {
2994          if (depth > 1) {
2995            // Recursively flatten arrays (susceptible to call stack limits).
2996            baseFlatten(value, depth - 1, predicate, isStrict, result);
2997          } else {
2998            arrayPush(result, value);
2999          }
3000        } else if (!isStrict) {
3001          result[result.length] = value;
3002        }
3003      }
3004      return result;
3005    }
3006
3007    /**
3008     * The base implementation of `baseForOwn` which iterates over `object`
3009     * properties returned by `keysFunc` and invokes `iteratee` for each property.
3010     * Iteratee functions may exit iteration early by explicitly returning `false`.
3011     *
3012     * @private
3013     * @param {Object} object The object to iterate over.
3014     * @param {Function} iteratee The function invoked per iteration.
3015     * @param {Function} keysFunc The function to get the keys of `object`.
3016     * @returns {Object} Returns `object`.
3017     */
3018    var baseFor = createBaseFor();
3019
3020    /**
3021     * This function is like `baseFor` except that it iterates over properties
3022     * in the opposite order.
3023     *
3024     * @private
3025     * @param {Object} object The object to iterate over.
3026     * @param {Function} iteratee The function invoked per iteration.
3027     * @param {Function} keysFunc The function to get the keys of `object`.
3028     * @returns {Object} Returns `object`.
3029     */
3030    var baseForRight = createBaseFor(true);
3031
3032    /**
3033     * The base implementation of `_.forOwn` without support for iteratee shorthands.
3034     *
3035     * @private
3036     * @param {Object} object The object to iterate over.
3037     * @param {Function} iteratee The function invoked per iteration.
3038     * @returns {Object} Returns `object`.
3039     */
3040    function baseForOwn(object, iteratee) {
3041      return object && baseFor(object, iteratee, keys);
3042    }
3043
3044    /**
3045     * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
3046     *
3047     * @private
3048     * @param {Object} object The object to iterate over.
3049     * @param {Function} iteratee The function invoked per iteration.
3050     * @returns {Object} Returns `object`.
3051     */
3052    function baseForOwnRight(object, iteratee) {
3053      return object && baseForRight(object, iteratee, keys);
3054    }
3055
3056    /**
3057     * The base implementation of `_.functions` which creates an array of
3058     * `object` function property names filtered from `props`.
3059     *
3060     * @private
3061     * @param {Object} object The object to inspect.
3062     * @param {Array} props The property names to filter.
3063     * @returns {Array} Returns the function names.
3064     */
3065    function baseFunctions(object, props) {
3066      return arrayFilter(props, function(key) {
3067        return isFunction(object[key]);
3068      });
3069    }
3070
3071    /**
3072     * The base implementation of `_.get` without support for default values.
3073     *
3074     * @private
3075     * @param {Object} object The object to query.
3076     * @param {Array|string} path The path of the property to get.
3077     * @returns {*} Returns the resolved value.
3078     */
3079    function baseGet(object, path) {
3080      path = castPath(path, object);
3081
3082      var index = 0,
3083          length = path.length;
3084
3085      while (object != null && index < length) {
3086        object = object[toKey(path[index++])];
3087      }
3088      return (index && index == length) ? object : undefined;
3089    }
3090
3091    /**
3092     * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
3093     * `keysFunc` and `symbolsFunc` to get the enumerable property names and
3094     * symbols of `object`.
3095     *
3096     * @private
3097     * @param {Object} object The object to query.
3098     * @param {Function} keysFunc The function to get the keys of `object`.
3099     * @param {Function} symbolsFunc The function to get the symbols of `object`.
3100     * @returns {Array} Returns the array of property names and symbols.
3101     */
3102    function baseGetAllKeys(object, keysFunc, symbolsFunc) {
3103      var result = keysFunc(object);
3104      return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
3105    }
3106
3107    /**
3108     * The base implementation of `getTag` without fallbacks for buggy environments.
3109     *
3110     * @private
3111     * @param {*} value The value to query.
3112     * @returns {string} Returns the `toStringTag`.
3113     */
3114    function baseGetTag(value) {
3115      if (value == null) {
3116        return value === undefined ? undefinedTag : nullTag;
3117      }
3118      return (symToStringTag && symToStringTag in Object(value))
3119        ? getRawTag(value)
3120        : objectToString(value);
3121    }
3122
3123    /**
3124     * The base implementation of `_.gt` which doesn't coerce arguments.
3125     *
3126     * @private
3127     * @param {*} value The value to compare.
3128     * @param {*} other The other value to compare.
3129     * @returns {boolean} Returns `true` if `value` is greater than `other`,
3130     *  else `false`.
3131     */
3132    function baseGt(value, other) {
3133      return value > other;
3134    }
3135
3136    /**
3137     * The base implementation of `_.has` without support for deep paths.
3138     *
3139     * @private
3140     * @param {Object} [object] The object to query.
3141     * @param {Array|string} key The key to check.
3142     * @returns {boolean} Returns `true` if `key` exists, else `false`.
3143     */
3144    function baseHas(object, key) {
3145      return object != null && hasOwnProperty.call(object, key);
3146    }
3147
3148    /**
3149     * The base implementation of `_.hasIn` without support for deep paths.
3150     *
3151     * @private
3152     * @param {Object} [object] The object to query.
3153     * @param {Array|string} key The key to check.
3154     * @returns {boolean} Returns `true` if `key` exists, else `false`.
3155     */
3156    function baseHasIn(object, key) {
3157      return object != null && key in Object(object);
3158    }
3159
3160    /**
3161     * The base implementation of `_.inRange` which doesn't coerce arguments.
3162     *
3163     * @private
3164     * @param {number} number The number to check.
3165     * @param {number} start The start of the range.
3166     * @param {number} end The end of the range.
3167     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
3168     */
3169    function baseInRange(number, start, end) {
3170      return number >= nativeMin(start, end) && number < nativeMax(start, end);
3171    }
3172
3173    /**
3174     * The base implementation of methods like `_.intersection`, without support
3175     * for iteratee shorthands, that accepts an array of arrays to inspect.
3176     *
3177     * @private
3178     * @param {Array} arrays The arrays to inspect.
3179     * @param {Function} [iteratee] The iteratee invoked per element.
3180     * @param {Function} [comparator] The comparator invoked per element.
3181     * @returns {Array} Returns the new array of shared values.
3182     */
3183    function baseIntersection(arrays, iteratee, comparator) {
3184      var includes = comparator ? arrayIncludesWith : arrayIncludes,
3185          length = arrays[0].length,
3186          othLength = arrays.length,
3187          othIndex = othLength,
3188          caches = Array(othLength),
3189          maxLength = Infinity,
3190          result = [];
3191
3192      while (othIndex--) {
3193        var array = arrays[othIndex];
3194        if (othIndex && iteratee) {
3195          array = arrayMap(array, baseUnary(iteratee));
3196        }
3197        maxLength = nativeMin(array.length, maxLength);
3198        caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
3199          ? new SetCache(othIndex && array)
3200          : undefined;
3201      }
3202      array = arrays[0];
3203
3204      var index = -1,
3205          seen = caches[0];
3206
3207      outer:
3208      while (++index < length && result.length < maxLength) {
3209        var value = array[index],
3210            computed = iteratee ? iteratee(value) : value;
3211
3212        value = (comparator || value !== 0) ? value : 0;
3213        if (!(seen
3214              ? cacheHas(seen, computed)
3215              : includes(result, computed, comparator)
3216            )) {
3217          othIndex = othLength;
3218          while (--othIndex) {
3219            var cache = caches[othIndex];
3220            if (!(cache
3221                  ? cacheHas(cache, computed)
3222                  : includes(arrays[othIndex], computed, comparator))
3223                ) {
3224              continue outer;
3225            }
3226          }
3227          if (seen) {
3228            seen.push(computed);
3229          }
3230          result.push(value);
3231        }
3232      }
3233      return result;
3234    }
3235
3236    /**
3237     * The base implementation of `_.invert` and `_.invertBy` which inverts
3238     * `object` with values transformed by `iteratee` and set by `setter`.
3239     *
3240     * @private
3241     * @param {Object} object The object to iterate over.
3242     * @param {Function} setter The function to set `accumulator` values.
3243     * @param {Function} iteratee The iteratee to transform values.
3244     * @param {Object} accumulator The initial inverted object.
3245     * @returns {Function} Returns `accumulator`.
3246     */
3247    function baseInverter(object, setter, iteratee, accumulator) {
3248      baseForOwn(object, function(value, key, object) {
3249        setter(accumulator, iteratee(value), key, object);
3250      });
3251      return accumulator;
3252    }
3253
3254    /**
3255     * The base implementation of `_.invoke` without support for individual
3256     * method arguments.
3257     *
3258     * @private
3259     * @param {Object} object The object to query.
3260     * @param {Array|string} path The path of the method to invoke.
3261     * @param {Array} args The arguments to invoke the method with.
3262     * @returns {*} Returns the result of the invoked method.
3263     */
3264    function baseInvoke(object, path, args) {
3265      path = castPath(path, object);
3266      object = parent(object, path);
3267      var func = object == null ? object : object[toKey(last(path))];
3268      return func == null ? undefined : apply(func, object, args);
3269    }
3270
3271    /**
3272     * The base implementation of `_.isArguments`.
3273     *
3274     * @private
3275     * @param {*} value The value to check.
3276     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3277     */
3278    function baseIsArguments(value) {
3279      return isObjectLike(value) && baseGetTag(value) == argsTag;
3280    }
3281
3282    /**
3283     * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
3284     *
3285     * @private
3286     * @param {*} value The value to check.
3287     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
3288     */
3289    function baseIsArrayBuffer(value) {
3290      return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
3291    }
3292
3293    /**
3294     * The base implementation of `_.isDate` without Node.js optimizations.
3295     *
3296     * @private
3297     * @param {*} value The value to check.
3298     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
3299     */
3300    function baseIsDate(value) {
3301      return isObjectLike(value) && baseGetTag(value) == dateTag;
3302    }
3303
3304    /**
3305     * The base implementation of `_.isEqual` which supports partial comparisons
3306     * and tracks traversed objects.
3307     *
3308     * @private
3309     * @param {*} value The value to compare.
3310     * @param {*} other The other value to compare.
3311     * @param {boolean} bitmask The bitmask flags.
3312     *  1 - Unordered comparison
3313     *  2 - Partial comparison
3314     * @param {Function} [customizer] The function to customize comparisons.
3315     * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3316     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3317     */
3318    function baseIsEqual(value, other, bitmask, customizer, stack) {
3319      if (value === other) {
3320        return true;
3321      }
3322      if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
3323        return value !== value && other !== other;
3324      }
3325      return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
3326    }
3327
3328    /**
3329     * A specialized version of `baseIsEqual` for arrays and objects which performs
3330     * deep comparisons and tracks traversed objects enabling objects with circular
3331     * references to be compared.
3332     *
3333     * @private
3334     * @param {Object} object The object to compare.
3335     * @param {Object} other The other object to compare.
3336     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3337     * @param {Function} customizer The function to customize comparisons.
3338     * @param {Function} equalFunc The function to determine equivalents of values.
3339     * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3340     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3341     */
3342    function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3343      var objIsArr = isArray(object),
3344          othIsArr = isArray(other),
3345          objTag = objIsArr ? arrayTag : getTag(object),
3346          othTag = othIsArr ? arrayTag : getTag(other);
3347
3348      objTag = objTag == argsTag ? objectTag : objTag;
3349      othTag = othTag == argsTag ? objectTag : othTag;
3350
3351      var objIsObj = objTag == objectTag,
3352          othIsObj = othTag == objectTag,
3353          isSameTag = objTag == othTag;
3354
3355      if (isSameTag && isBuffer(object)) {
3356        if (!isBuffer(other)) {
3357          return false;
3358        }
3359        objIsArr = true;
3360        objIsObj = false;
3361      }
3362      if (isSameTag && !objIsObj) {
3363        stack || (stack = new Stack);
3364        return (objIsArr || isTypedArray(object))
3365          ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3366          : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3367      }
3368      if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
3369        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
3370            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3371
3372        if (objIsWrapped || othIsWrapped) {
3373          var objUnwrapped = objIsWrapped ? object.value() : object,
3374              othUnwrapped = othIsWrapped ? other.value() : other;
3375
3376          stack || (stack = new Stack);
3377          return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3378        }
3379      }
3380      if (!isSameTag) {
3381        return false;
3382      }
3383      stack || (stack = new Stack);
3384      return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3385    }
3386
3387    /**
3388     * The base implementation of `_.isMap` without Node.js optimizations.
3389     *
3390     * @private
3391     * @param {*} value The value to check.
3392     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3393     */
3394    function baseIsMap(value) {
3395      return isObjectLike(value) && getTag(value) == mapTag;
3396    }
3397
3398    /**
3399     * The base implementation of `_.isMatch` without support for iteratee shorthands.
3400     *
3401     * @private
3402     * @param {Object} object The object to inspect.
3403     * @param {Object} source The object of property values to match.
3404     * @param {Array} matchData The property names, values, and compare flags to match.
3405     * @param {Function} [customizer] The function to customize comparisons.
3406     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3407     */
3408    function baseIsMatch(object, source, matchData, customizer) {
3409      var index = matchData.length,
3410          length = index,
3411          noCustomizer = !customizer;
3412
3413      if (object == null) {
3414        return !length;
3415      }
3416      object = Object(object);
3417      while (index--) {
3418        var data = matchData[index];
3419        if ((noCustomizer && data[2])
3420              ? data[1] !== object[data[0]]
3421              : !(data[0] in object)
3422            ) {
3423          return false;
3424        }
3425      }
3426      while (++index < length) {
3427        data = matchData[index];
3428        var key = data[0],
3429            objValue = object[key],
3430            srcValue = data[1];
3431
3432        if (noCustomizer && data[2]) {
3433          if (objValue === undefined && !(key in object)) {
3434            return false;
3435          }
3436        } else {
3437          var stack = new Stack;
3438          if (customizer) {
3439            var result = customizer(objValue, srcValue, key, object, source, stack);
3440          }
3441          if (!(result === undefined
3442                ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
3443                : result
3444              )) {
3445            return false;
3446          }
3447        }
3448      }
3449      return true;
3450    }
3451
3452    /**
3453     * The base implementation of `_.isNative` without bad shim checks.
3454     *
3455     * @private
3456     * @param {*} value The value to check.
3457     * @returns {boolean} Returns `true` if `value` is a native function,
3458     *  else `false`.
3459     */
3460    function baseIsNative(value) {
3461      if (!isObject(value) || isMasked(value)) {
3462        return false;
3463      }
3464      var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
3465      return pattern.test(toSource(value));
3466    }
3467
3468    /**
3469     * The base implementation of `_.isRegExp` without Node.js optimizations.
3470     *
3471     * @private
3472     * @param {*} value The value to check.
3473     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
3474     */
3475    function baseIsRegExp(value) {
3476      return isObjectLike(value) && baseGetTag(value) == regexpTag;
3477    }
3478
3479    /**
3480     * The base implementation of `_.isSet` without Node.js optimizations.
3481     *
3482     * @private
3483     * @param {*} value The value to check.
3484     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3485     */
3486    function baseIsSet(value) {
3487      return isObjectLike(value) && getTag(value) == setTag;
3488    }
3489
3490    /**
3491     * The base implementation of `_.isTypedArray` without Node.js optimizations.
3492     *
3493     * @private
3494     * @param {*} value The value to check.
3495     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
3496     */
3497    function baseIsTypedArray(value) {
3498      return isObjectLike(value) &&
3499        isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
3500    }
3501
3502    /**
3503     * The base implementation of `_.iteratee`.
3504     *
3505     * @private
3506     * @param {*} [value=_.identity] The value to convert to an iteratee.
3507     * @returns {Function} Returns the iteratee.
3508     */
3509    function baseIteratee(value) {
3510      // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3511      // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3512      if (typeof value == 'function') {
3513        return value;
3514      }
3515      if (value == null) {
3516        return identity;
3517      }
3518      if (typeof value == 'object') {
3519        return isArray(value)
3520          ? baseMatchesProperty(value[0], value[1])
3521          : baseMatches(value);
3522      }
3523      return property(value);
3524    }
3525
3526    /**
3527     * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
3528     *
3529     * @private
3530     * @param {Object} object The object to query.
3531     * @returns {Array} Returns the array of property names.
3532     */
3533    function baseKeys(object) {
3534      if (!isPrototype(object)) {
3535        return nativeKeys(object);
3536      }
3537      var result = [];
3538      for (var key in Object(object)) {
3539        if (hasOwnProperty.call(object, key) && key != 'constructor') {
3540          result.push(key);
3541        }
3542      }
3543      return result;
3544    }
3545
3546    /**
3547     * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
3548     *
3549     * @private
3550     * @param {Object} object The object to query.
3551     * @returns {Array} Returns the array of property names.
3552     */
3553    function baseKeysIn(object) {
3554      if (!isObject(object)) {
3555        return nativeKeysIn(object);
3556      }
3557      var isProto = isPrototype(object),
3558          result = [];
3559
3560      for (var key in object) {
3561        if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
3562          result.push(key);
3563        }
3564      }
3565      return result;
3566    }
3567
3568    /**
3569     * The base implementation of `_.lt` which doesn't coerce arguments.
3570     *
3571     * @private
3572     * @param {*} value The value to compare.
3573     * @param {*} other The other value to compare.
3574     * @returns {boolean} Returns `true` if `value` is less than `other`,
3575     *  else `false`.
3576     */
3577    function baseLt(value, other) {
3578      return value < other;
3579    }
3580
3581    /**
3582     * The base implementation of `_.map` without support for iteratee shorthands.
3583     *
3584     * @private
3585     * @param {Array|Object} collection The collection to iterate over.
3586     * @param {Function} iteratee The function invoked per iteration.
3587     * @returns {Array} Returns the new mapped array.
3588     */
3589    function baseMap(collection, iteratee) {
3590      var index = -1,
3591          result = isArrayLike(collection) ? Array(collection.length) : [];
3592
3593      baseEach(collection, function(value, key, collection) {
3594        result[++index] = iteratee(value, key, collection);
3595      });
3596      return result;
3597    }
3598
3599    /**
3600     * The base implementation of `_.matches` which doesn't clone `source`.
3601     *
3602     * @private
3603     * @param {Object} source The object of property values to match.
3604     * @returns {Function} Returns the new spec function.
3605     */
3606    function baseMatches(source) {
3607      var matchData = getMatchData(source);
3608      if (matchData.length == 1 && matchData[0][2]) {
3609        return matchesStrictComparable(matchData[0][0], matchData[0][1]);
3610      }
3611      return function(object) {
3612        return object === source || baseIsMatch(object, source, matchData);
3613      };
3614    }
3615
3616    /**
3617     * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
3618     *
3619     * @private
3620     * @param {string} path The path of the property to get.
3621     * @param {*} srcValue The value to match.
3622     * @returns {Function} Returns the new spec function.
3623     */
3624    function baseMatchesProperty(path, srcValue) {
3625      if (isKey(path) && isStrictComparable(srcValue)) {
3626        return matchesStrictComparable(toKey(path), srcValue);
3627      }
3628      return function(object) {
3629        var objValue = get(object, path);
3630        return (objValue === undefined && objValue === srcValue)
3631          ? hasIn(object, path)
3632          : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
3633      };
3634    }
3635
3636    /**
3637     * The base implementation of `_.merge` without support for multiple sources.
3638     *
3639     * @private
3640     * @param {Object} object The destination object.
3641     * @param {Object} source The source object.
3642     * @param {number} srcIndex The index of `source`.
3643     * @param {Function} [customizer] The function to customize merged values.
3644     * @param {Object} [stack] Tracks traversed source values and their merged
3645     *  counterparts.
3646     */
3647    function baseMerge(object, source, srcIndex, customizer, stack) {
3648      if (object === source) {
3649        return;
3650      }
3651      baseFor(source, function(srcValue, key) {
3652        stack || (stack = new Stack);
3653        if (isObject(srcValue)) {
3654          baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3655        }
3656        else {
3657          var newValue = customizer
3658            ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
3659            : undefined;
3660
3661          if (newValue === undefined) {
3662            newValue = srcValue;
3663          }
3664          assignMergeValue(object, key, newValue);
3665        }
3666      }, keysIn);
3667    }
3668
3669    /**
3670     * A specialized version of `baseMerge` for arrays and objects which performs
3671     * deep merges and tracks traversed objects enabling objects with circular
3672     * references to be merged.
3673     *
3674     * @private
3675     * @param {Object} object The destination object.
3676     * @param {Object} source The source object.
3677     * @param {string} key The key of the value to merge.
3678     * @param {number} srcIndex The index of `source`.
3679     * @param {Function} mergeFunc The function to merge values.
3680     * @param {Function} [customizer] The function to customize assigned values.
3681     * @param {Object} [stack] Tracks traversed source values and their merged
3682     *  counterparts.
3683     */
3684    function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
3685      var objValue = safeGet(object, key),
3686          srcValue = safeGet(source, key),
3687          stacked = stack.get(srcValue);
3688
3689      if (stacked) {
3690        assignMergeValue(object, key, stacked);
3691        return;
3692      }
3693      var newValue = customizer
3694        ? customizer(objValue, srcValue, (key + ''), object, source, stack)
3695        : undefined;
3696
3697      var isCommon = newValue === undefined;
3698
3699      if (isCommon) {
3700        var isArr = isArray(srcValue),
3701            isBuff = !isArr && isBuffer(srcValue),
3702            isTyped = !isArr && !isBuff && isTypedArray(srcValue);
3703
3704        newValue = srcValue;
3705        if (isArr || isBuff || isTyped) {
3706          if (isArray(objValue)) {
3707            newValue = objValue;
3708          }
3709          else if (isArrayLikeObject(objValue)) {
3710            newValue = copyArray(objValue);
3711          }
3712          else if (isBuff) {
3713            isCommon = false;
3714            newValue = cloneBuffer(srcValue, true);
3715          }
3716          else if (isTyped) {
3717            isCommon = false;
3718            newValue = cloneTypedArray(srcValue, true);
3719          }
3720          else {
3721            newValue = [];
3722          }
3723        }
3724        else if (isPlainObject(srcValue) || isArguments(srcValue)) {
3725          newValue = objValue;
3726          if (isArguments(objValue)) {
3727            newValue = toPlainObject(objValue);
3728          }
3729          else if (!isObject(objValue) || isFunction(objValue)) {
3730            newValue = initCloneObject(srcValue);
3731          }
3732        }
3733        else {
3734          isCommon = false;
3735        }
3736      }
3737      if (isCommon) {
3738        // Recursively merge objects and arrays (susceptible to call stack limits).
3739        stack.set(srcValue, newValue);
3740        mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
3741        stack['delete'](srcValue);
3742      }
3743      assignMergeValue(object, key, newValue);
3744    }
3745
3746    /**
3747     * The base implementation of `_.nth` which doesn't coerce arguments.
3748     *
3749     * @private
3750     * @param {Array} array The array to query.
3751     * @param {number} n The index of the element to return.
3752     * @returns {*} Returns the nth element of `array`.
3753     */
3754    function baseNth(array, n) {
3755      var length = array.length;
3756      if (!length) {
3757        return;
3758      }
3759      n += n < 0 ? length : 0;
3760      return isIndex(n, length) ? array[n] : undefined;
3761    }
3762
3763    /**
3764     * The base implementation of `_.orderBy` without param guards.
3765     *
3766     * @private
3767     * @param {Array|Object} collection The collection to iterate over.
3768     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
3769     * @param {string[]} orders The sort orders of `iteratees`.
3770     * @returns {Array} Returns the new sorted array.
3771     */
3772    function baseOrderBy(collection, iteratees, orders) {
3773      if (iteratees.length) {
3774        iteratees = arrayMap(iteratees, function(iteratee) {
3775          if (isArray(iteratee)) {
3776            return function(value) {
3777              return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
3778            }
3779          }
3780          return iteratee;
3781        });
3782      } else {
3783        iteratees = [identity];
3784      }
3785
3786      var index = -1;
3787      iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
3788
3789      var result = baseMap(collection, function(value, key, collection) {
3790        var criteria = arrayMap(iteratees, function(iteratee) {
3791          return iteratee(value);
3792        });
3793        return { 'criteria': criteria, 'index': ++index, 'value': value };
3794      });
3795
3796      return baseSortBy(result, function(object, other) {
3797        return compareMultiple(object, other, orders);
3798      });
3799    }
3800
3801    /**
3802     * The base implementation of `_.pick` without support for individual
3803     * property identifiers.
3804     *
3805     * @private
3806     * @param {Object} object The source object.
3807     * @param {string[]} paths The property paths to pick.
3808     * @returns {Object} Returns the new object.
3809     */
3810    function basePick(object, paths) {
3811      return basePickBy(object, paths, function(value, path) {
3812        return hasIn(object, path);
3813      });
3814    }
3815
3816    /**
3817     * The base implementation of  `_.pickBy` without support for iteratee shorthands.
3818     *
3819     * @private
3820     * @param {Object} object The source object.
3821     * @param {string[]} paths The property paths to pick.
3822     * @param {Function} predicate The function invoked per property.
3823     * @returns {Object} Returns the new object.
3824     */
3825    function basePickBy(object, paths, predicate) {
3826      var index = -1,
3827          length = paths.length,
3828          result = {};
3829
3830      while (++index < length) {
3831        var path = paths[index],
3832            value = baseGet(object, path);
3833
3834        if (predicate(value, path)) {
3835          baseSet(result, castPath(path, object), value);
3836        }
3837      }
3838      return result;
3839    }
3840
3841    /**
3842     * A specialized version of `baseProperty` which supports deep paths.
3843     *
3844     * @private
3845     * @param {Array|string} path The path of the property to get.
3846     * @returns {Function} Returns the new accessor function.
3847     */
3848    function basePropertyDeep(path) {
3849      return function(object) {
3850        return baseGet(object, path);
3851      };
3852    }
3853
3854    /**
3855     * The base implementation of `_.pullAllBy` without support for iteratee
3856     * shorthands.
3857     *
3858     * @private
3859     * @param {Array} array The array to modify.
3860     * @param {Array} values The values to remove.
3861     * @param {Function} [iteratee] The iteratee invoked per element.
3862     * @param {Function} [comparator] The comparator invoked per element.
3863     * @returns {Array} Returns `array`.
3864     */
3865    function basePullAll(array, values, iteratee, comparator) {
3866      var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
3867          index = -1,
3868          length = values.length,
3869          seen = array;
3870
3871      if (array === values) {
3872        values = copyArray(values);
3873      }
3874      if (iteratee) {
3875        seen = arrayMap(array, baseUnary(iteratee));
3876      }
3877      while (++index < length) {
3878        var fromIndex = 0,
3879            value = values[index],
3880            computed = iteratee ? iteratee(value) : value;
3881
3882        while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
3883          if (seen !== array) {
3884            splice.call(seen, fromIndex, 1);
3885          }
3886          splice.call(array, fromIndex, 1);
3887        }
3888      }
3889      return array;
3890    }
3891
3892    /**
3893     * The base implementation of `_.pullAt` without support for individual
3894     * indexes or capturing the removed elements.
3895     *
3896     * @private
3897     * @param {Array} array The array to modify.
3898     * @param {number[]} indexes The indexes of elements to remove.
3899     * @returns {Array} Returns `array`.
3900     */
3901    function basePullAt(array, indexes) {
3902      var length = array ? indexes.length : 0,
3903          lastIndex = length - 1;
3904
3905      while (length--) {
3906        var index = indexes[length];
3907        if (length == lastIndex || index !== previous) {
3908          var previous = index;
3909          if (isIndex(index)) {
3910            splice.call(array, index, 1);
3911          } else {
3912            baseUnset(array, index);
3913          }
3914        }
3915      }
3916      return array;
3917    }
3918
3919    /**
3920     * The base implementation of `_.random` without support for returning
3921     * floating-point numbers.
3922     *
3923     * @private
3924     * @param {number} lower The lower bound.
3925     * @param {number} upper The upper bound.
3926     * @returns {number} Returns the random number.
3927     */
3928    function baseRandom(lower, upper) {
3929      return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
3930    }
3931
3932    /**
3933     * The base implementation of `_.range` and `_.rangeRight` which doesn't
3934     * coerce arguments.
3935     *
3936     * @private
3937     * @param {number} start The start of the range.
3938     * @param {number} end The end of the range.
3939     * @param {number} step The value to increment or decrement by.
3940     * @param {boolean} [fromRight] Specify iterating from right to left.
3941     * @returns {Array} Returns the range of numbers.
3942     */
3943    function baseRange(start, end, step, fromRight) {
3944      var index = -1,
3945          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
3946          result = Array(length);
3947
3948      while (length--) {
3949        result[fromRight ? length : ++index] = start;
3950        start += step;
3951      }
3952      return result;
3953    }
3954
3955    /**
3956     * The base implementation of `_.repeat` which doesn't coerce arguments.
3957     *
3958     * @private
3959     * @param {string} string The string to repeat.
3960     * @param {number} n The number of times to repeat the string.
3961     * @returns {string} Returns the repeated string.
3962     */
3963    function baseRepeat(string, n) {
3964      var result = '';
3965      if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
3966        return result;
3967      }
3968      // Leverage the exponentiation by squaring algorithm for a faster repeat.
3969      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
3970      do {
3971        if (n % 2) {
3972          result += string;
3973        }
3974        n = nativeFloor(n / 2);
3975        if (n) {
3976          string += string;
3977        }
3978      } while (n);
3979
3980      return result;
3981    }
3982
3983    /**
3984     * The base implementation of `_.rest` which doesn't validate or coerce arguments.
3985     *
3986     * @private
3987     * @param {Function} func The function to apply a rest parameter to.
3988     * @param {number} [start=func.length-1] The start position of the rest parameter.
3989     * @returns {Function} Returns the new function.
3990     */
3991    function baseRest(func, start) {
3992      return setToString(overRest(func, start, identity), func + '');
3993    }
3994
3995    /**
3996     * The base implementation of `_.sample`.
3997     *
3998     * @private
3999     * @param {Array|Object} collection The collection to sample.
4000     * @returns {*} Returns the random element.
4001     */
4002    function baseSample(collection) {
4003      return arraySample(values(collection));
4004    }
4005
4006    /**
4007     * The base implementation of `_.sampleSize` without param guards.
4008     *
4009     * @private
4010     * @param {Array|Object} collection The collection to sample.
4011     * @param {number} n The number of elements to sample.
4012     * @returns {Array} Returns the random elements.
4013     */
4014    function baseSampleSize(collection, n) {
4015      var array = values(collection);
4016      return shuffleSelf(array, baseClamp(n, 0, array.length));
4017    }
4018
4019    /**
4020     * The base implementation of `_.set`.
4021     *
4022     * @private
4023     * @param {Object} object The object to modify.
4024     * @param {Array|string} path The path of the property to set.
4025     * @param {*} value The value to set.
4026     * @param {Function} [customizer] The function to customize path creation.
4027     * @returns {Object} Returns `object`.
4028     */
4029    function baseSet(object, path, value, customizer) {
4030      if (!isObject(object)) {
4031        return object;
4032      }
4033      path = castPath(path, object);
4034
4035      var index = -1,
4036          length = path.length,
4037          lastIndex = length - 1,
4038          nested = object;
4039
4040      while (nested != null && ++index < length) {
4041        var key = toKey(path[index]),
4042            newValue = value;
4043
4044        if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
4045          return object;
4046        }
4047
4048        if (index != lastIndex) {
4049          var objValue = nested[key];
4050          newValue = customizer ? customizer(objValue, key, nested) : undefined;
4051          if (newValue === undefined) {
4052            newValue = isObject(objValue)
4053              ? objValue
4054              : (isIndex(path[index + 1]) ? [] : {});
4055          }
4056        }
4057        assignValue(nested, key, newValue);
4058        nested = nested[key];
4059      }
4060      return object;
4061    }
4062
4063    /**
4064     * The base implementation of `setData` without support for hot loop shorting.
4065     *
4066     * @private
4067     * @param {Function} func The function to associate metadata with.
4068     * @param {*} data The metadata.
4069     * @returns {Function} Returns `func`.
4070     */
4071    var baseSetData = !metaMap ? identity : function(func, data) {
4072      metaMap.set(func, data);
4073      return func;
4074    };
4075
4076    /**
4077     * The base implementation of `setToString` without support for hot loop shorting.
4078     *
4079     * @private
4080     * @param {Function} func The function to modify.
4081     * @param {Function} string The `toString` result.
4082     * @returns {Function} Returns `func`.
4083     */
4084    var baseSetToString = !defineProperty ? identity : function(func, string) {
4085      return defineProperty(func, 'toString', {
4086        'configurable': true,
4087        'enumerable': false,
4088        'value': constant(string),
4089        'writable': true
4090      });
4091    };
4092
4093    /**
4094     * The base implementation of `_.shuffle`.
4095     *
4096     * @private
4097     * @param {Array|Object} collection The collection to shuffle.
4098     * @returns {Array} Returns the new shuffled array.
4099     */
4100    function baseShuffle(collection) {
4101      return shuffleSelf(values(collection));
4102    }
4103
4104    /**
4105     * The base implementation of `_.slice` without an iteratee call guard.
4106     *
4107     * @private
4108     * @param {Array} array The array to slice.
4109     * @param {number} [start=0] The start position.
4110     * @param {number} [end=array.length] The end position.
4111     * @returns {Array} Returns the slice of `array`.
4112     */
4113    function baseSlice(array, start, end) {
4114      var index = -1,
4115          length = array.length;
4116
4117      if (start < 0) {
4118        start = -start > length ? 0 : (length + start);
4119      }
4120      end = end > length ? length : end;
4121      if (end < 0) {
4122        end += length;
4123      }
4124      length = start > end ? 0 : ((end - start) >>> 0);
4125      start >>>= 0;
4126
4127      var result = Array(length);
4128      while (++index < length) {
4129        result[index] = array[index + start];
4130      }
4131      return result;
4132    }
4133
4134    /**
4135     * The base implementation of `_.some` without support for iteratee shorthands.
4136     *
4137     * @private
4138     * @param {Array|Object} collection The collection to iterate over.
4139     * @param {Function} predicate The function invoked per iteration.
4140     * @returns {boolean} Returns `true` if any element passes the predicate check,
4141     *  else `false`.
4142     */
4143    function baseSome(collection, predicate) {
4144      var result;
4145
4146      baseEach(collection, function(value, index, collection) {
4147        result = predicate(value, index, collection);
4148        return !result;
4149      });
4150      return !!result;
4151    }
4152
4153    /**
4154     * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
4155     * performs a binary search of `array` to determine the index at which `value`
4156     * should be inserted into `array` in order to maintain its sort order.
4157     *
4158     * @private
4159     * @param {Array} array The sorted array to inspect.
4160     * @param {*} value The value to evaluate.
4161     * @param {boolean} [retHighest] Specify returning the highest qualified index.
4162     * @returns {number} Returns the index at which `value` should be inserted
4163     *  into `array`.
4164     */
4165    function baseSortedIndex(array, value, retHighest) {
4166      var low = 0,
4167          high = array == null ? low : array.length;
4168
4169      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
4170        while (low < high) {
4171          var mid = (low + high) >>> 1,
4172              computed = array[mid];
4173
4174          if (computed !== null && !isSymbol(computed) &&
4175              (retHighest ? (computed <= value) : (computed < value))) {
4176            low = mid + 1;
4177          } else {
4178            high = mid;
4179          }
4180        }
4181        return high;
4182      }
4183      return baseSortedIndexBy(array, value, identity, retHighest);
4184    }
4185
4186    /**
4187     * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
4188     * which invokes `iteratee` for `value` and each element of `array` to compute
4189     * their sort ranking. The iteratee is invoked with one argument; (value).
4190     *
4191     * @private
4192     * @param {Array} array The sorted array to inspect.
4193     * @param {*} value The value to evaluate.
4194     * @param {Function} iteratee The iteratee invoked per element.
4195     * @param {boolean} [retHighest] Specify returning the highest qualified index.
4196     * @returns {number} Returns the index at which `value` should be inserted
4197     *  into `array`.
4198     */
4199    function baseSortedIndexBy(array, value, iteratee, retHighest) {
4200      var low = 0,
4201          high = array == null ? 0 : array.length;
4202      if (high === 0) {
4203        return 0;
4204      }
4205
4206      value = iteratee(value);
4207      var valIsNaN = value !== value,
4208          valIsNull = value === null,
4209          valIsSymbol = isSymbol(value),
4210          valIsUndefined = value === undefined;
4211
4212      while (low < high) {
4213        var mid = nativeFloor((low + high) / 2),
4214            computed = iteratee(array[mid]),
4215            othIsDefined = computed !== undefined,
4216            othIsNull = computed === null,
4217            othIsReflexive = computed === computed,
4218            othIsSymbol = isSymbol(computed);
4219
4220        if (valIsNaN) {
4221          var setLow = retHighest || othIsReflexive;
4222        } else if (valIsUndefined) {
4223          setLow = othIsReflexive && (retHighest || othIsDefined);
4224        } else if (valIsNull) {
4225          setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
4226        } else if (valIsSymbol) {
4227          setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
4228        } else if (othIsNull || othIsSymbol) {
4229          setLow = false;
4230        } else {
4231          setLow = retHighest ? (computed <= value) : (computed < value);
4232        }
4233        if (setLow) {
4234          low = mid + 1;
4235        } else {
4236          high = mid;
4237        }
4238      }
4239      return nativeMin(high, MAX_ARRAY_INDEX);
4240    }
4241
4242    /**
4243     * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
4244     * support for iteratee shorthands.
4245     *
4246     * @private
4247     * @param {Array} array The array to inspect.
4248     * @param {Function} [iteratee] The iteratee invoked per element.
4249     * @returns {Array} Returns the new duplicate free array.
4250     */
4251    function baseSortedUniq(array, iteratee) {
4252      var index = -1,
4253          length = array.length,
4254          resIndex = 0,
4255          result = [];
4256
4257      while (++index < length) {
4258        var value = array[index],
4259            computed = iteratee ? iteratee(value) : value;
4260
4261        if (!index || !eq(computed, seen)) {
4262          var seen = computed;
4263          result[resIndex++] = value === 0 ? 0 : value;
4264        }
4265      }
4266      return result;
4267    }
4268
4269    /**
4270     * The base implementation of `_.toNumber` which doesn't ensure correct
4271     * conversions of binary, hexadecimal, or octal string values.
4272     *
4273     * @private
4274     * @param {*} value The value to process.
4275     * @returns {number} Returns the number.
4276     */
4277    function baseToNumber(value) {
4278      if (typeof value == 'number') {
4279        return value;
4280      }
4281      if (isSymbol(value)) {
4282        return NAN;
4283      }
4284      return +value;
4285    }
4286
4287    /**
4288     * The base implementation of `_.toString` which doesn't convert nullish
4289     * values to empty strings.
4290     *
4291     * @private
4292     * @param {*} value The value to process.
4293     * @returns {string} Returns the string.
4294     */
4295    function baseToString(value) {
4296      // Exit early for strings to avoid a performance hit in some environments.
4297      if (typeof value == 'string') {
4298        return value;
4299      }
4300      if (isArray(value)) {
4301        // Recursively convert values (susceptible to call stack limits).
4302        return arrayMap(value, baseToString) + '';
4303      }
4304      if (isSymbol(value)) {
4305        return symbolToString ? symbolToString.call(value) : '';
4306      }
4307      var result = (value + '');
4308      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
4309    }
4310
4311    /**
4312     * The base implementation of `_.uniqBy` without support for iteratee shorthands.
4313     *
4314     * @private
4315     * @param {Array} array The array to inspect.
4316     * @param {Function} [iteratee] The iteratee invoked per element.
4317     * @param {Function} [comparator] The comparator invoked per element.
4318     * @returns {Array} Returns the new duplicate free array.
4319     */
4320    function baseUniq(array, iteratee, comparator) {
4321      var index = -1,
4322          includes = arrayIncludes,
4323          length = array.length,
4324          isCommon = true,
4325          result = [],
4326          seen = result;
4327
4328      if (comparator) {
4329        isCommon = false;
4330        includes = arrayIncludesWith;
4331      }
4332      else if (length >= LARGE_ARRAY_SIZE) {
4333        var set = iteratee ? null : createSet(array);
4334        if (set) {
4335          return setToArray(set);
4336        }
4337        isCommon = false;
4338        includes = cacheHas;
4339        seen = new SetCache;
4340      }
4341      else {
4342        seen = iteratee ? [] : result;
4343      }
4344      outer:
4345      while (++index < length) {
4346        var value = array[index],
4347            computed = iteratee ? iteratee(value) : value;
4348
4349        value = (comparator || value !== 0) ? value : 0;
4350        if (isCommon && computed === computed) {
4351          var seenIndex = seen.length;
4352          while (seenIndex--) {
4353            if (seen[seenIndex] === computed) {
4354              continue outer;
4355            }
4356          }
4357          if (iteratee) {
4358            seen.push(computed);
4359          }
4360          result.push(value);
4361        }
4362        else if (!includes(seen, computed, comparator)) {
4363          if (seen !== result) {
4364            seen.push(computed);
4365          }
4366          result.push(value);
4367        }
4368      }
4369      return result;
4370    }
4371
4372    /**
4373     * The base implementation of `_.unset`.
4374     *
4375     * @private
4376     * @param {Object} object The object to modify.
4377     * @param {Array|string} path The property path to unset.
4378     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
4379     */
4380    function baseUnset(object, path) {
4381      path = castPath(path, object);
4382      object = parent(object, path);
4383      return object == null || delete object[toKey(last(path))];
4384    }
4385
4386    /**
4387     * The base implementation of `_.update`.
4388     *
4389     * @private
4390     * @param {Object} object The object to modify.
4391     * @param {Array|string} path The path of the property to update.
4392     * @param {Function} updater The function to produce the updated value.
4393     * @param {Function} [customizer] The function to customize path creation.
4394     * @returns {Object} Returns `object`.
4395     */
4396    function baseUpdate(object, path, updater, customizer) {
4397      return baseSet(object, path, updater(baseGet(object, path)), customizer);
4398    }
4399
4400    /**
4401     * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
4402     * without support for iteratee shorthands.
4403     *
4404     * @private
4405     * @param {Array} array The array to query.
4406     * @param {Function} predicate The function invoked per iteration.
4407     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
4408     * @param {boolean} [fromRight] Specify iterating from right to left.
4409     * @returns {Array} Returns the slice of `array`.
4410     */
4411    function baseWhile(array, predicate, isDrop, fromRight) {
4412      var length = array.length,
4413          index = fromRight ? length : -1;
4414
4415      while ((fromRight ? index-- : ++index < length) &&
4416        predicate(array[index], index, array)) {}
4417
4418      return isDrop
4419        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
4420        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
4421    }
4422
4423    /**
4424     * The base implementation of `wrapperValue` which returns the result of
4425     * performing a sequence of actions on the unwrapped `value`, where each
4426     * successive action is supplied the return value of the previous.
4427     *
4428     * @private
4429     * @param {*} value The unwrapped value.
4430     * @param {Array} actions Actions to perform to resolve the unwrapped value.
4431     * @returns {*} Returns the resolved value.
4432     */
4433    function baseWrapperValue(value, actions) {
4434      var result = value;
4435      if (result instanceof LazyWrapper) {
4436        result = result.value();
4437      }
4438      return arrayReduce(actions, function(result, action) {
4439        return action.func.apply(action.thisArg, arrayPush([result], action.args));
4440      }, result);
4441    }
4442
4443    /**
4444     * The base implementation of methods like `_.xor`, without support for
4445     * iteratee shorthands, that accepts an array of arrays to inspect.
4446     *
4447     * @private
4448     * @param {Array} arrays The arrays to inspect.
4449     * @param {Function} [iteratee] The iteratee invoked per element.
4450     * @param {Function} [comparator] The comparator invoked per element.
4451     * @returns {Array} Returns the new array of values.
4452     */
4453    function baseXor(arrays, iteratee, comparator) {
4454      var length = arrays.length;
4455      if (length < 2) {
4456        return length ? baseUniq(arrays[0]) : [];
4457      }
4458      var index = -1,
4459          result = Array(length);
4460
4461      while (++index < length) {
4462        var array = arrays[index],
4463            othIndex = -1;
4464
4465        while (++othIndex < length) {
4466          if (othIndex != index) {
4467            result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
4468          }
4469        }
4470      }
4471      return baseUniq(baseFlatten(result, 1), iteratee, comparator);
4472    }
4473
4474    /**
4475     * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
4476     *
4477     * @private
4478     * @param {Array} props The property identifiers.
4479     * @param {Array} values The property values.
4480     * @param {Function} assignFunc The function to assign values.
4481     * @returns {Object} Returns the new object.
4482     */
4483    function baseZipObject(props, values, assignFunc) {
4484      var index = -1,
4485          length = props.length,
4486          valsLength = values.length,
4487          result = {};
4488
4489      while (++index < length) {
4490        var value = index < valsLength ? values[index] : undefined;
4491        assignFunc(result, props[index], value);
4492      }
4493      return result;
4494    }
4495
4496    /**
4497     * Casts `value` to an empty array if it's not an array like object.
4498     *
4499     * @private
4500     * @param {*} value The value to inspect.
4501     * @returns {Array|Object} Returns the cast array-like object.
4502     */
4503    function castArrayLikeObject(value) {
4504      return isArrayLikeObject(value) ? value : [];
4505    }
4506
4507    /**
4508     * Casts `value` to `identity` if it's not a function.
4509     *
4510     * @private
4511     * @param {*} value The value to inspect.
4512     * @returns {Function} Returns cast function.
4513     */
4514    function castFunction(value) {
4515      return typeof value == 'function' ? value : identity;
4516    }
4517
4518    /**
4519     * Casts `value` to a path array if it's not one.
4520     *
4521     * @private
4522     * @param {*} value The value to inspect.
4523     * @param {Object} [object] The object to query keys on.
4524     * @returns {Array} Returns the cast property path array.
4525     */
4526    function castPath(value, object) {
4527      if (isArray(value)) {
4528        return value;
4529      }
4530      return isKey(value, object) ? [value] : stringToPath(toString(value));
4531    }
4532
4533    /**
4534     * A `baseRest` alias which can be replaced with `identity` by module
4535     * replacement plugins.
4536     *
4537     * @private
4538     * @type {Function}
4539     * @param {Function} func The function to apply a rest parameter to.
4540     * @returns {Function} Returns the new function.
4541     */
4542    var castRest = baseRest;
4543
4544    /**
4545     * Casts `array` to a slice if it's needed.
4546     *
4547     * @private
4548     * @param {Array} array The array to inspect.
4549     * @param {number} start The start position.
4550     * @param {number} [end=array.length] The end position.
4551     * @returns {Array} Returns the cast slice.
4552     */
4553    function castSlice(array, start, end) {
4554      var length = array.length;
4555      end = end === undefined ? length : end;
4556      return (!start && end >= length) ? array : baseSlice(array, start, end);
4557    }
4558
4559    /**
4560     * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
4561     *
4562     * @private
4563     * @param {number|Object} id The timer id or timeout object of the timer to clear.
4564     */
4565    var clearTimeout = ctxClearTimeout || function(id) {
4566      return root.clearTimeout(id);
4567    };
4568
4569    /**
4570     * Creates a clone of  `buffer`.
4571     *
4572     * @private
4573     * @param {Buffer} buffer The buffer to clone.
4574     * @param {boolean} [isDeep] Specify a deep clone.
4575     * @returns {Buffer} Returns the cloned buffer.
4576     */
4577    function cloneBuffer(buffer, isDeep) {
4578      if (isDeep) {
4579        return buffer.slice();
4580      }
4581      var length = buffer.length,
4582          result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
4583
4584      buffer.copy(result);
4585      return result;
4586    }
4587
4588    /**
4589     * Creates a clone of `arrayBuffer`.
4590     *
4591     * @private
4592     * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
4593     * @returns {ArrayBuffer} Returns the cloned array buffer.
4594     */
4595    function cloneArrayBuffer(arrayBuffer) {
4596      var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
4597      new Uint8Array(result).set(new Uint8Array(arrayBuffer));
4598      return result;
4599    }
4600
4601    /**
4602     * Creates a clone of `dataView`.
4603     *
4604     * @private
4605     * @param {Object} dataView The data view to clone.
4606     * @param {boolean} [isDeep] Specify a deep clone.
4607     * @returns {Object} Returns the cloned data view.
4608     */
4609    function cloneDataView(dataView, isDeep) {
4610      var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
4611      return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
4612    }
4613
4614    /**
4615     * Creates a clone of `regexp`.
4616     *
4617     * @private
4618     * @param {Object} regexp The regexp to clone.
4619     * @returns {Object} Returns the cloned regexp.
4620     */
4621    function cloneRegExp(regexp) {
4622      var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
4623      result.lastIndex = regexp.lastIndex;
4624      return result;
4625    }
4626
4627    /**
4628     * Creates a clone of the `symbol` object.
4629     *
4630     * @private
4631     * @param {Object} symbol The symbol object to clone.
4632     * @returns {Object} Returns the cloned symbol object.
4633     */
4634    function cloneSymbol(symbol) {
4635      return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
4636    }
4637
4638    /**
4639     * Creates a clone of `typedArray`.
4640     *
4641     * @private
4642     * @param {Object} typedArray The typed array to clone.
4643     * @param {boolean} [isDeep] Specify a deep clone.
4644     * @returns {Object} Returns the cloned typed array.
4645     */
4646    function cloneTypedArray(typedArray, isDeep) {
4647      var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
4648      return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
4649    }
4650
4651    /**
4652     * Compares values to sort them in ascending order.
4653     *
4654     * @private
4655     * @param {*} value The value to compare.
4656     * @param {*} other The other value to compare.
4657     * @returns {number} Returns the sort order indicator for `value`.
4658     */
4659    function compareAscending(value, other) {
4660      if (value !== other) {
4661        var valIsDefined = value !== undefined,
4662            valIsNull = value === null,
4663            valIsReflexive = value === value,
4664            valIsSymbol = isSymbol(value);
4665
4666        var othIsDefined = other !== undefined,
4667            othIsNull = other === null,
4668            othIsReflexive = other === other,
4669            othIsSymbol = isSymbol(other);
4670
4671        if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
4672            (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
4673            (valIsNull && othIsDefined && othIsReflexive) ||
4674            (!valIsDefined && othIsReflexive) ||
4675            !valIsReflexive) {
4676          return 1;
4677        }
4678        if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
4679            (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
4680            (othIsNull && valIsDefined && valIsReflexive) ||
4681            (!othIsDefined && valIsReflexive) ||
4682            !othIsReflexive) {
4683          return -1;
4684        }
4685      }
4686      return 0;
4687    }
4688
4689    /**
4690     * Used by `_.orderBy` to compare multiple properties of a value to another
4691     * and stable sort them.
4692     *
4693     * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
4694     * specify an order of "desc" for descending or "asc" for ascending sort order
4695     * of corresponding values.
4696     *
4697     * @private
4698     * @param {Object} object The object to compare.
4699     * @param {Object} other The other object to compare.
4700     * @param {boolean[]|string[]} orders The order to sort by for each property.
4701     * @returns {number} Returns the sort order indicator for `object`.
4702     */
4703    function compareMultiple(object, other, orders) {
4704      var index = -1,
4705          objCriteria = object.criteria,
4706          othCriteria = other.criteria,
4707          length = objCriteria.length,
4708          ordersLength = orders.length;
4709
4710      while (++index < length) {
4711        var result = compareAscending(objCriteria[index], othCriteria[index]);
4712        if (result) {
4713          if (index >= ordersLength) {
4714            return result;
4715          }
4716          var order = orders[index];
4717          return result * (order == 'desc' ? -1 : 1);
4718        }
4719      }
4720      // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
4721      // that causes it, under certain circumstances, to provide the same value for
4722      // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
4723      // for more details.
4724      //
4725      // This also ensures a stable sort in V8 and other engines.
4726      // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
4727      return object.index - other.index;
4728    }
4729
4730    /**
4731     * Creates an array that is the composition of partially applied arguments,
4732     * placeholders, and provided arguments into a single array of arguments.
4733     *
4734     * @private
4735     * @param {Array} args The provided arguments.
4736     * @param {Array} partials The arguments to prepend to those provided.
4737     * @param {Array} holders The `partials` placeholder indexes.
4738     * @params {boolean} [isCurried] Specify composing for a curried function.
4739     * @returns {Array} Returns the new array of composed arguments.
4740     */
4741    function composeArgs(args, partials, holders, isCurried) {
4742      var argsIndex = -1,
4743          argsLength = args.length,
4744          holdersLength = holders.length,
4745          leftIndex = -1,
4746          leftLength = partials.length,
4747          rangeLength = nativeMax(argsLength - holdersLength, 0),
4748          result = Array(leftLength + rangeLength),
4749          isUncurried = !isCurried;
4750
4751      while (++leftIndex < leftLength) {
4752        result[leftIndex] = partials[leftIndex];
4753      }
4754      while (++argsIndex < holdersLength) {
4755        if (isUncurried || argsIndex < argsLength) {
4756          result[holders[argsIndex]] = args[argsIndex];
4757        }
4758      }
4759      while (rangeLength--) {
4760        result[leftIndex++] = args[argsIndex++];
4761      }
4762      return result;
4763    }
4764
4765    /**
4766     * This function is like `composeArgs` except that the arguments composition
4767     * is tailored for `_.partialRight`.
4768     *
4769     * @private
4770     * @param {Array} args The provided arguments.
4771     * @param {Array} partials The arguments to append to those provided.
4772     * @param {Array} holders The `partials` placeholder indexes.
4773     * @params {boolean} [isCurried] Specify composing for a curried function.
4774     * @returns {Array} Returns the new array of composed arguments.
4775     */
4776    function composeArgsRight(args, partials, holders, isCurried) {
4777      var argsIndex = -1,
4778          argsLength = args.length,
4779          holdersIndex = -1,
4780          holdersLength = holders.length,
4781          rightIndex = -1,
4782          rightLength = partials.length,
4783          rangeLength = nativeMax(argsLength - holdersLength, 0),
4784          result = Array(rangeLength + rightLength),
4785          isUncurried = !isCurried;
4786
4787      while (++argsIndex < rangeLength) {
4788        result[argsIndex] = args[argsIndex];
4789      }
4790      var offset = argsIndex;
4791      while (++rightIndex < rightLength) {
4792        result[offset + rightIndex] = partials[rightIndex];
4793      }
4794      while (++holdersIndex < holdersLength) {
4795        if (isUncurried || argsIndex < argsLength) {
4796          result[offset + holders[holdersIndex]] = args[argsIndex++];
4797        }
4798      }
4799      return result;
4800    }
4801
4802    /**
4803     * Copies the values of `source` to `array`.
4804     *
4805     * @private
4806     * @param {Array} source The array to copy values from.
4807     * @param {Array} [array=[]] The array to copy values to.
4808     * @returns {Array} Returns `array`.
4809     */
4810    function copyArray(source, array) {
4811      var index = -1,
4812          length = source.length;
4813
4814      array || (array = Array(length));
4815      while (++index < length) {
4816        array[index] = source[index];
4817      }
4818      return array;
4819    }
4820
4821    /**
4822     * Copies properties of `source` to `object`.
4823     *
4824     * @private
4825     * @param {Object} source The object to copy properties from.
4826     * @param {Array} props The property identifiers to copy.
4827     * @param {Object} [object={}] The object to copy properties to.
4828     * @param {Function} [customizer] The function to customize copied values.
4829     * @returns {Object} Returns `object`.
4830     */
4831    function copyObject(source, props, object, customizer) {
4832      var isNew = !object;
4833      object || (object = {});
4834
4835      var index = -1,
4836          length = props.length;
4837
4838      while (++index < length) {
4839        var key = props[index];
4840
4841        var newValue = customizer
4842          ? customizer(object[key], source[key], key, object, source)
4843          : undefined;
4844
4845        if (newValue === undefined) {
4846          newValue = source[key];
4847        }
4848        if (isNew) {
4849          baseAssignValue(object, key, newValue);
4850        } else {
4851          assignValue(object, key, newValue);
4852        }
4853      }
4854      return object;
4855    }
4856
4857    /**
4858     * Copies own symbols of `source` to `object`.
4859     *
4860     * @private
4861     * @param {Object} source The object to copy symbols from.
4862     * @param {Object} [object={}] The object to copy symbols to.
4863     * @returns {Object} Returns `object`.
4864     */
4865    function copySymbols(source, object) {
4866      return copyObject(source, getSymbols(source), object);
4867    }
4868
4869    /**
4870     * Copies own and inherited symbols of `source` to `object`.
4871     *
4872     * @private
4873     * @param {Object} source The object to copy symbols from.
4874     * @param {Object} [object={}] The object to copy symbols to.
4875     * @returns {Object} Returns `object`.
4876     */
4877    function copySymbolsIn(source, object) {
4878      return copyObject(source, getSymbolsIn(source), object);
4879    }
4880
4881    /**
4882     * Creates a function like `_.groupBy`.
4883     *
4884     * @private
4885     * @param {Function} setter The function to set accumulator values.
4886     * @param {Function} [initializer] The accumulator object initializer.
4887     * @returns {Function} Returns the new aggregator function.
4888     */
4889    function createAggregator(setter, initializer) {
4890      return function(collection, iteratee) {
4891        var func = isArray(collection) ? arrayAggregator : baseAggregator,
4892            accumulator = initializer ? initializer() : {};
4893
4894        return func(collection, setter, getIteratee(iteratee, 2), accumulator);
4895      };
4896    }
4897
4898    /**
4899     * Creates a function like `_.assign`.
4900     *
4901     * @private
4902     * @param {Function} assigner The function to assign values.
4903     * @returns {Function} Returns the new assigner function.
4904     */
4905    function createAssigner(assigner) {
4906      return baseRest(function(object, sources) {
4907        var index = -1,
4908            length = sources.length,
4909            customizer = length > 1 ? sources[length - 1] : undefined,
4910            guard = length > 2 ? sources[2] : undefined;
4911
4912        customizer = (assigner.length > 3 && typeof customizer == 'function')
4913          ? (length--, customizer)
4914          : undefined;
4915
4916        if (guard && isIterateeCall(sources[0], sources[1], guard)) {
4917          customizer = length < 3 ? undefined : customizer;
4918          length = 1;
4919        }
4920        object = Object(object);
4921        while (++index < length) {
4922          var source = sources[index];
4923          if (source) {
4924            assigner(object, source, index, customizer);
4925          }
4926        }
4927        return object;
4928      });
4929    }
4930
4931    /**
4932     * Creates a `baseEach` or `baseEachRight` function.
4933     *
4934     * @private
4935     * @param {Function} eachFunc The function to iterate over a collection.
4936     * @param {boolean} [fromRight] Specify iterating from right to left.
4937     * @returns {Function} Returns the new base function.
4938     */
4939    function createBaseEach(eachFunc, fromRight) {
4940      return function(collection, iteratee) {
4941        if (collection == null) {
4942          return collection;
4943        }
4944        if (!isArrayLike(collection)) {
4945          return eachFunc(collection, iteratee);
4946        }
4947        var length = collection.length,
4948            index = fromRight ? length : -1,
4949            iterable = Object(collection);
4950
4951        while ((fromRight ? index-- : ++index < length)) {
4952          if (iteratee(iterable[index], index, iterable) === false) {
4953            break;
4954          }
4955        }
4956        return collection;
4957      };
4958    }
4959
4960    /**
4961     * Creates a base function for methods like `_.forIn` and `_.forOwn`.
4962     *
4963     * @private
4964     * @param {boolean} [fromRight] Specify iterating from right to left.
4965     * @returns {Function} Returns the new base function.
4966     */
4967    function createBaseFor(fromRight) {
4968      return function(object, iteratee, keysFunc) {
4969        var index = -1,
4970            iterable = Object(object),
4971            props = keysFunc(object),
4972            length = props.length;
4973
4974        while (length--) {
4975          var key = props[fromRight ? length : ++index];
4976          if (iteratee(iterable[key], key, iterable) === false) {
4977            break;
4978          }
4979        }
4980        return object;
4981      };
4982    }
4983
4984    /**
4985     * Creates a function that wraps `func` to invoke it with the optional `this`
4986     * binding of `thisArg`.
4987     *
4988     * @private
4989     * @param {Function} func The function to wrap.
4990     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
4991     * @param {*} [thisArg] The `this` binding of `func`.
4992     * @returns {Function} Returns the new wrapped function.
4993     */
4994    function createBind(func, bitmask, thisArg) {
4995      var isBind = bitmask & WRAP_BIND_FLAG,
4996          Ctor = createCtor(func);
4997
4998      function wrapper() {
4999        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5000        return fn.apply(isBind ? thisArg : this, arguments);
5001      }
5002      return wrapper;
5003    }
5004
5005    /**
5006     * Creates a function like `_.lowerFirst`.
5007     *
5008     * @private
5009     * @param {string} methodName The name of the `String` case method to use.
5010     * @returns {Function} Returns the new case function.
5011     */
5012    function createCaseFirst(methodName) {
5013      return function(string) {
5014        string = toString(string);
5015
5016        var strSymbols = hasUnicode(string)
5017          ? stringToArray(string)
5018          : undefined;
5019
5020        var chr = strSymbols
5021          ? strSymbols[0]
5022          : string.charAt(0);
5023
5024        var trailing = strSymbols
5025          ? castSlice(strSymbols, 1).join('')
5026          : string.slice(1);
5027
5028        return chr[methodName]() + trailing;
5029      };
5030    }
5031
5032    /**
5033     * Creates a function like `_.camelCase`.
5034     *
5035     * @private
5036     * @param {Function} callback The function to combine each word.
5037     * @returns {Function} Returns the new compounder function.
5038     */
5039    function createCompounder(callback) {
5040      return function(string) {
5041        return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
5042      };
5043    }
5044
5045    /**
5046     * Creates a function that produces an instance of `Ctor` regardless of
5047     * whether it was invoked as part of a `new` expression or by `call` or `apply`.
5048     *
5049     * @private
5050     * @param {Function} Ctor The constructor to wrap.
5051     * @returns {Function} Returns the new wrapped function.
5052     */
5053    function createCtor(Ctor) {
5054      return function() {
5055        // Use a `switch` statement to work with class constructors. See
5056        // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
5057        // for more details.
5058        var args = arguments;
5059        switch (args.length) {
5060          case 0: return new Ctor;
5061          case 1: return new Ctor(args[0]);
5062          case 2: return new Ctor(args[0], args[1]);
5063          case 3: return new Ctor(args[0], args[1], args[2]);
5064          case 4: return new Ctor(args[0], args[1], args[2], args[3]);
5065          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
5066          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
5067          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
5068        }
5069        var thisBinding = baseCreate(Ctor.prototype),
5070            result = Ctor.apply(thisBinding, args);
5071
5072        // Mimic the constructor's `return` behavior.
5073        // See https://es5.github.io/#x13.2.2 for more details.
5074        return isObject(result) ? result : thisBinding;
5075      };
5076    }
5077
5078    /**
5079     * Creates a function that wraps `func` to enable currying.
5080     *
5081     * @private
5082     * @param {Function} func The function to wrap.
5083     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5084     * @param {number} arity The arity of `func`.
5085     * @returns {Function} Returns the new wrapped function.
5086     */
5087    function createCurry(func, bitmask, arity) {
5088      var Ctor = createCtor(func);
5089
5090      function wrapper() {
5091        var length = arguments.length,
5092            args = Array(length),
5093            index = length,
5094            placeholder = getHolder(wrapper);
5095
5096        while (index--) {
5097          args[index] = arguments[index];
5098        }
5099        var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
5100          ? []
5101          : replaceHolders(args, placeholder);
5102
5103        length -= holders.length;
5104        if (length < arity) {
5105          return createRecurry(
5106            func, bitmask, createHybrid, wrapper.placeholder, undefined,
5107            args, holders, undefined, undefined, arity - length);
5108        }
5109        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5110        return apply(fn, this, args);
5111      }
5112      return wrapper;
5113    }
5114
5115    /**
5116     * Creates a `_.find` or `_.findLast` function.
5117     *
5118     * @private
5119     * @param {Function} findIndexFunc The function to find the collection index.
5120     * @returns {Function} Returns the new find function.
5121     */
5122    function createFind(findIndexFunc) {
5123      return function(collection, predicate, fromIndex) {
5124        var iterable = Object(collection);
5125        if (!isArrayLike(collection)) {
5126          var iteratee = getIteratee(predicate, 3);
5127          collection = keys(collection);
5128          predicate = function(key) { return iteratee(iterable[key], key, iterable); };
5129        }
5130        var index = findIndexFunc(collection, predicate, fromIndex);
5131        return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
5132      };
5133    }
5134
5135    /**
5136     * Creates a `_.flow` or `_.flowRight` function.
5137     *
5138     * @private
5139     * @param {boolean} [fromRight] Specify iterating from right to left.
5140     * @returns {Function} Returns the new flow function.
5141     */
5142    function createFlow(fromRight) {
5143      return flatRest(function(funcs) {
5144        var length = funcs.length,
5145            index = length,
5146            prereq = LodashWrapper.prototype.thru;
5147
5148        if (fromRight) {
5149          funcs.reverse();
5150        }
5151        while (index--) {
5152          var func = funcs[index];
5153          if (typeof func != 'function') {
5154            throw new TypeError(FUNC_ERROR_TEXT);
5155          }
5156          if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
5157            var wrapper = new LodashWrapper([], true);
5158          }
5159        }
5160        index = wrapper ? index : length;
5161        while (++index < length) {
5162          func = funcs[index];
5163
5164          var funcName = getFuncName(func),
5165              data = funcName == 'wrapper' ? getData(func) : undefined;
5166
5167          if (data && isLaziable(data[0]) &&
5168                data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
5169                !data[4].length && data[9] == 1
5170              ) {
5171            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
5172          } else {
5173            wrapper = (func.length == 1 && isLaziable(func))
5174              ? wrapper[funcName]()
5175              : wrapper.thru(func);
5176          }
5177        }
5178        return function() {
5179          var args = arguments,
5180              value = args[0];
5181
5182          if (wrapper && args.length == 1 && isArray(value)) {
5183            return wrapper.plant(value).value();
5184          }
5185          var index = 0,
5186              result = length ? funcs[index].apply(this, args) : value;
5187
5188          while (++index < length) {
5189            result = funcs[index].call(this, result);
5190          }
5191          return result;
5192        };
5193      });
5194    }
5195
5196    /**
5197     * Creates a function that wraps `func` to invoke it with optional `this`
5198     * binding of `thisArg`, partial application, and currying.
5199     *
5200     * @private
5201     * @param {Function|string} func The function or method name to wrap.
5202     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5203     * @param {*} [thisArg] The `this` binding of `func`.
5204     * @param {Array} [partials] The arguments to prepend to those provided to
5205     *  the new function.
5206     * @param {Array} [holders] The `partials` placeholder indexes.
5207     * @param {Array} [partialsRight] The arguments to append to those provided
5208     *  to the new function.
5209     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
5210     * @param {Array} [argPos] The argument positions of the new function.
5211     * @param {number} [ary] The arity cap of `func`.
5212     * @param {number} [arity] The arity of `func`.
5213     * @returns {Function} Returns the new wrapped function.
5214     */
5215    function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
5216      var isAry = bitmask & WRAP_ARY_FLAG,
5217          isBind = bitmask & WRAP_BIND_FLAG,
5218          isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
5219          isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
5220          isFlip = bitmask & WRAP_FLIP_FLAG,
5221          Ctor = isBindKey ? undefined : createCtor(func);
5222
5223      function wrapper() {
5224        var length = arguments.length,
5225            args = Array(length),
5226            index = length;
5227
5228        while (index--) {
5229          args[index] = arguments[index];
5230        }
5231        if (isCurried) {
5232          var placeholder = getHolder(wrapper),
5233              holdersCount = countHolders(args, placeholder);
5234        }
5235        if (partials) {
5236          args = composeArgs(args, partials, holders, isCurried);
5237        }
5238        if (partialsRight) {
5239          args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
5240        }
5241        length -= holdersCount;
5242        if (isCurried && length < arity) {
5243          var newHolders = replaceHolders(args, placeholder);
5244          return createRecurry(
5245            func, bitmask, createHybrid, wrapper.placeholder, thisArg,
5246            args, newHolders, argPos, ary, arity - length
5247          );
5248        }
5249        var thisBinding = isBind ? thisArg : this,
5250            fn = isBindKey ? thisBinding[func] : func;
5251
5252        length = args.length;
5253        if (argPos) {
5254          args = reorder(args, argPos);
5255        } else if (isFlip && length > 1) {
5256          args.reverse();
5257        }
5258        if (isAry && ary < length) {
5259          args.length = ary;
5260        }
5261        if (this && this !== root && this instanceof wrapper) {
5262          fn = Ctor || createCtor(fn);
5263        }
5264        return fn.apply(thisBinding, args);
5265      }
5266      return wrapper;
5267    }
5268
5269    /**
5270     * Creates a function like `_.invertBy`.
5271     *
5272     * @private
5273     * @param {Function} setter The function to set accumulator values.
5274     * @param {Function} toIteratee The function to resolve iteratees.
5275     * @returns {Function} Returns the new inverter function.
5276     */
5277    function createInverter(setter, toIteratee) {
5278      return function(object, iteratee) {
5279        return baseInverter(object, setter, toIteratee(iteratee), {});
5280      };
5281    }
5282
5283    /**
5284     * Creates a function that performs a mathematical operation on two values.
5285     *
5286     * @private
5287     * @param {Function} operator The function to perform the operation.
5288     * @param {number} [defaultValue] The value used for `undefined` arguments.
5289     * @returns {Function} Returns the new mathematical operation function.
5290     */
5291    function createMathOperation(operator, defaultValue) {
5292      return function(value, other) {
5293        var result;
5294        if (value === undefined && other === undefined) {
5295          return defaultValue;
5296        }
5297        if (value !== undefined) {
5298          result = value;
5299        }
5300        if (other !== undefined) {
5301          if (result === undefined) {
5302            return other;
5303          }
5304          if (typeof value == 'string' || typeof other == 'string') {
5305            value = baseToString(value);
5306            other = baseToString(other);
5307          } else {
5308            value = baseToNumber(value);
5309            other = baseToNumber(other);
5310          }
5311          result = operator(value, other);
5312        }
5313        return result;
5314      };
5315    }
5316
5317    /**
5318     * Creates a function like `_.over`.
5319     *
5320     * @private
5321     * @param {Function} arrayFunc The function to iterate over iteratees.
5322     * @returns {Function} Returns the new over function.
5323     */
5324    function createOver(arrayFunc) {
5325      return flatRest(function(iteratees) {
5326        iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
5327        return baseRest(function(args) {
5328          var thisArg = this;
5329          return arrayFunc(iteratees, function(iteratee) {
5330            return apply(iteratee, thisArg, args);
5331          });
5332        });
5333      });
5334    }
5335
5336    /**
5337     * Creates the padding for `string` based on `length`. The `chars` string
5338     * is truncated if the number of characters exceeds `length`.
5339     *
5340     * @private
5341     * @param {number} length The padding length.
5342     * @param {string} [chars=' '] The string used as padding.
5343     * @returns {string} Returns the padding for `string`.
5344     */
5345    function createPadding(length, chars) {
5346      chars = chars === undefined ? ' ' : baseToString(chars);
5347
5348      var charsLength = chars.length;
5349      if (charsLength < 2) {
5350        return charsLength ? baseRepeat(chars, length) : chars;
5351      }
5352      var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
5353      return hasUnicode(chars)
5354        ? castSlice(stringToArray(result), 0, length).join('')
5355        : result.slice(0, length);
5356    }
5357
5358    /**
5359     * Creates a function that wraps `func` to invoke it with the `this` binding
5360     * of `thisArg` and `partials` prepended to the arguments it receives.
5361     *
5362     * @private
5363     * @param {Function} func The function to wrap.
5364     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5365     * @param {*} thisArg The `this` binding of `func`.
5366     * @param {Array} partials The arguments to prepend to those provided to
5367     *  the new function.
5368     * @returns {Function} Returns the new wrapped function.
5369     */
5370    function createPartial(func, bitmask, thisArg, partials) {
5371      var isBind = bitmask & WRAP_BIND_FLAG,
5372          Ctor = createCtor(func);
5373
5374      function wrapper() {
5375        var argsIndex = -1,
5376            argsLength = arguments.length,
5377            leftIndex = -1,
5378            leftLength = partials.length,
5379            args = Array(leftLength + argsLength),
5380            fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5381
5382        while (++leftIndex < leftLength) {
5383          args[leftIndex] = partials[leftIndex];
5384        }
5385        while (argsLength--) {
5386          args[leftIndex++] = arguments[++argsIndex];
5387        }
5388        return apply(fn, isBind ? thisArg : this, args);
5389      }
5390      return wrapper;
5391    }
5392
5393    /**
5394     * Creates a `_.range` or `_.rangeRight` function.
5395     *
5396     * @private
5397     * @param {boolean} [fromRight] Specify iterating from right to left.
5398     * @returns {Function} Returns the new range function.
5399     */
5400    function createRange(fromRight) {
5401      return function(start, end, step) {
5402        if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
5403          end = step = undefined;
5404        }
5405        // Ensure the sign of `-0` is preserved.
5406        start = toFinite(start);
5407        if (end === undefined) {
5408          end = start;
5409          start = 0;
5410        } else {
5411          end = toFinite(end);
5412        }
5413        step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
5414        return baseRange(start, end, step, fromRight);
5415      };
5416    }
5417
5418    /**
5419     * Creates a function that performs a relational operation on two values.
5420     *
5421     * @private
5422     * @param {Function} operator The function to perform the operation.
5423     * @returns {Function} Returns the new relational operation function.
5424     */
5425    function createRelationalOperation(operator) {
5426      return function(value, other) {
5427        if (!(typeof value == 'string' && typeof other == 'string')) {
5428          value = toNumber(value);
5429          other = toNumber(other);
5430        }
5431        return operator(value, other);
5432      };
5433    }
5434
5435    /**
5436     * Creates a function that wraps `func` to continue currying.
5437     *
5438     * @private
5439     * @param {Function} func The function to wrap.
5440     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5441     * @param {Function} wrapFunc The function to create the `func` wrapper.
5442     * @param {*} placeholder The placeholder value.
5443     * @param {*} [thisArg] The `this` binding of `func`.
5444     * @param {Array} [partials] The arguments to prepend to those provided to
5445     *  the new function.
5446     * @param {Array} [holders] The `partials` placeholder indexes.
5447     * @param {Array} [argPos] The argument positions of the new function.
5448     * @param {number} [ary] The arity cap of `func`.
5449     * @param {number} [arity] The arity of `func`.
5450     * @returns {Function} Returns the new wrapped function.
5451     */
5452    function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
5453      var isCurry = bitmask & WRAP_CURRY_FLAG,
5454          newHolders = isCurry ? holders : undefined,
5455          newHoldersRight = isCurry ? undefined : holders,
5456          newPartials = isCurry ? partials : undefined,
5457          newPartialsRight = isCurry ? undefined : partials;
5458
5459      bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
5460      bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
5461
5462      if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
5463        bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
5464      }
5465      var newData = [
5466        func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
5467        newHoldersRight, argPos, ary, arity
5468      ];
5469
5470      var result = wrapFunc.apply(undefined, newData);
5471      if (isLaziable(func)) {
5472        setData(result, newData);
5473      }
5474      result.placeholder = placeholder;
5475      return setWrapToString(result, func, bitmask);
5476    }
5477
5478    /**
5479     * Creates a function like `_.round`.
5480     *
5481     * @private
5482     * @param {string} methodName The name of the `Math` method to use when rounding.
5483     * @returns {Function} Returns the new round function.
5484     */
5485    function createRound(methodName) {
5486      var func = Math[methodName];
5487      return function(number, precision) {
5488        number = toNumber(number);
5489        precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
5490        if (precision && nativeIsFinite(number)) {
5491          // Shift with exponential notation to avoid floating-point issues.
5492          // See [MDN](https://mdn.io/round#Examples) for more details.
5493          var pair = (toString(number) + 'e').split('e'),
5494              value = func(pair[0] + 'e' + (+pair[1] + precision));
5495
5496          pair = (toString(value) + 'e').split('e');
5497          return +(pair[0] + 'e' + (+pair[1] - precision));
5498        }
5499        return func(number);
5500      };
5501    }
5502
5503    /**
5504     * Creates a set object of `values`.
5505     *
5506     * @private
5507     * @param {Array} values The values to add to the set.
5508     * @returns {Object} Returns the new set.
5509     */
5510    var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
5511      return new Set(values);
5512    };
5513
5514    /**
5515     * Creates a `_.toPairs` or `_.toPairsIn` function.
5516     *
5517     * @private
5518     * @param {Function} keysFunc The function to get the keys of a given object.
5519     * @returns {Function} Returns the new pairs function.
5520     */
5521    function createToPairs(keysFunc) {
5522      return function(object) {
5523        var tag = getTag(object);
5524        if (tag == mapTag) {
5525          return mapToArray(object);
5526        }
5527        if (tag == setTag) {
5528          return setToPairs(object);
5529        }
5530        return baseToPairs(object, keysFunc(object));
5531      };
5532    }
5533
5534    /**
5535     * Creates a function that either curries or invokes `func` with optional
5536     * `this` binding and partially applied arguments.
5537     *
5538     * @private
5539     * @param {Function|string} func The function or method name to wrap.
5540     * @param {number} bitmask The bitmask flags.
5541     *    1 - `_.bind`
5542     *    2 - `_.bindKey`
5543     *    4 - `_.curry` or `_.curryRight` of a bound function
5544     *    8 - `_.curry`
5545     *   16 - `_.curryRight`
5546     *   32 - `_.partial`
5547     *   64 - `_.partialRight`
5548     *  128 - `_.rearg`
5549     *  256 - `_.ary`
5550     *  512 - `_.flip`
5551     * @param {*} [thisArg] The `this` binding of `func`.
5552     * @param {Array} [partials] The arguments to be partially applied.
5553     * @param {Array} [holders] The `partials` placeholder indexes.
5554     * @param {Array} [argPos] The argument positions of the new function.
5555     * @param {number} [ary] The arity cap of `func`.
5556     * @param {number} [arity] The arity of `func`.
5557     * @returns {Function} Returns the new wrapped function.
5558     */
5559    function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
5560      var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
5561      if (!isBindKey && typeof func != 'function') {
5562        throw new TypeError(FUNC_ERROR_TEXT);
5563      }
5564      var length = partials ? partials.length : 0;
5565      if (!length) {
5566        bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
5567        partials = holders = undefined;
5568      }
5569      ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
5570      arity = arity === undefined ? arity : toInteger(arity);
5571      length -= holders ? holders.length : 0;
5572
5573      if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
5574        var partialsRight = partials,
5575            holdersRight = holders;
5576
5577        partials = holders = undefined;
5578      }
5579      var data = isBindKey ? undefined : getData(func);
5580
5581      var newData = [
5582        func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
5583        argPos, ary, arity
5584      ];
5585
5586      if (data) {
5587        mergeData(newData, data);
5588      }
5589      func = newData[0];
5590      bitmask = newData[1];
5591      thisArg = newData[2];
5592      partials = newData[3];
5593      holders = newData[4];
5594      arity = newData[9] = newData[9] === undefined
5595        ? (isBindKey ? 0 : func.length)
5596        : nativeMax(newData[9] - length, 0);
5597
5598      if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
5599        bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
5600      }
5601      if (!bitmask || bitmask == WRAP_BIND_FLAG) {
5602        var result = createBind(func, bitmask, thisArg);
5603      } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
5604        result = createCurry(func, bitmask, arity);
5605      } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
5606        result = createPartial(func, bitmask, thisArg, partials);
5607      } else {
5608        result = createHybrid.apply(undefined, newData);
5609      }
5610      var setter = data ? baseSetData : setData;
5611      return setWrapToString(setter(result, newData), func, bitmask);
5612    }
5613
5614    /**
5615     * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
5616     * of source objects to the destination object for all destination properties
5617     * that resolve to `undefined`.
5618     *
5619     * @private
5620     * @param {*} objValue The destination value.
5621     * @param {*} srcValue The source value.
5622     * @param {string} key The key of the property to assign.
5623     * @param {Object} object The parent object of `objValue`.
5624     * @returns {*} Returns the value to assign.
5625     */
5626    function customDefaultsAssignIn(objValue, srcValue, key, object) {
5627      if (objValue === undefined ||
5628          (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
5629        return srcValue;
5630      }
5631      return objValue;
5632    }
5633
5634    /**
5635     * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
5636     * objects into destination objects that are passed thru.
5637     *
5638     * @private
5639     * @param {*} objValue The destination value.
5640     * @param {*} srcValue The source value.
5641     * @param {string} key The key of the property to merge.
5642     * @param {Object} object The parent object of `objValue`.
5643     * @param {Object} source The parent object of `srcValue`.
5644     * @param {Object} [stack] Tracks traversed source values and their merged
5645     *  counterparts.
5646     * @returns {*} Returns the value to assign.
5647     */
5648    function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
5649      if (isObject(objValue) && isObject(srcValue)) {
5650        // Recursively merge objects and arrays (susceptible to call stack limits).
5651        stack.set(srcValue, objValue);
5652        baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
5653        stack['delete'](srcValue);
5654      }
5655      return objValue;
5656    }
5657
5658    /**
5659     * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
5660     * objects.
5661     *
5662     * @private
5663     * @param {*} value The value to inspect.
5664     * @param {string} key The key of the property to inspect.
5665     * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
5666     */
5667    function customOmitClone(value) {
5668      return isPlainObject(value) ? undefined : value;
5669    }
5670
5671    /**
5672     * A specialized version of `baseIsEqualDeep` for arrays with support for
5673     * partial deep comparisons.
5674     *
5675     * @private
5676     * @param {Array} array The array to compare.
5677     * @param {Array} other The other array to compare.
5678     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5679     * @param {Function} customizer The function to customize comparisons.
5680     * @param {Function} equalFunc The function to determine equivalents of values.
5681     * @param {Object} stack Tracks traversed `array` and `other` objects.
5682     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
5683     */
5684    function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
5685      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
5686          arrLength = array.length,
5687          othLength = other.length;
5688
5689      if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
5690        return false;
5691      }
5692      // Check that cyclic values are equal.
5693      var arrStacked = stack.get(array);
5694      var othStacked = stack.get(other);
5695      if (arrStacked && othStacked) {
5696        return arrStacked == other && othStacked == array;
5697      }
5698      var index = -1,
5699          result = true,
5700          seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
5701
5702      stack.set(array, other);
5703      stack.set(other, array);
5704
5705      // Ignore non-index properties.
5706      while (++index < arrLength) {
5707        var arrValue = array[index],
5708            othValue = other[index];
5709
5710        if (customizer) {
5711          var compared = isPartial
5712            ? customizer(othValue, arrValue, index, other, array, stack)
5713            : customizer(arrValue, othValue, index, array, other, stack);
5714        }
5715        if (compared !== undefined) {
5716          if (compared) {
5717            continue;
5718          }
5719          result = false;
5720          break;
5721        }
5722        // Recursively compare arrays (susceptible to call stack limits).
5723        if (seen) {
5724          if (!arraySome(other, function(othValue, othIndex) {
5725                if (!cacheHas(seen, othIndex) &&
5726                    (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
5727                  return seen.push(othIndex);
5728                }
5729              })) {
5730            result = false;
5731            break;
5732          }
5733        } else if (!(
5734              arrValue === othValue ||
5735                equalFunc(arrValue, othValue, bitmask, customizer, stack)
5736            )) {
5737          result = false;
5738          break;
5739        }
5740      }
5741      stack['delete'](array);
5742      stack['delete'](other);
5743      return result;
5744    }
5745
5746    /**
5747     * A specialized version of `baseIsEqualDeep` for comparing objects of
5748     * the same `toStringTag`.
5749     *
5750     * **Note:** This function only supports comparing values with tags of
5751     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
5752     *
5753     * @private
5754     * @param {Object} object The object to compare.
5755     * @param {Object} other The other object to compare.
5756     * @param {string} tag The `toStringTag` of the objects to compare.
5757     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5758     * @param {Function} customizer The function to customize comparisons.
5759     * @param {Function} equalFunc The function to determine equivalents of values.
5760     * @param {Object} stack Tracks traversed `object` and `other` objects.
5761     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5762     */
5763    function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
5764      switch (tag) {
5765        case dataViewTag:
5766          if ((object.byteLength != other.byteLength) ||
5767              (object.byteOffset != other.byteOffset)) {
5768            return false;
5769          }
5770          object = object.buffer;
5771          other = other.buffer;
5772
5773        case arrayBufferTag:
5774          if ((object.byteLength != other.byteLength) ||
5775              !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
5776            return false;
5777          }
5778          return true;
5779
5780        case boolTag:
5781        case dateTag:
5782        case numberTag:
5783          // Coerce booleans to `1` or `0` and dates to milliseconds.
5784          // Invalid dates are coerced to `NaN`.
5785          return eq(+object, +other);
5786
5787        case errorTag:
5788          return object.name == other.name && object.message == other.message;
5789
5790        case regexpTag:
5791        case stringTag:
5792          // Coerce regexes to strings and treat strings, primitives and objects,
5793          // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
5794          // for more details.
5795          return object == (other + '');
5796
5797        case mapTag:
5798          var convert = mapToArray;
5799
5800        case setTag:
5801          var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
5802          convert || (convert = setToArray);
5803
5804          if (object.size != other.size && !isPartial) {
5805            return false;
5806          }
5807          // Assume cyclic values are equal.
5808          var stacked = stack.get(object);
5809          if (stacked) {
5810            return stacked == other;
5811          }
5812          bitmask |= COMPARE_UNORDERED_FLAG;
5813
5814          // Recursively compare objects (susceptible to call stack limits).
5815          stack.set(object, other);
5816          var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
5817          stack['delete'](object);
5818          return result;
5819
5820        case symbolTag:
5821          if (symbolValueOf) {
5822            return symbolValueOf.call(object) == symbolValueOf.call(other);
5823          }
5824      }
5825      return false;
5826    }
5827
5828    /**
5829     * A specialized version of `baseIsEqualDeep` for objects with support for
5830     * partial deep comparisons.
5831     *
5832     * @private
5833     * @param {Object} object The object to compare.
5834     * @param {Object} other The other object to compare.
5835     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5836     * @param {Function} customizer The function to customize comparisons.
5837     * @param {Function} equalFunc The function to determine equivalents of values.
5838     * @param {Object} stack Tracks traversed `object` and `other` objects.
5839     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5840     */
5841    function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
5842      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
5843          objProps = getAllKeys(object),
5844          objLength = objProps.length,
5845          othProps = getAllKeys(other),
5846          othLength = othProps.length;
5847
5848      if (objLength != othLength && !isPartial) {
5849        return false;
5850      }
5851      var index = objLength;
5852      while (index--) {
5853        var key = objProps[index];
5854        if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
5855          return false;
5856        }
5857      }
5858      // Check that cyclic values are equal.
5859      var objStacked = stack.get(object);
5860      var othStacked = stack.get(other);
5861      if (objStacked && othStacked) {
5862        return objStacked == other && othStacked == object;
5863      }
5864      var result = true;
5865      stack.set(object, other);
5866      stack.set(other, object);
5867
5868      var skipCtor = isPartial;
5869      while (++index < objLength) {
5870        key = objProps[index];
5871        var objValue = object[key],
5872            othValue = other[key];
5873
5874        if (customizer) {
5875          var compared = isPartial
5876            ? customizer(othValue, objValue, key, other, object, stack)
5877            : customizer(objValue, othValue, key, object, other, stack);
5878        }
5879        // Recursively compare objects (susceptible to call stack limits).
5880        if (!(compared === undefined
5881              ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
5882              : compared
5883            )) {
5884          result = false;
5885          break;
5886        }
5887        skipCtor || (skipCtor = key == 'constructor');
5888      }
5889      if (result && !skipCtor) {
5890        var objCtor = object.constructor,
5891            othCtor = other.constructor;
5892
5893        // Non `Object` object instances with different constructors are not equal.
5894        if (objCtor != othCtor &&
5895            ('constructor' in object && 'constructor' in other) &&
5896            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
5897              typeof othCtor == 'function' && othCtor instanceof othCtor)) {
5898          result = false;
5899        }
5900      }
5901      stack['delete'](object);
5902      stack['delete'](other);
5903      return result;
5904    }
5905
5906    /**
5907     * A specialized version of `baseRest` which flattens the rest array.
5908     *
5909     * @private
5910     * @param {Function} func The function to apply a rest parameter to.
5911     * @returns {Function} Returns the new function.
5912     */
5913    function flatRest(func) {
5914      return setToString(overRest(func, undefined, flatten), func + '');
5915    }
5916
5917    /**
5918     * Creates an array of own enumerable property names and symbols of `object`.
5919     *
5920     * @private
5921     * @param {Object} object The object to query.
5922     * @returns {Array} Returns the array of property names and symbols.
5923     */
5924    function getAllKeys(object) {
5925      return baseGetAllKeys(object, keys, getSymbols);
5926    }
5927
5928    /**
5929     * Creates an array of own and inherited enumerable property names and
5930     * symbols of `object`.
5931     *
5932     * @private
5933     * @param {Object} object The object to query.
5934     * @returns {Array} Returns the array of property names and symbols.
5935     */
5936    function getAllKeysIn(object) {
5937      return baseGetAllKeys(object, keysIn, getSymbolsIn);
5938    }
5939
5940    /**
5941     * Gets metadata for `func`.
5942     *
5943     * @private
5944     * @param {Function} func The function to query.
5945     * @returns {*} Returns the metadata for `func`.
5946     */
5947    var getData = !metaMap ? noop : function(func) {
5948      return metaMap.get(func);
5949    };
5950
5951    /**
5952     * Gets the name of `func`.
5953     *
5954     * @private
5955     * @param {Function} func The function to query.
5956     * @returns {string} Returns the function name.
5957     */
5958    function getFuncName(func) {
5959      var result = (func.name + ''),
5960          array = realNames[result],
5961          length = hasOwnProperty.call(realNames, result) ? array.length : 0;
5962
5963      while (length--) {
5964        var data = array[length],
5965            otherFunc = data.func;
5966        if (otherFunc == null || otherFunc == func) {
5967          return data.name;
5968        }
5969      }
5970      return result;
5971    }
5972
5973    /**
5974     * Gets the argument placeholder value for `func`.
5975     *
5976     * @private
5977     * @param {Function} func The function to inspect.
5978     * @returns {*} Returns the placeholder value.
5979     */
5980    function getHolder(func) {
5981      var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
5982      return object.placeholder;
5983    }
5984
5985    /**
5986     * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
5987     * this function returns the custom method, otherwise it returns `baseIteratee`.
5988     * If arguments are provided, the chosen function is invoked with them and
5989     * its result is returned.
5990     *
5991     * @private
5992     * @param {*} [value] The value to convert to an iteratee.
5993     * @param {number} [arity] The arity of the created iteratee.
5994     * @returns {Function} Returns the chosen function or its result.
5995     */
5996    function getIteratee() {
5997      var result = lodash.iteratee || iteratee;
5998      result = result === iteratee ? baseIteratee : result;
5999      return arguments.length ? result(arguments[0], arguments[1]) : result;
6000    }
6001
6002    /**
6003     * Gets the data for `map`.
6004     *
6005     * @private
6006     * @param {Object} map The map to query.
6007     * @param {string} key The reference key.
6008     * @returns {*} Returns the map data.
6009     */
6010    function getMapData(map, key) {
6011      var data = map.__data__;
6012      return isKeyable(key)
6013        ? data[typeof key == 'string' ? 'string' : 'hash']
6014        : data.map;
6015    }
6016
6017    /**
6018     * Gets the property names, values, and compare flags of `object`.
6019     *
6020     * @private
6021     * @param {Object} object The object to query.
6022     * @returns {Array} Returns the match data of `object`.
6023     */
6024    function getMatchData(object) {
6025      var result = keys(object),
6026          length = result.length;
6027
6028      while (length--) {
6029        var key = result[length],
6030            value = object[key];
6031
6032        result[length] = [key, value, isStrictComparable(value)];
6033      }
6034      return result;
6035    }
6036
6037    /**
6038     * Gets the native function at `key` of `object`.
6039     *
6040     * @private
6041     * @param {Object} object The object to query.
6042     * @param {string} key The key of the method to get.
6043     * @returns {*} Returns the function if it's native, else `undefined`.
6044     */
6045    function getNative(object, key) {
6046      var value = getValue(object, key);
6047      return baseIsNative(value) ? value : undefined;
6048    }
6049
6050    /**
6051     * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
6052     *
6053     * @private
6054     * @param {*} value The value to query.
6055     * @returns {string} Returns the raw `toStringTag`.
6056     */
6057    function getRawTag(value) {
6058      var isOwn = hasOwnProperty.call(value, symToStringTag),
6059          tag = value[symToStringTag];
6060
6061      try {
6062        value[symToStringTag] = undefined;
6063        var unmasked = true;
6064      } catch (e) {}
6065
6066      var result = nativeObjectToString.call(value);
6067      if (unmasked) {
6068        if (isOwn) {
6069          value[symToStringTag] = tag;
6070        } else {
6071          delete value[symToStringTag];
6072        }
6073      }
6074      return result;
6075    }
6076
6077    /**
6078     * Creates an array of the own enumerable symbols of `object`.
6079     *
6080     * @private
6081     * @param {Object} object The object to query.
6082     * @returns {Array} Returns the array of symbols.
6083     */
6084    var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
6085      if (object == null) {
6086        return [];
6087      }
6088      object = Object(object);
6089      return arrayFilter(nativeGetSymbols(object), function(symbol) {
6090        return propertyIsEnumerable.call(object, symbol);
6091      });
6092    };
6093
6094    /**
6095     * Creates an array of the own and inherited enumerable symbols of `object`.
6096     *
6097     * @private
6098     * @param {Object} object The object to query.
6099     * @returns {Array} Returns the array of symbols.
6100     */
6101    var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
6102      var result = [];
6103      while (object) {
6104        arrayPush(result, getSymbols(object));
6105        object = getPrototype(object);
6106      }
6107      return result;
6108    };
6109
6110    /**
6111     * Gets the `toStringTag` of `value`.
6112     *
6113     * @private
6114     * @param {*} value The value to query.
6115     * @returns {string} Returns the `toStringTag`.
6116     */
6117    var getTag = baseGetTag;
6118
6119    // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
6120    if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
6121        (Map && getTag(new Map) != mapTag) ||
6122        (Promise && getTag(Promise.resolve()) != promiseTag) ||
6123        (Set && getTag(new Set) != setTag) ||
6124        (WeakMap && getTag(new WeakMap) != weakMapTag)) {
6125      getTag = function(value) {
6126        var result = baseGetTag(value),
6127            Ctor = result == objectTag ? value.constructor : undefined,
6128            ctorString = Ctor ? toSource(Ctor) : '';
6129
6130        if (ctorString) {
6131          switch (ctorString) {
6132            case dataViewCtorString: return dataViewTag;
6133            case mapCtorString: return mapTag;
6134            case promiseCtorString: return promiseTag;
6135            case setCtorString: return setTag;
6136            case weakMapCtorString: return weakMapTag;
6137          }
6138        }
6139        return result;
6140      };
6141    }
6142
6143    /**
6144     * Gets the view, applying any `transforms` to the `start` and `end` positions.
6145     *
6146     * @private
6147     * @param {number} start The start of the view.
6148     * @param {number} end The end of the view.
6149     * @param {Array} transforms The transformations to apply to the view.
6150     * @returns {Object} Returns an object containing the `start` and `end`
6151     *  positions of the view.
6152     */
6153    function getView(start, end, transforms) {
6154      var index = -1,
6155          length = transforms.length;
6156
6157      while (++index < length) {
6158        var data = transforms[index],
6159            size = data.size;
6160
6161        switch (data.type) {
6162          case 'drop':      start += size; break;
6163          case 'dropRight': end -= size; break;
6164          case 'take':      end = nativeMin(end, start + size); break;
6165          case 'takeRight': start = nativeMax(start, end - size); break;
6166        }
6167      }
6168      return { 'start': start, 'end': end };
6169    }
6170
6171    /**
6172     * Extracts wrapper details from the `source` body comment.
6173     *
6174     * @private
6175     * @param {string} source The source to inspect.
6176     * @returns {Array} Returns the wrapper details.
6177     */
6178    function getWrapDetails(source) {
6179      var match = source.match(reWrapDetails);
6180      return match ? match[1].split(reSplitDetails) : [];
6181    }
6182
6183    /**
6184     * Checks if `path` exists on `object`.
6185     *
6186     * @private
6187     * @param {Object} object The object to query.
6188     * @param {Array|string} path The path to check.
6189     * @param {Function} hasFunc The function to check properties.
6190     * @returns {boolean} Returns `true` if `path` exists, else `false`.
6191     */
6192    function hasPath(object, path, hasFunc) {
6193      path = castPath(path, object);
6194
6195      var index = -1,
6196          length = path.length,
6197          result = false;
6198
6199      while (++index < length) {
6200        var key = toKey(path[index]);
6201        if (!(result = object != null && hasFunc(object, key))) {
6202          break;
6203        }
6204        object = object[key];
6205      }
6206      if (result || ++index != length) {
6207        return result;
6208      }
6209      length = object == null ? 0 : object.length;
6210      return !!length && isLength(length) && isIndex(key, length) &&
6211        (isArray(object) || isArguments(object));
6212    }
6213
6214    /**
6215     * Initializes an array clone.
6216     *
6217     * @private
6218     * @param {Array} array The array to clone.
6219     * @returns {Array} Returns the initialized clone.
6220     */
6221    function initCloneArray(array) {
6222      var length = array.length,
6223          result = new array.constructor(length);
6224
6225      // Add properties assigned by `RegExp#exec`.
6226      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
6227        result.index = array.index;
6228        result.input = array.input;
6229      }
6230      return result;
6231    }
6232
6233    /**
6234     * Initializes an object clone.
6235     *
6236     * @private
6237     * @param {Object} object The object to clone.
6238     * @returns {Object} Returns the initialized clone.
6239     */
6240    function initCloneObject(object) {
6241      return (typeof object.constructor == 'function' && !isPrototype(object))
6242        ? baseCreate(getPrototype(object))
6243        : {};
6244    }
6245
6246    /**
6247     * Initializes an object clone based on its `toStringTag`.
6248     *
6249     * **Note:** This function only supports cloning values with tags of
6250     * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
6251     *
6252     * @private
6253     * @param {Object} object The object to clone.
6254     * @param {string} tag The `toStringTag` of the object to clone.
6255     * @param {boolean} [isDeep] Specify a deep clone.
6256     * @returns {Object} Returns the initialized clone.
6257     */
6258    function initCloneByTag(object, tag, isDeep) {
6259      var Ctor = object.constructor;
6260      switch (tag) {
6261        case arrayBufferTag:
6262          return cloneArrayBuffer(object);
6263
6264        case boolTag:
6265        case dateTag:
6266          return new Ctor(+object);
6267
6268        case dataViewTag:
6269          return cloneDataView(object, isDeep);
6270
6271        case float32Tag: case float64Tag:
6272        case int8Tag: case int16Tag: case int32Tag:
6273        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
6274          return cloneTypedArray(object, isDeep);
6275
6276        case mapTag:
6277          return new Ctor;
6278
6279        case numberTag:
6280        case stringTag:
6281          return new Ctor(object);
6282
6283        case regexpTag:
6284          return cloneRegExp(object);
6285
6286        case setTag:
6287          return new Ctor;
6288
6289        case symbolTag:
6290          return cloneSymbol(object);
6291      }
6292    }
6293
6294    /**
6295     * Inserts wrapper `details` in a comment at the top of the `source` body.
6296     *
6297     * @private
6298     * @param {string} source The source to modify.
6299     * @returns {Array} details The details to insert.
6300     * @returns {string} Returns the modified source.
6301     */
6302    function insertWrapDetails(source, details) {
6303      var length = details.length;
6304      if (!length) {
6305        return source;
6306      }
6307      var lastIndex = length - 1;
6308      details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
6309      details = details.join(length > 2 ? ', ' : ' ');
6310      return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
6311    }
6312
6313    /**
6314     * Checks if `value` is a flattenable `arguments` object or array.
6315     *
6316     * @private
6317     * @param {*} value The value to check.
6318     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
6319     */
6320    function isFlattenable(value) {
6321      return isArray(value) || isArguments(value) ||
6322        !!(spreadableSymbol && value && value[spreadableSymbol]);
6323    }
6324
6325    /**
6326     * Checks if `value` is a valid array-like index.
6327     *
6328     * @private
6329     * @param {*} value The value to check.
6330     * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
6331     * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
6332     */
6333    function isIndex(value, length) {
6334      var type = typeof value;
6335      length = length == null ? MAX_SAFE_INTEGER : length;
6336
6337      return !!length &&
6338        (type == 'number' ||
6339          (type != 'symbol' && reIsUint.test(value))) &&
6340            (value > -1 && value % 1 == 0 && value < length);
6341    }
6342
6343    /**
6344     * Checks if the given arguments are from an iteratee call.
6345     *
6346     * @private
6347     * @param {*} value The potential iteratee value argument.
6348     * @param {*} index The potential iteratee index or key argument.
6349     * @param {*} object The potential iteratee object argument.
6350     * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
6351     *  else `false`.
6352     */
6353    function isIterateeCall(value, index, object) {
6354      if (!isObject(object)) {
6355        return false;
6356      }
6357      var type = typeof index;
6358      if (type == 'number'
6359            ? (isArrayLike(object) && isIndex(index, object.length))
6360            : (type == 'string' && index in object)
6361          ) {
6362        return eq(object[index], value);
6363      }
6364      return false;
6365    }
6366
6367    /**
6368     * Checks if `value` is a property name and not a property path.
6369     *
6370     * @private
6371     * @param {*} value The value to check.
6372     * @param {Object} [object] The object to query keys on.
6373     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
6374     */
6375    function isKey(value, object) {
6376      if (isArray(value)) {
6377        return false;
6378      }
6379      var type = typeof value;
6380      if (type == 'number' || type == 'symbol' || type == 'boolean' ||
6381          value == null || isSymbol(value)) {
6382        return true;
6383      }
6384      return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
6385        (object != null && value in Object(object));
6386    }
6387
6388    /**
6389     * Checks if `value` is suitable for use as unique object key.
6390     *
6391     * @private
6392     * @param {*} value The value to check.
6393     * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
6394     */
6395    function isKeyable(value) {
6396      var type = typeof value;
6397      return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
6398        ? (value !== '__proto__')
6399        : (value === null);
6400    }
6401
6402    /**
6403     * Checks if `func` has a lazy counterpart.
6404     *
6405     * @private
6406     * @param {Function} func The function to check.
6407     * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
6408     *  else `false`.
6409     */
6410    function isLaziable(func) {
6411      var funcName = getFuncName(func),
6412          other = lodash[funcName];
6413
6414      if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
6415        return false;
6416      }
6417      if (func === other) {
6418        return true;
6419      }
6420      var data = getData(other);
6421      return !!data && func === data[0];
6422    }
6423
6424    /**
6425     * Checks if `func` has its source masked.
6426     *
6427     * @private
6428     * @param {Function} func The function to check.
6429     * @returns {boolean} Returns `true` if `func` is masked, else `false`.
6430     */
6431    function isMasked(func) {
6432      return !!maskSrcKey && (maskSrcKey in func);
6433    }
6434
6435    /**
6436     * Checks if `func` is capable of being masked.
6437     *
6438     * @private
6439     * @param {*} value The value to check.
6440     * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
6441     */
6442    var isMaskable = coreJsData ? isFunction : stubFalse;
6443
6444    /**
6445     * Checks if `value` is likely a prototype object.
6446     *
6447     * @private
6448     * @param {*} value The value to check.
6449     * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
6450     */
6451    function isPrototype(value) {
6452      var Ctor = value && value.constructor,
6453          proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
6454
6455      return value === proto;
6456    }
6457
6458    /**
6459     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
6460     *
6461     * @private
6462     * @param {*} value The value to check.
6463     * @returns {boolean} Returns `true` if `value` if suitable for strict
6464     *  equality comparisons, else `false`.
6465     */
6466    function isStrictComparable(value) {
6467      return value === value && !isObject(value);
6468    }
6469
6470    /**
6471     * A specialized version of `matchesProperty` for source values suitable
6472     * for strict equality comparisons, i.e. `===`.
6473     *
6474     * @private
6475     * @param {string} key The key of the property to get.
6476     * @param {*} srcValue The value to match.
6477     * @returns {Function} Returns the new spec function.
6478     */
6479    function matchesStrictComparable(key, srcValue) {
6480      return function(object) {
6481        if (object == null) {
6482          return false;
6483        }
6484        return object[key] === srcValue &&
6485          (srcValue !== undefined || (key in Object(object)));
6486      };
6487    }
6488
6489    /**
6490     * A specialized version of `_.memoize` which clears the memoized function's
6491     * cache when it exceeds `MAX_MEMOIZE_SIZE`.
6492     *
6493     * @private
6494     * @param {Function} func The function to have its output memoized.
6495     * @returns {Function} Returns the new memoized function.
6496     */
6497    function memoizeCapped(func) {
6498      var result = memoize(func, function(key) {
6499        if (cache.size === MAX_MEMOIZE_SIZE) {
6500          cache.clear();
6501        }
6502        return key;
6503      });
6504
6505      var cache = result.cache;
6506      return result;
6507    }
6508
6509    /**
6510     * Merges the function metadata of `source` into `data`.
6511     *
6512     * Merging metadata reduces the number of wrappers used to invoke a function.
6513     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
6514     * may be applied regardless of execution order. Methods like `_.ary` and
6515     * `_.rearg` modify function arguments, making the order in which they are
6516     * executed important, preventing the merging of metadata. However, we make
6517     * an exception for a safe combined case where curried functions have `_.ary`
6518     * and or `_.rearg` applied.
6519     *
6520     * @private
6521     * @param {Array} data The destination metadata.
6522     * @param {Array} source The source metadata.
6523     * @returns {Array} Returns `data`.
6524     */
6525    function mergeData(data, source) {
6526      var bitmask = data[1],
6527          srcBitmask = source[1],
6528          newBitmask = bitmask | srcBitmask,
6529          isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
6530
6531      var isCombo =
6532        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
6533        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
6534        ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
6535
6536      // Exit early if metadata can't be merged.
6537      if (!(isCommon || isCombo)) {
6538        return data;
6539      }
6540      // Use source `thisArg` if available.
6541      if (srcBitmask & WRAP_BIND_FLAG) {
6542        data[2] = source[2];
6543        // Set when currying a bound function.
6544        newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
6545      }
6546      // Compose partial arguments.
6547      var value = source[3];
6548      if (value) {
6549        var partials = data[3];
6550        data[3] = partials ? composeArgs(partials, value, source[4]) : value;
6551        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
6552      }
6553      // Compose partial right arguments.
6554      value = source[5];
6555      if (value) {
6556        partials = data[5];
6557        data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
6558        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
6559      }
6560      // Use source `argPos` if available.
6561      value = source[7];
6562      if (value) {
6563        data[7] = value;
6564      }
6565      // Use source `ary` if it's smaller.
6566      if (srcBitmask & WRAP_ARY_FLAG) {
6567        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
6568      }
6569      // Use source `arity` if one is not provided.
6570      if (data[9] == null) {
6571        data[9] = source[9];
6572      }
6573      // Use source `func` and merge bitmasks.
6574      data[0] = source[0];
6575      data[1] = newBitmask;
6576
6577      return data;
6578    }
6579
6580    /**
6581     * This function is like
6582     * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
6583     * except that it includes inherited enumerable properties.
6584     *
6585     * @private
6586     * @param {Object} object The object to query.
6587     * @returns {Array} Returns the array of property names.
6588     */
6589    function nativeKeysIn(object) {
6590      var result = [];
6591      if (object != null) {
6592        for (var key in Object(object)) {
6593          result.push(key);
6594        }
6595      }
6596      return result;
6597    }
6598
6599    /**
6600     * Converts `value` to a string using `Object.prototype.toString`.
6601     *
6602     * @private
6603     * @param {*} value The value to convert.
6604     * @returns {string} Returns the converted string.
6605     */
6606    function objectToString(value) {
6607      return nativeObjectToString.call(value);
6608    }
6609
6610    /**
6611     * A specialized version of `baseRest` which transforms the rest array.
6612     *
6613     * @private
6614     * @param {Function} func The function to apply a rest parameter to.
6615     * @param {number} [start=func.length-1] The start position of the rest parameter.
6616     * @param {Function} transform The rest array transform.
6617     * @returns {Function} Returns the new function.
6618     */
6619    function overRest(func, start, transform) {
6620      start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
6621      return function() {
6622        var args = arguments,
6623            index = -1,
6624            length = nativeMax(args.length - start, 0),
6625            array = Array(length);
6626
6627        while (++index < length) {
6628          array[index] = args[start + index];
6629        }
6630        index = -1;
6631        var otherArgs = Array(start + 1);
6632        while (++index < start) {
6633          otherArgs[index] = args[index];
6634        }
6635        otherArgs[start] = transform(array);
6636        return apply(func, this, otherArgs);
6637      };
6638    }
6639
6640    /**
6641     * Gets the parent value at `path` of `object`.
6642     *
6643     * @private
6644     * @param {Object} object The object to query.
6645     * @param {Array} path The path to get the parent value of.
6646     * @returns {*} Returns the parent value.
6647     */
6648    function parent(object, path) {
6649      return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
6650    }
6651
6652    /**
6653     * Reorder `array` according to the specified indexes where the element at
6654     * the first index is assigned as the first element, the element at
6655     * the second index is assigned as the second element, and so on.
6656     *
6657     * @private
6658     * @param {Array} array The array to reorder.
6659     * @param {Array} indexes The arranged array indexes.
6660     * @returns {Array} Returns `array`.
6661     */
6662    function reorder(array, indexes) {
6663      var arrLength = array.length,
6664          length = nativeMin(indexes.length, arrLength),
6665          oldArray = copyArray(array);
6666
6667      while (length--) {
6668        var index = indexes[length];
6669        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
6670      }
6671      return array;
6672    }
6673
6674    /**
6675     * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
6676     *
6677     * @private
6678     * @param {Object} object The object to query.
6679     * @param {string} key The key of the property to get.
6680     * @returns {*} Returns the property value.
6681     */
6682    function safeGet(object, key) {
6683      if (key === 'constructor' && typeof object[key] === 'function') {
6684        return;
6685      }
6686
6687      if (key == '__proto__') {
6688        return;
6689      }
6690
6691      return object[key];
6692    }
6693
6694    /**
6695     * Sets metadata for `func`.
6696     *
6697     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
6698     * period of time, it will trip its breaker and transition to an identity
6699     * function to avoid garbage collection pauses in V8. See
6700     * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
6701     * for more details.
6702     *
6703     * @private
6704     * @param {Function} func The function to associate metadata with.
6705     * @param {*} data The metadata.
6706     * @returns {Function} Returns `func`.
6707     */
6708    var setData = shortOut(baseSetData);
6709
6710    /**
6711     * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
6712     *
6713     * @private
6714     * @param {Function} func The function to delay.
6715     * @param {number} wait The number of milliseconds to delay invocation.
6716     * @returns {number|Object} Returns the timer id or timeout object.
6717     */
6718    var setTimeout = ctxSetTimeout || function(func, wait) {
6719      return root.setTimeout(func, wait);
6720    };
6721
6722    /**
6723     * Sets the `toString` method of `func` to return `string`.
6724     *
6725     * @private
6726     * @param {Function} func The function to modify.
6727     * @param {Function} string The `toString` result.
6728     * @returns {Function} Returns `func`.
6729     */
6730    var setToString = shortOut(baseSetToString);
6731
6732    /**
6733     * Sets the `toString` method of `wrapper` to mimic the source of `reference`
6734     * with wrapper details in a comment at the top of the source body.
6735     *
6736     * @private
6737     * @param {Function} wrapper The function to modify.
6738     * @param {Function} reference The reference function.
6739     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6740     * @returns {Function} Returns `wrapper`.
6741     */
6742    function setWrapToString(wrapper, reference, bitmask) {
6743      var source = (reference + '');
6744      return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
6745    }
6746
6747    /**
6748     * Creates a function that'll short out and invoke `identity` instead
6749     * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
6750     * milliseconds.
6751     *
6752     * @private
6753     * @param {Function} func The function to restrict.
6754     * @returns {Function} Returns the new shortable function.
6755     */
6756    function shortOut(func) {
6757      var count = 0,
6758          lastCalled = 0;
6759
6760      return function() {
6761        var stamp = nativeNow(),
6762            remaining = HOT_SPAN - (stamp - lastCalled);
6763
6764        lastCalled = stamp;
6765        if (remaining > 0) {
6766          if (++count >= HOT_COUNT) {
6767            return arguments[0];
6768          }
6769        } else {
6770          count = 0;
6771        }
6772        return func.apply(undefined, arguments);
6773      };
6774    }
6775
6776    /**
6777     * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
6778     *
6779     * @private
6780     * @param {Array} array The array to shuffle.
6781     * @param {number} [size=array.length] The size of `array`.
6782     * @returns {Array} Returns `array`.
6783     */
6784    function shuffleSelf(array, size) {
6785      var index = -1,
6786          length = array.length,
6787          lastIndex = length - 1;
6788
6789      size = size === undefined ? length : size;
6790      while (++index < size) {
6791        var rand = baseRandom(index, lastIndex),
6792            value = array[rand];
6793
6794        array[rand] = array[index];
6795        array[index] = value;
6796      }
6797      array.length = size;
6798      return array;
6799    }
6800
6801    /**
6802     * Converts `string` to a property path array.
6803     *
6804     * @private
6805     * @param {string} string The string to convert.
6806     * @returns {Array} Returns the property path array.
6807     */
6808    var stringToPath = memoizeCapped(function(string) {
6809      var result = [];
6810      if (string.charCodeAt(0) === 46 /* . */) {
6811        result.push('');
6812      }
6813      string.replace(rePropName, function(match, number, quote, subString) {
6814        result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
6815      });
6816      return result;
6817    });
6818
6819    /**
6820     * Converts `value` to a string key if it's not a string or symbol.
6821     *
6822     * @private
6823     * @param {*} value The value to inspect.
6824     * @returns {string|symbol} Returns the key.
6825     */
6826    function toKey(value) {
6827      if (typeof value == 'string' || isSymbol(value)) {
6828        return value;
6829      }
6830      var result = (value + '');
6831      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
6832    }
6833
6834    /**
6835     * Converts `func` to its source code.
6836     *
6837     * @private
6838     * @param {Function} func The function to convert.
6839     * @returns {string} Returns the source code.
6840     */
6841    function toSource(func) {
6842      if (func != null) {
6843        try {
6844          return funcToString.call(func);
6845        } catch (e) {}
6846        try {
6847          return (func + '');
6848        } catch (e) {}
6849      }
6850      return '';
6851    }
6852
6853    /**
6854     * Updates wrapper `details` based on `bitmask` flags.
6855     *
6856     * @private
6857     * @returns {Array} details The details to modify.
6858     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6859     * @returns {Array} Returns `details`.
6860     */
6861    function updateWrapDetails(details, bitmask) {
6862      arrayEach(wrapFlags, function(pair) {
6863        var value = '_.' + pair[0];
6864        if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
6865          details.push(value);
6866        }
6867      });
6868      return details.sort();
6869    }
6870
6871    /**
6872     * Creates a clone of `wrapper`.
6873     *
6874     * @private
6875     * @param {Object} wrapper The wrapper to clone.
6876     * @returns {Object} Returns the cloned wrapper.
6877     */
6878    function wrapperClone(wrapper) {
6879      if (wrapper instanceof LazyWrapper) {
6880        return wrapper.clone();
6881      }
6882      var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
6883      result.__actions__ = copyArray(wrapper.__actions__);
6884      result.__index__  = wrapper.__index__;
6885      result.__values__ = wrapper.__values__;
6886      return result;
6887    }
6888
6889    /*------------------------------------------------------------------------*/
6890
6891    /**
6892     * Creates an array of elements split into groups the length of `size`.
6893     * If `array` can't be split evenly, the final chunk will be the remaining
6894     * elements.
6895     *
6896     * @static
6897     * @memberOf _
6898     * @since 3.0.0
6899     * @category Array
6900     * @param {Array} array The array to process.
6901     * @param {number} [size=1] The length of each chunk
6902     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
6903     * @returns {Array} Returns the new array of chunks.
6904     * @example
6905     *
6906     * _.chunk(['a', 'b', 'c', 'd'], 2);
6907     * // => [['a', 'b'], ['c', 'd']]
6908     *
6909     * _.chunk(['a', 'b', 'c', 'd'], 3);
6910     * // => [['a', 'b', 'c'], ['d']]
6911     */
6912    function chunk(array, size, guard) {
6913      if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
6914        size = 1;
6915      } else {
6916        size = nativeMax(toInteger(size), 0);
6917      }
6918      var length = array == null ? 0 : array.length;
6919      if (!length || size < 1) {
6920        return [];
6921      }
6922      var index = 0,
6923          resIndex = 0,
6924          result = Array(nativeCeil(length / size));
6925
6926      while (index < length) {
6927        result[resIndex++] = baseSlice(array, index, (index += size));
6928      }
6929      return result;
6930    }
6931
6932    /**
6933     * Creates an array with all falsey values removed. The values `false`, `null`,
6934     * `0`, `""`, `undefined`, and `NaN` are falsey.
6935     *
6936     * @static
6937     * @memberOf _
6938     * @since 0.1.0
6939     * @category Array
6940     * @param {Array} array The array to compact.
6941     * @returns {Array} Returns the new array of filtered values.
6942     * @example
6943     *
6944     * _.compact([0, 1, false, 2, '', 3]);
6945     * // => [1, 2, 3]
6946     */
6947    function compact(array) {
6948      var index = -1,
6949          length = array == null ? 0 : array.length,
6950          resIndex = 0,
6951          result = [];
6952
6953      while (++index < length) {
6954        var value = array[index];
6955        if (value) {
6956          result[resIndex++] = value;
6957        }
6958      }
6959      return result;
6960    }
6961
6962    /**
6963     * Creates a new array concatenating `array` with any additional arrays
6964     * and/or values.
6965     *
6966     * @static
6967     * @memberOf _
6968     * @since 4.0.0
6969     * @category Array
6970     * @param {Array} array The array to concatenate.
6971     * @param {...*} [values] The values to concatenate.
6972     * @returns {Array} Returns the new concatenated array.
6973     * @example
6974     *
6975     * var array = [1];
6976     * var other = _.concat(array, 2, [3], [[4]]);
6977     *
6978     * console.log(other);
6979     * // => [1, 2, 3, [4]]
6980     *
6981     * console.log(array);
6982     * // => [1]
6983     */
6984    function concat() {
6985      var length = arguments.length;
6986      if (!length) {
6987        return [];
6988      }
6989      var args = Array(length - 1),
6990          array = arguments[0],
6991          index = length;
6992
6993      while (index--) {
6994        args[index - 1] = arguments[index];
6995      }
6996      return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
6997    }
6998
6999    /**
7000     * Creates an array of `array` values not included in the other given arrays
7001     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7002     * for equality comparisons. The order and references of result values are
7003     * determined by the first array.
7004     *
7005     * **Note:** Unlike `_.pullAll`, this method returns a new array.
7006     *
7007     * @static
7008     * @memberOf _
7009     * @since 0.1.0
7010     * @category Array
7011     * @param {Array} array The array to inspect.
7012     * @param {...Array} [values] The values to exclude.
7013     * @returns {Array} Returns the new array of filtered values.
7014     * @see _.without, _.xor
7015     * @example
7016     *
7017     * _.difference([2, 1], [2, 3]);
7018     * // => [1]
7019     */
7020    var difference = baseRest(function(array, values) {
7021      return isArrayLikeObject(array)
7022        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
7023        : [];
7024    });
7025
7026    /**
7027     * This method is like `_.difference` except that it accepts `iteratee` which
7028     * is invoked for each element of `array` and `values` to generate the criterion
7029     * by which they're compared. The order and references of result values are
7030     * determined by the first array. The iteratee is invoked with one argument:
7031     * (value).
7032     *
7033     * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
7034     *
7035     * @static
7036     * @memberOf _
7037     * @since 4.0.0
7038     * @category Array
7039     * @param {Array} array The array to inspect.
7040     * @param {...Array} [values] The values to exclude.
7041     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7042     * @returns {Array} Returns the new array of filtered values.
7043     * @example
7044     *
7045     * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
7046     * // => [1.2]
7047     *
7048     * // The `_.property` iteratee shorthand.
7049     * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
7050     * // => [{ 'x': 2 }]
7051     */
7052    var differenceBy = baseRest(function(array, values) {
7053      var iteratee = last(values);
7054      if (isArrayLikeObject(iteratee)) {
7055        iteratee = undefined;
7056      }
7057      return isArrayLikeObject(array)
7058        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
7059        : [];
7060    });
7061
7062    /**
7063     * This method is like `_.difference` except that it accepts `comparator`
7064     * which is invoked to compare elements of `array` to `values`. The order and
7065     * references of result values are determined by the first array. The comparator
7066     * is invoked with two arguments: (arrVal, othVal).
7067     *
7068     * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
7069     *
7070     * @static
7071     * @memberOf _
7072     * @since 4.0.0
7073     * @category Array
7074     * @param {Array} array The array to inspect.
7075     * @param {...Array} [values] The values to exclude.
7076     * @param {Function} [comparator] The comparator invoked per element.
7077     * @returns {Array} Returns the new array of filtered values.
7078     * @example
7079     *
7080     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
7081     *
7082     * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
7083     * // => [{ 'x': 2, 'y': 1 }]
7084     */
7085    var differenceWith = baseRest(function(array, values) {
7086      var comparator = last(values);
7087      if (isArrayLikeObject(comparator)) {
7088        comparator = undefined;
7089      }
7090      return isArrayLikeObject(array)
7091        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
7092        : [];
7093    });
7094
7095    /**
7096     * Creates a slice of `array` with `n` elements dropped from the beginning.
7097     *
7098     * @static
7099     * @memberOf _
7100     * @since 0.5.0
7101     * @category Array
7102     * @param {Array} array The array to query.
7103     * @param {number} [n=1] The number of elements to drop.
7104     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7105     * @returns {Array} Returns the slice of `array`.
7106     * @example
7107     *
7108     * _.drop([1, 2, 3]);
7109     * // => [2, 3]
7110     *
7111     * _.drop([1, 2, 3], 2);
7112     * // => [3]
7113     *
7114     * _.drop([1, 2, 3], 5);
7115     * // => []
7116     *
7117     * _.drop([1, 2, 3], 0);
7118     * // => [1, 2, 3]
7119     */
7120    function drop(array, n, guard) {
7121      var length = array == null ? 0 : array.length;
7122      if (!length) {
7123        return [];
7124      }
7125      n = (guard || n === undefined) ? 1 : toInteger(n);
7126      return baseSlice(array, n < 0 ? 0 : n, length);
7127    }
7128
7129    /**
7130     * Creates a slice of `array` with `n` elements dropped from the end.
7131     *
7132     * @static
7133     * @memberOf _
7134     * @since 3.0.0
7135     * @category Array
7136     * @param {Array} array The array to query.
7137     * @param {number} [n=1] The number of elements to drop.
7138     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7139     * @returns {Array} Returns the slice of `array`.
7140     * @example
7141     *
7142     * _.dropRight([1, 2, 3]);
7143     * // => [1, 2]
7144     *
7145     * _.dropRight([1, 2, 3], 2);
7146     * // => [1]
7147     *
7148     * _.dropRight([1, 2, 3], 5);
7149     * // => []
7150     *
7151     * _.dropRight([1, 2, 3], 0);
7152     * // => [1, 2, 3]
7153     */
7154    function dropRight(array, n, guard) {
7155      var length = array == null ? 0 : array.length;
7156      if (!length) {
7157        return [];
7158      }
7159      n = (guard || n === undefined) ? 1 : toInteger(n);
7160      n = length - n;
7161      return baseSlice(array, 0, n < 0 ? 0 : n);
7162    }
7163
7164    /**
7165     * Creates a slice of `array` excluding elements dropped from the end.
7166     * Elements are dropped until `predicate` returns falsey. The predicate is
7167     * invoked with three arguments: (value, index, array).
7168     *
7169     * @static
7170     * @memberOf _
7171     * @since 3.0.0
7172     * @category Array
7173     * @param {Array} array The array to query.
7174     * @param {Function} [predicate=_.identity] The function invoked per iteration.
7175     * @returns {Array} Returns the slice of `array`.
7176     * @example
7177     *
7178     * var users = [
7179     *   { 'user': 'barney',  'active': true },
7180     *   { 'user': 'fred',    'active': false },
7181     *   { 'user': 'pebbles', 'active': false }
7182     * ];
7183     *
7184     * _.dropRightWhile(users, function(o) { return !o.active; });
7185     * // => objects for ['barney']
7186     *
7187     * // The `_.matches` iteratee shorthand.
7188     * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
7189     * // => objects for ['barney', 'fred']
7190     *
7191     * // The `_.matchesProperty` iteratee shorthand.
7192     * _.dropRightWhile(users, ['active', false]);
7193     * // => objects for ['barney']
7194     *
7195     * // The `_.property` iteratee shorthand.
7196     * _.dropRightWhile(users, 'active');
7197     * // => objects for ['barney', 'fred', 'pebbles']
7198     */
7199    function dropRightWhile(array, predicate) {
7200      return (array && array.length)
7201        ? baseWhile(array, getIteratee(predicate, 3), true, true)
7202        : [];
7203    }
7204
7205    /**
7206     * Creates a slice of `array` excluding elements dropped from the beginning.
7207     * Elements are dropped until `predicate` returns falsey. The predicate is
7208     * invoked with three arguments: (value, index, array).
7209     *
7210     * @static
7211     * @memberOf _
7212     * @since 3.0.0
7213     * @category Array
7214     * @param {Array} array The array to query.
7215     * @param {Function} [predicate=_.identity] The function invoked per iteration.
7216     * @returns {Array} Returns the slice of `array`.
7217     * @example
7218     *
7219     * var users = [
7220     *   { 'user': 'barney',  'active': false },
7221     *   { 'user': 'fred',    'active': false },
7222     *   { 'user': 'pebbles', 'active': true }
7223     * ];
7224     *
7225     * _.dropWhile(users, function(o) { return !o.active; });
7226     * // => objects for ['pebbles']
7227     *
7228     * // The `_.matches` iteratee shorthand.
7229     * _.dropWhile(users, { 'user': 'barney', 'active': false });
7230     * // => objects for ['fred', 'pebbles']
7231     *
7232     * // The `_.matchesProperty` iteratee shorthand.
7233     * _.dropWhile(users, ['active', false]);
7234     * // => objects for ['pebbles']
7235     *
7236     * // The `_.property` iteratee shorthand.
7237     * _.dropWhile(users, 'active');
7238     * // => objects for ['barney', 'fred', 'pebbles']
7239     */
7240    function dropWhile(array, predicate) {
7241      return (array && array.length)
7242        ? baseWhile(array, getIteratee(predicate, 3), true)
7243        : [];
7244    }
7245
7246    /**
7247     * Fills elements of `array` with `value` from `start` up to, but not
7248     * including, `end`.
7249     *
7250     * **Note:** This method mutates `array`.
7251     *
7252     * @static
7253     * @memberOf _
7254     * @since 3.2.0
7255     * @category Array
7256     * @param {Array} array The array to fill.
7257     * @param {*} value The value to fill `array` with.
7258     * @param {number} [start=0] The start position.
7259     * @param {number} [end=array.length] The end position.
7260     * @returns {Array} Returns `array`.
7261     * @example
7262     *
7263     * var array = [1, 2, 3];
7264     *
7265     * _.fill(array, 'a');
7266     * console.log(array);
7267     * // => ['a', 'a', 'a']
7268     *
7269     * _.fill(Array(3), 2);
7270     * // => [2, 2, 2]
7271     *
7272     * _.fill([4, 6, 8, 10], '*', 1, 3);
7273     * // => [4, '*', '*', 10]
7274     */
7275    function fill(array, value, start, end) {
7276      var length = array == null ? 0 : array.length;
7277      if (!length) {
7278        return [];
7279      }
7280      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
7281        start = 0;
7282        end = length;
7283      }
7284      return baseFill(array, value, start, end);
7285    }
7286
7287    /**
7288     * This method is like `_.find` except that it returns the index of the first
7289     * element `predicate` returns truthy for instead of the element itself.
7290     *
7291     * @static
7292     * @memberOf _
7293     * @since 1.1.0
7294     * @category Array
7295     * @param {Array} array The array to inspect.
7296     * @param {Function} [predicate=_.identity] The function invoked per iteration.
7297     * @param {number} [fromIndex=0] The index to search from.
7298     * @returns {number} Returns the index of the found element, else `-1`.
7299     * @example
7300     *
7301     * var users = [
7302     *   { 'user': 'barney',  'active': false },
7303     *   { 'user': 'fred',    'active': false },
7304     *   { 'user': 'pebbles', 'active': true }
7305     * ];
7306     *
7307     * _.findIndex(users, function(o) { return o.user == 'barney'; });
7308     * // => 0
7309     *
7310     * // The `_.matches` iteratee shorthand.
7311     * _.findIndex(users, { 'user': 'fred', 'active': false });
7312     * // => 1
7313     *
7314     * // The `_.matchesProperty` iteratee shorthand.
7315     * _.findIndex(users, ['active', false]);
7316     * // => 0
7317     *
7318     * // The `_.property` iteratee shorthand.
7319     * _.findIndex(users, 'active');
7320     * // => 2
7321     */
7322    function findIndex(array, predicate, fromIndex) {
7323      var length = array == null ? 0 : array.length;
7324      if (!length) {
7325        return -1;
7326      }
7327      var index = fromIndex == null ? 0 : toInteger(fromIndex);
7328      if (index < 0) {
7329        index = nativeMax(length + index, 0);
7330      }
7331      return baseFindIndex(array, getIteratee(predicate, 3), index);
7332    }
7333
7334    /**
7335     * This method is like `_.findIndex` except that it iterates over elements
7336     * of `collection` from right to left.
7337     *
7338     * @static
7339     * @memberOf _
7340     * @since 2.0.0
7341     * @category Array
7342     * @param {Array} array The array to inspect.
7343     * @param {Function} [predicate=_.identity] The function invoked per iteration.
7344     * @param {number} [fromIndex=array.length-1] The index to search from.
7345     * @returns {number} Returns the index of the found element, else `-1`.
7346     * @example
7347     *
7348     * var users = [
7349     *   { 'user': 'barney',  'active': true },
7350     *   { 'user': 'fred',    'active': false },
7351     *   { 'user': 'pebbles', 'active': false }
7352     * ];
7353     *
7354     * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
7355     * // => 2
7356     *
7357     * // The `_.matches` iteratee shorthand.
7358     * _.findLastIndex(users, { 'user': 'barney', 'active': true });
7359     * // => 0
7360     *
7361     * // The `_.matchesProperty` iteratee shorthand.
7362     * _.findLastIndex(users, ['active', false]);
7363     * // => 2
7364     *
7365     * // The `_.property` iteratee shorthand.
7366     * _.findLastIndex(users, 'active');
7367     * // => 0
7368     */
7369    function findLastIndex(array, predicate, fromIndex) {
7370      var length = array == null ? 0 : array.length;
7371      if (!length) {
7372        return -1;
7373      }
7374      var index = length - 1;
7375      if (fromIndex !== undefined) {
7376        index = toInteger(fromIndex);
7377        index = fromIndex < 0
7378          ? nativeMax(length + index, 0)
7379          : nativeMin(index, length - 1);
7380      }
7381      return baseFindIndex(array, getIteratee(predicate, 3), index, true);
7382    }
7383
7384    /**
7385     * Flattens `array` a single level deep.
7386     *
7387     * @static
7388     * @memberOf _
7389     * @since 0.1.0
7390     * @category Array
7391     * @param {Array} array The array to flatten.
7392     * @returns {Array} Returns the new flattened array.
7393     * @example
7394     *
7395     * _.flatten([1, [2, [3, [4]], 5]]);
7396     * // => [1, 2, [3, [4]], 5]
7397     */
7398    function flatten(array) {
7399      var length = array == null ? 0 : array.length;
7400      return length ? baseFlatten(array, 1) : [];
7401    }
7402
7403    /**
7404     * Recursively flattens `array`.
7405     *
7406     * @static
7407     * @memberOf _
7408     * @since 3.0.0
7409     * @category Array
7410     * @param {Array} array The array to flatten.
7411     * @returns {Array} Returns the new flattened array.
7412     * @example
7413     *
7414     * _.flattenDeep([1, [2, [3, [4]], 5]]);
7415     * // => [1, 2, 3, 4, 5]
7416     */
7417    function flattenDeep(array) {
7418      var length = array == null ? 0 : array.length;
7419      return length ? baseFlatten(array, INFINITY) : [];
7420    }
7421
7422    /**
7423     * Recursively flatten `array` up to `depth` times.
7424     *
7425     * @static
7426     * @memberOf _
7427     * @since 4.4.0
7428     * @category Array
7429     * @param {Array} array The array to flatten.
7430     * @param {number} [depth=1] The maximum recursion depth.
7431     * @returns {Array} Returns the new flattened array.
7432     * @example
7433     *
7434     * var array = [1, [2, [3, [4]], 5]];
7435     *
7436     * _.flattenDepth(array, 1);
7437     * // => [1, 2, [3, [4]], 5]
7438     *
7439     * _.flattenDepth(array, 2);
7440     * // => [1, 2, 3, [4], 5]
7441     */
7442    function flattenDepth(array, depth) {
7443      var length = array == null ? 0 : array.length;
7444      if (!length) {
7445        return [];
7446      }
7447      depth = depth === undefined ? 1 : toInteger(depth);
7448      return baseFlatten(array, depth);
7449    }
7450
7451    /**
7452     * The inverse of `_.toPairs`; this method returns an object composed
7453     * from key-value `pairs`.
7454     *
7455     * @static
7456     * @memberOf _
7457     * @since 4.0.0
7458     * @category Array
7459     * @param {Array} pairs The key-value pairs.
7460     * @returns {Object} Returns the new object.
7461     * @example
7462     *
7463     * _.fromPairs([['a', 1], ['b', 2]]);
7464     * // => { 'a': 1, 'b': 2 }
7465     */
7466    function fromPairs(pairs) {
7467      var index = -1,
7468          length = pairs == null ? 0 : pairs.length,
7469          result = {};
7470
7471      while (++index < length) {
7472        var pair = pairs[index];
7473        result[pair[0]] = pair[1];
7474      }
7475      return result;
7476    }
7477
7478    /**
7479     * Gets the first element of `array`.
7480     *
7481     * @static
7482     * @memberOf _
7483     * @since 0.1.0
7484     * @alias first
7485     * @category Array
7486     * @param {Array} array The array to query.
7487     * @returns {*} Returns the first element of `array`.
7488     * @example
7489     *
7490     * _.head([1, 2, 3]);
7491     * // => 1
7492     *
7493     * _.head([]);
7494     * // => undefined
7495     */
7496    function head(array) {
7497      return (array && array.length) ? array[0] : undefined;
7498    }
7499
7500    /**
7501     * Gets the index at which the first occurrence of `value` is found in `array`
7502     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7503     * for equality comparisons. If `fromIndex` is negative, it's used as the
7504     * offset from the end of `array`.
7505     *
7506     * @static
7507     * @memberOf _
7508     * @since 0.1.0
7509     * @category Array
7510     * @param {Array} array The array to inspect.
7511     * @param {*} value The value to search for.
7512     * @param {number} [fromIndex=0] The index to search from.
7513     * @returns {number} Returns the index of the matched value, else `-1`.
7514     * @example
7515     *
7516     * _.indexOf([1, 2, 1, 2], 2);
7517     * // => 1
7518     *
7519     * // Search from the `fromIndex`.
7520     * _.indexOf([1, 2, 1, 2], 2, 2);
7521     * // => 3
7522     */
7523    function indexOf(array, value, fromIndex) {
7524      var length = array == null ? 0 : array.length;
7525      if (!length) {
7526        return -1;
7527      }
7528      var index = fromIndex == null ? 0 : toInteger(fromIndex);
7529      if (index < 0) {
7530        index = nativeMax(length + index, 0);
7531      }
7532      return baseIndexOf(array, value, index);
7533    }
7534
7535    /**
7536     * Gets all but the last element of `array`.
7537     *
7538     * @static
7539     * @memberOf _
7540     * @since 0.1.0
7541     * @category Array
7542     * @param {Array} array The array to query.
7543     * @returns {Array} Returns the slice of `array`.
7544     * @example
7545     *
7546     * _.initial([1, 2, 3]);
7547     * // => [1, 2]
7548     */
7549    function initial(array) {
7550      var length = array == null ? 0 : array.length;
7551      return length ? baseSlice(array, 0, -1) : [];
7552    }
7553
7554    /**
7555     * Creates an array of unique values that are included in all given arrays
7556     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7557     * for equality comparisons. The order and references of result values are
7558     * determined by the first array.
7559     *
7560     * @static
7561     * @memberOf _
7562     * @since 0.1.0
7563     * @category Array
7564     * @param {...Array} [arrays] The arrays to inspect.
7565     * @returns {Array} Returns the new array of intersecting values.
7566     * @example
7567     *
7568     * _.intersection([2, 1], [2, 3]);
7569     * // => [2]
7570     */
7571    var intersection = baseRest(function(arrays) {
7572      var mapped = arrayMap(arrays, castArrayLikeObject);
7573      return (mapped.length && mapped[0] === arrays[0])
7574        ? baseIntersection(mapped)
7575        : [];
7576    });
7577
7578    /**
7579     * This method is like `_.intersection` except that it accepts `iteratee`
7580     * which is invoked for each element of each `arrays` to generate the criterion
7581     * by which they're compared. The order and references of result values are
7582     * determined by the first array. The iteratee is invoked with one argument:
7583     * (value).
7584     *
7585     * @static
7586     * @memberOf _
7587     * @since 4.0.0
7588     * @category Array
7589     * @param {...Array} [arrays] The arrays to inspect.
7590     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7591     * @returns {Array} Returns the new array of intersecting values.
7592     * @example
7593     *
7594     * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
7595     * // => [2.1]
7596     *
7597     * // The `_.property` iteratee shorthand.
7598     * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
7599     * // => [{ 'x': 1 }]
7600     */
7601    var intersectionBy = baseRest(function(arrays) {
7602      var iteratee = last(arrays),
7603          mapped = arrayMap(arrays, castArrayLikeObject);
7604
7605      if (iteratee === last(mapped)) {
7606        iteratee = undefined;
7607      } else {
7608        mapped.pop();
7609      }
7610      return (mapped.length && mapped[0] === arrays[0])
7611        ? baseIntersection(mapped, getIteratee(iteratee, 2))
7612        : [];
7613    });
7614
7615    /**
7616     * This method is like `_.intersection` except that it accepts `comparator`
7617     * which is invoked to compare elements of `arrays`. The order and references
7618     * of result values are determined by the first array. The comparator is
7619     * invoked with two arguments: (arrVal, othVal).
7620     *
7621     * @static
7622     * @memberOf _
7623     * @since 4.0.0
7624     * @category Array
7625     * @param {...Array} [arrays] The arrays to inspect.
7626     * @param {Function} [comparator] The comparator invoked per element.
7627     * @returns {Array} Returns the new array of intersecting values.
7628     * @example
7629     *
7630     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
7631     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
7632     *
7633     * _.intersectionWith(objects, others, _.isEqual);
7634     * // => [{ 'x': 1, 'y': 2 }]
7635     */
7636    var intersectionWith = baseRest(function(arrays) {
7637      var comparator = last(arrays),
7638          mapped = arrayMap(arrays, castArrayLikeObject);
7639
7640      comparator = typeof comparator == 'function' ? comparator : undefined;
7641      if (comparator) {
7642        mapped.pop();
7643      }
7644      return (mapped.length && mapped[0] === arrays[0])
7645        ? baseIntersection(mapped, undefined, comparator)
7646        : [];
7647    });
7648
7649    /**
7650     * Converts all elements in `array` into a string separated by `separator`.
7651     *
7652     * @static
7653     * @memberOf _
7654     * @since 4.0.0
7655     * @category Array
7656     * @param {Array} array The array to convert.
7657     * @param {string} [separator=','] The element separator.
7658     * @returns {string} Returns the joined string.
7659     * @example
7660     *
7661     * _.join(['a', 'b', 'c'], '~');
7662     * // => 'a~b~c'
7663     */
7664    function join(array, separator) {
7665      return array == null ? '' : nativeJoin.call(array, separator);
7666    }
7667
7668    /**
7669     * Gets the last element of `array`.
7670     *
7671     * @static
7672     * @memberOf _
7673     * @since 0.1.0
7674     * @category Array
7675     * @param {Array} array The array to query.
7676     * @returns {*} Returns the last element of `array`.
7677     * @example
7678     *
7679     * _.last([1, 2, 3]);
7680     * // => 3
7681     */
7682    function last(array) {
7683      var length = array == null ? 0 : array.length;
7684      return length ? array[length - 1] : undefined;
7685    }
7686
7687    /**
7688     * This method is like `_.indexOf` except that it iterates over elements of
7689     * `array` from right to left.
7690     *
7691     * @static
7692     * @memberOf _
7693     * @since 0.1.0
7694     * @category Array
7695     * @param {Array} array The array to inspect.
7696     * @param {*} value The value to search for.
7697     * @param {number} [fromIndex=array.length-1] The index to search from.
7698     * @returns {number} Returns the index of the matched value, else `-1`.
7699     * @example
7700     *
7701     * _.lastIndexOf([1, 2, 1, 2], 2);
7702     * // => 3
7703     *
7704     * // Search from the `fromIndex`.
7705     * _.lastIndexOf([1, 2, 1, 2], 2, 2);
7706     * // => 1
7707     */
7708    function lastIndexOf(array, value, fromIndex) {
7709      var length = array == null ? 0 : array.length;
7710      if (!length) {
7711        return -1;
7712      }
7713      var index = length;
7714      if (fromIndex !== undefined) {
7715        index = toInteger(fromIndex);
7716        index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
7717      }
7718      return value === value
7719        ? strictLastIndexOf(array, value, index)
7720        : baseFindIndex(array, baseIsNaN, index, true);
7721    }
7722
7723    /**
7724     * Gets the element at index `n` of `array`. If `n` is negative, the nth
7725     * element from the end is returned.
7726     *
7727     * @static
7728     * @memberOf _
7729     * @since 4.11.0
7730     * @category Array
7731     * @param {Array} array The array to query.
7732     * @param {number} [n=0] The index of the element to return.
7733     * @returns {*} Returns the nth element of `array`.
7734     * @example
7735     *
7736     * var array = ['a', 'b', 'c', 'd'];
7737     *
7738     * _.nth(array, 1);
7739     * // => 'b'
7740     *
7741     * _.nth(array, -2);
7742     * // => 'c';
7743     */
7744    function nth(array, n) {
7745      return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
7746    }
7747
7748    /**
7749     * Removes all given values from `array` using
7750     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7751     * for equality comparisons.
7752     *
7753     * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
7754     * to remove elements from an array by predicate.
7755     *
7756     * @static
7757     * @memberOf _
7758     * @since 2.0.0
7759     * @category Array
7760     * @param {Array} array The array to modify.
7761     * @param {...*} [values] The values to remove.
7762     * @returns {Array} Returns `array`.
7763     * @example
7764     *
7765     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
7766     *
7767     * _.pull(array, 'a', 'c');
7768     * console.log(array);
7769     * // => ['b', 'b']
7770     */
7771    var pull = baseRest(pullAll);
7772
7773    /**
7774     * This method is like `_.pull` except that it accepts an array of values to remove.
7775     *
7776     * **Note:** Unlike `_.difference`, this method mutates `array`.
7777     *
7778     * @static
7779     * @memberOf _
7780     * @since 4.0.0
7781     * @category Array
7782     * @param {Array} array The array to modify.
7783     * @param {Array} values The values to remove.
7784     * @returns {Array} Returns `array`.
7785     * @example
7786     *
7787     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
7788     *
7789     * _.pullAll(array, ['a', 'c']);
7790     * console.log(array);
7791     * // => ['b', 'b']
7792     */
7793    function pullAll(array, values) {
7794      return (array && array.length && values && values.length)
7795        ? basePullAll(array, values)
7796        : array;
7797    }
7798
7799    /**
7800     * This method is like `_.pullAll` except that it accepts `iteratee` which is
7801     * invoked for each element of `array` and `values` to generate the criterion
7802     * by which they're compared. The iteratee is invoked with one argument: (value).
7803     *
7804     * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
7805     *
7806     * @static
7807     * @memberOf _
7808     * @since 4.0.0
7809     * @category Array
7810     * @param {Array} array The array to modify.
7811     * @param {Array} values The values to remove.
7812     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7813     * @returns {Array} Returns `array`.
7814     * @example
7815     *
7816     * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
7817     *
7818     * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
7819     * console.log(array);
7820     * // => [{ 'x': 2 }]
7821     */
7822    function pullAllBy(array, values, iteratee) {
7823      return (array && array.length && values && values.length)
7824        ? basePullAll(array, values, getIteratee(iteratee, 2))
7825        : array;
7826    }
7827
7828    /**
7829     * This method is like `_.pullAll` except that it accepts `comparator` which
7830     * is invoked to compare elements of `array` to `values`. The comparator is
7831     * invoked with two arguments: (arrVal, othVal).
7832     *
7833     * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
7834     *
7835     * @static
7836     * @memberOf _
7837     * @since 4.6.0
7838     * @category Array
7839     * @param {Array} array The array to modify.
7840     * @param {Array} values The values to remove.
7841     * @param {Function} [comparator] The comparator invoked per element.
7842     * @returns {Array} Returns `array`.
7843     * @example
7844     *
7845     * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
7846     *
7847     * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
7848     * console.log(array);
7849     * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
7850     */
7851    function pullAllWith(array, values, comparator) {
7852      return (array && array.length && values && values.length)
7853        ? basePullAll(array, values, undefined, comparator)
7854        : array;
7855    }
7856
7857    /**
7858     * Removes elements from `array` corresponding to `indexes` and returns an
7859     * array of removed elements.
7860     *
7861     * **Note:** Unlike `_.at`, this method mutates `array`.
7862     *
7863     * @static
7864     * @memberOf _
7865     * @since 3.0.0
7866     * @category Array
7867     * @param {Array} array The array to modify.
7868     * @param {...(number|number[])} [indexes] The indexes of elements to remove.
7869     * @returns {Array} Returns the new array of removed elements.
7870     * @example
7871     *
7872     * var array = ['a', 'b', 'c', 'd'];
7873     * var pulled = _.pullAt(array, [1, 3]);
7874     *
7875     * console.log(array);
7876     * // => ['a', 'c']
7877     *
7878     * console.log(pulled);
7879     * // => ['b', 'd']
7880     */
7881    var pullAt = flatRest(function(array, indexes) {
7882      var length = array == null ? 0 : array.length,
7883          result = baseAt(array, indexes);
7884
7885      basePullAt(array, arrayMap(indexes, function(index) {
7886        return isIndex(index, length) ? +index : index;
7887      }).sort(compareAscending));
7888
7889      return result;
7890    });
7891
7892    /**
7893     * Removes all elements from `array` that `predicate` returns truthy for
7894     * and returns an array of the removed elements. The predicate is invoked
7895     * with three arguments: (value, index, array).
7896     *
7897     * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
7898     * to pull elements from an array by value.
7899     *
7900     * @static
7901     * @memberOf _
7902     * @since 2.0.0
7903     * @category Array
7904     * @param {Array} array The array to modify.
7905     * @param {Function} [predicate=_.identity] The function invoked per iteration.
7906     * @returns {Array} Returns the new array of removed elements.
7907     * @example
7908     *
7909     * var array = [1, 2, 3, 4];
7910     * var evens = _.remove(array, function(n) {
7911     *   return n % 2 == 0;
7912     * });
7913     *
7914     * console.log(array);
7915     * // => [1, 3]
7916     *
7917     * console.log(evens);
7918     * // => [2, 4]
7919     */
7920    function remove(array, predicate) {
7921      var result = [];
7922      if (!(array && array.length)) {
7923        return result;
7924      }
7925      var index = -1,
7926          indexes = [],
7927          length = array.length;
7928
7929      predicate = getIteratee(predicate, 3);
7930      while (++index < length) {
7931        var value = array[index];
7932        if (predicate(value, index, array)) {
7933          result.push(value);
7934          indexes.push(index);
7935        }
7936      }
7937      basePullAt(array, indexes);
7938      return result;
7939    }
7940
7941    /**
7942     * Reverses `array` so that the first element becomes the last, the second
7943     * element becomes the second to last, and so on.
7944     *
7945     * **Note:** This method mutates `array` and is based on
7946     * [`Array#reverse`](https://mdn.io/Array/reverse).
7947     *
7948     * @static
7949     * @memberOf _
7950     * @since 4.0.0
7951     * @category Array
7952     * @param {Array} array The array to modify.
7953     * @returns {Array} Returns `array`.
7954     * @example
7955     *
7956     * var array = [1, 2, 3];
7957     *
7958     * _.reverse(array);
7959     * // => [3, 2, 1]
7960     *
7961     * console.log(array);
7962     * // => [3, 2, 1]
7963     */
7964    function reverse(array) {
7965      return array == null ? array : nativeReverse.call(array);
7966    }
7967
7968    /**
7969     * Creates a slice of `array` from `start` up to, but not including, `end`.
7970     *
7971     * **Note:** This method is used instead of
7972     * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
7973     * returned.
7974     *
7975     * @static
7976     * @memberOf _
7977     * @since 3.0.0
7978     * @category Array
7979     * @param {Array} array The array to slice.
7980     * @param {number} [start=0] The start position.
7981     * @param {number} [end=array.length] The end position.
7982     * @returns {Array} Returns the slice of `array`.
7983     */
7984    function slice(array, start, end) {
7985      var length = array == null ? 0 : array.length;
7986      if (!length) {
7987        return [];
7988      }
7989      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
7990        start = 0;
7991        end = length;
7992      }
7993      else {
7994        start = start == null ? 0 : toInteger(start);
7995        end = end === undefined ? length : toInteger(end);
7996      }
7997      return baseSlice(array, start, end);
7998    }
7999
8000    /**
8001     * Uses a binary search to determine the lowest index at which `value`
8002     * should be inserted into `array` in order to maintain its sort order.
8003     *
8004     * @static
8005     * @memberOf _
8006     * @since 0.1.0
8007     * @category Array
8008     * @param {Array} array The sorted array to inspect.
8009     * @param {*} value The value to evaluate.
8010     * @returns {number} Returns the index at which `value` should be inserted
8011     *  into `array`.
8012     * @example
8013     *
8014     * _.sortedIndex([30, 50], 40);
8015     * // => 1
8016     */
8017    function sortedIndex(array, value) {
8018      return baseSortedIndex(array, value);
8019    }
8020
8021    /**
8022     * This method is like `_.sortedIndex` except that it accepts `iteratee`
8023     * which is invoked for `value` and each element of `array` to compute their
8024     * sort ranking. The iteratee is invoked with one argument: (value).
8025     *
8026     * @static
8027     * @memberOf _
8028     * @since 4.0.0
8029     * @category Array
8030     * @param {Array} array The sorted array to inspect.
8031     * @param {*} value The value to evaluate.
8032     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8033     * @returns {number} Returns the index at which `value` should be inserted
8034     *  into `array`.
8035     * @example
8036     *
8037     * var objects = [{ 'x': 4 }, { 'x': 5 }];
8038     *
8039     * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
8040     * // => 0
8041     *
8042     * // The `_.property` iteratee shorthand.
8043     * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
8044     * // => 0
8045     */
8046    function sortedIndexBy(array, value, iteratee) {
8047      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
8048    }
8049
8050    /**
8051     * This method is like `_.indexOf` except that it performs a binary
8052     * search on a sorted `array`.
8053     *
8054     * @static
8055     * @memberOf _
8056     * @since 4.0.0
8057     * @category Array
8058     * @param {Array} array The array to inspect.
8059     * @param {*} value The value to search for.
8060     * @returns {number} Returns the index of the matched value, else `-1`.
8061     * @example
8062     *
8063     * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
8064     * // => 1
8065     */
8066    function sortedIndexOf(array, value) {
8067      var length = array == null ? 0 : array.length;
8068      if (length) {
8069        var index = baseSortedIndex(array, value);
8070        if (index < length && eq(array[index], value)) {
8071          return index;
8072        }
8073      }
8074      return -1;
8075    }
8076
8077    /**
8078     * This method is like `_.sortedIndex` except that it returns the highest
8079     * index at which `value` should be inserted into `array` in order to
8080     * maintain its sort order.
8081     *
8082     * @static
8083     * @memberOf _
8084     * @since 3.0.0
8085     * @category Array
8086     * @param {Array} array The sorted array to inspect.
8087     * @param {*} value The value to evaluate.
8088     * @returns {number} Returns the index at which `value` should be inserted
8089     *  into `array`.
8090     * @example
8091     *
8092     * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
8093     * // => 4
8094     */
8095    function sortedLastIndex(array, value) {
8096      return baseSortedIndex(array, value, true);
8097    }
8098
8099    /**
8100     * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
8101     * which is invoked for `value` and each element of `array` to compute their
8102     * sort ranking. The iteratee is invoked with one argument: (value).
8103     *
8104     * @static
8105     * @memberOf _
8106     * @since 4.0.0
8107     * @category Array
8108     * @param {Array} array The sorted array to inspect.
8109     * @param {*} value The value to evaluate.
8110     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8111     * @returns {number} Returns the index at which `value` should be inserted
8112     *  into `array`.
8113     * @example
8114     *
8115     * var objects = [{ 'x': 4 }, { 'x': 5 }];
8116     *
8117     * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
8118     * // => 1
8119     *
8120     * // The `_.property` iteratee shorthand.
8121     * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
8122     * // => 1
8123     */
8124    function sortedLastIndexBy(array, value, iteratee) {
8125      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
8126    }
8127
8128    /**
8129     * This method is like `_.lastIndexOf` except that it performs a binary
8130     * search on a sorted `array`.
8131     *
8132     * @static
8133     * @memberOf _
8134     * @since 4.0.0
8135     * @category Array
8136     * @param {Array} array The array to inspect.
8137     * @param {*} value The value to search for.
8138     * @returns {number} Returns the index of the matched value, else `-1`.
8139     * @example
8140     *
8141     * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
8142     * // => 3
8143     */
8144    function sortedLastIndexOf(array, value) {
8145      var length = array == null ? 0 : array.length;
8146      if (length) {
8147        var index = baseSortedIndex(array, value, true) - 1;
8148        if (eq(array[index], value)) {
8149          return index;
8150        }
8151      }
8152      return -1;
8153    }
8154
8155    /**
8156     * This method is like `_.uniq` except that it's designed and optimized
8157     * for sorted arrays.
8158     *
8159     * @static
8160     * @memberOf _
8161     * @since 4.0.0
8162     * @category Array
8163     * @param {Array} array The array to inspect.
8164     * @returns {Array} Returns the new duplicate free array.
8165     * @example
8166     *
8167     * _.sortedUniq([1, 1, 2]);
8168     * // => [1, 2]
8169     */
8170    function sortedUniq(array) {
8171      return (array && array.length)
8172        ? baseSortedUniq(array)
8173        : [];
8174    }
8175
8176    /**
8177     * This method is like `_.uniqBy` except that it's designed and optimized
8178     * for sorted arrays.
8179     *
8180     * @static
8181     * @memberOf _
8182     * @since 4.0.0
8183     * @category Array
8184     * @param {Array} array The array to inspect.
8185     * @param {Function} [iteratee] The iteratee invoked per element.
8186     * @returns {Array} Returns the new duplicate free array.
8187     * @example
8188     *
8189     * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
8190     * // => [1.1, 2.3]
8191     */
8192    function sortedUniqBy(array, iteratee) {
8193      return (array && array.length)
8194        ? baseSortedUniq(array, getIteratee(iteratee, 2))
8195        : [];
8196    }
8197
8198    /**
8199     * Gets all but the first element of `array`.
8200     *
8201     * @static
8202     * @memberOf _
8203     * @since 4.0.0
8204     * @category Array
8205     * @param {Array} array The array to query.
8206     * @returns {Array} Returns the slice of `array`.
8207     * @example
8208     *
8209     * _.tail([1, 2, 3]);
8210     * // => [2, 3]
8211     */
8212    function tail(array) {
8213      var length = array == null ? 0 : array.length;
8214      return length ? baseSlice(array, 1, length) : [];
8215    }
8216
8217    /**
8218     * Creates a slice of `array` with `n` elements taken from the beginning.
8219     *
8220     * @static
8221     * @memberOf _
8222     * @since 0.1.0
8223     * @category Array
8224     * @param {Array} array The array to query.
8225     * @param {number} [n=1] The number of elements to take.
8226     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8227     * @returns {Array} Returns the slice of `array`.
8228     * @example
8229     *
8230     * _.take([1, 2, 3]);
8231     * // => [1]
8232     *
8233     * _.take([1, 2, 3], 2);
8234     * // => [1, 2]
8235     *
8236     * _.take([1, 2, 3], 5);
8237     * // => [1, 2, 3]
8238     *
8239     * _.take([1, 2, 3], 0);
8240     * // => []
8241     */
8242    function take(array, n, guard) {
8243      if (!(array && array.length)) {
8244        return [];
8245      }
8246      n = (guard || n === undefined) ? 1 : toInteger(n);
8247      return baseSlice(array, 0, n < 0 ? 0 : n);
8248    }
8249
8250    /**
8251     * Creates a slice of `array` with `n` elements taken from the end.
8252     *
8253     * @static
8254     * @memberOf _
8255     * @since 3.0.0
8256     * @category Array
8257     * @param {Array} array The array to query.
8258     * @param {number} [n=1] The number of elements to take.
8259     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8260     * @returns {Array} Returns the slice of `array`.
8261     * @example
8262     *
8263     * _.takeRight([1, 2, 3]);
8264     * // => [3]
8265     *
8266     * _.takeRight([1, 2, 3], 2);
8267     * // => [2, 3]
8268     *
8269     * _.takeRight([1, 2, 3], 5);
8270     * // => [1, 2, 3]
8271     *
8272     * _.takeRight([1, 2, 3], 0);
8273     * // => []
8274     */
8275    function takeRight(array, n, guard) {
8276      var length = array == null ? 0 : array.length;
8277      if (!length) {
8278        return [];
8279      }
8280      n = (guard || n === undefined) ? 1 : toInteger(n);
8281      n = length - n;
8282      return baseSlice(array, n < 0 ? 0 : n, length);
8283    }
8284
8285    /**
8286     * Creates a slice of `array` with elements taken from the end. Elements are
8287     * taken until `predicate` returns falsey. The predicate is invoked with
8288     * three arguments: (value, index, array).
8289     *
8290     * @static
8291     * @memberOf _
8292     * @since 3.0.0
8293     * @category Array
8294     * @param {Array} array The array to query.
8295     * @param {Function} [predicate=_.identity] The function invoked per iteration.
8296     * @returns {Array} Returns the slice of `array`.
8297     * @example
8298     *
8299     * var users = [
8300     *   { 'user': 'barney',  'active': true },
8301     *   { 'user': 'fred',    'active': false },
8302     *   { 'user': 'pebbles', 'active': false }
8303     * ];
8304     *
8305     * _.takeRightWhile(users, function(o) { return !o.active; });
8306     * // => objects for ['fred', 'pebbles']
8307     *
8308     * // The `_.matches` iteratee shorthand.
8309     * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
8310     * // => objects for ['pebbles']
8311     *
8312     * // The `_.matchesProperty` iteratee shorthand.
8313     * _.takeRightWhile(users, ['active', false]);
8314     * // => objects for ['fred', 'pebbles']
8315     *
8316     * // The `_.property` iteratee shorthand.
8317     * _.takeRightWhile(users, 'active');
8318     * // => []
8319     */
8320    function takeRightWhile(array, predicate) {
8321      return (array && array.length)
8322        ? baseWhile(array, getIteratee(predicate, 3), false, true)
8323        : [];
8324    }
8325
8326    /**
8327     * Creates a slice of `array` with elements taken from the beginning. Elements
8328     * are taken until `predicate` returns falsey. The predicate is invoked with
8329     * three arguments: (value, index, array).
8330     *
8331     * @static
8332     * @memberOf _
8333     * @since 3.0.0
8334     * @category Array
8335     * @param {Array} array The array to query.
8336     * @param {Function} [predicate=_.identity] The function invoked per iteration.
8337     * @returns {Array} Returns the slice of `array`.
8338     * @example
8339     *
8340     * var users = [
8341     *   { 'user': 'barney',  'active': false },
8342     *   { 'user': 'fred',    'active': false },
8343     *   { 'user': 'pebbles', 'active': true }
8344     * ];
8345     *
8346     * _.takeWhile(users, function(o) { return !o.active; });
8347     * // => objects for ['barney', 'fred']
8348     *
8349     * // The `_.matches` iteratee shorthand.
8350     * _.takeWhile(users, { 'user': 'barney', 'active': false });
8351     * // => objects for ['barney']
8352     *
8353     * // The `_.matchesProperty` iteratee shorthand.
8354     * _.takeWhile(users, ['active', false]);
8355     * // => objects for ['barney', 'fred']
8356     *
8357     * // The `_.property` iteratee shorthand.
8358     * _.takeWhile(users, 'active');
8359     * // => []
8360     */
8361    function takeWhile(array, predicate) {
8362      return (array && array.length)
8363        ? baseWhile(array, getIteratee(predicate, 3))
8364        : [];
8365    }
8366
8367    /**
8368     * Creates an array of unique values, in order, from all given arrays using
8369     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8370     * for equality comparisons.
8371     *
8372     * @static
8373     * @memberOf _
8374     * @since 0.1.0
8375     * @category Array
8376     * @param {...Array} [arrays] The arrays to inspect.
8377     * @returns {Array} Returns the new array of combined values.
8378     * @example
8379     *
8380     * _.union([2], [1, 2]);
8381     * // => [2, 1]
8382     */
8383    var union = baseRest(function(arrays) {
8384      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
8385    });
8386
8387    /**
8388     * This method is like `_.union` except that it accepts `iteratee` which is
8389     * invoked for each element of each `arrays` to generate the criterion by
8390     * which uniqueness is computed. Result values are chosen from the first
8391     * array in which the value occurs. The iteratee is invoked with one argument:
8392     * (value).
8393     *
8394     * @static
8395     * @memberOf _
8396     * @since 4.0.0
8397     * @category Array
8398     * @param {...Array} [arrays] The arrays to inspect.
8399     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8400     * @returns {Array} Returns the new array of combined values.
8401     * @example
8402     *
8403     * _.unionBy([2.1], [1.2, 2.3], Math.floor);
8404     * // => [2.1, 1.2]
8405     *
8406     * // The `_.property` iteratee shorthand.
8407     * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8408     * // => [{ 'x': 1 }, { 'x': 2 }]
8409     */
8410    var unionBy = baseRest(function(arrays) {
8411      var iteratee = last(arrays);
8412      if (isArrayLikeObject(iteratee)) {
8413        iteratee = undefined;
8414      }
8415      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
8416    });
8417
8418    /**
8419     * This method is like `_.union` except that it accepts `comparator` which
8420     * is invoked to compare elements of `arrays`. Result values are chosen from
8421     * the first array in which the value occurs. The comparator is invoked
8422     * with two arguments: (arrVal, othVal).
8423     *
8424     * @static
8425     * @memberOf _
8426     * @since 4.0.0
8427     * @category Array
8428     * @param {...Array} [arrays] The arrays to inspect.
8429     * @param {Function} [comparator] The comparator invoked per element.
8430     * @returns {Array} Returns the new array of combined values.
8431     * @example
8432     *
8433     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8434     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8435     *
8436     * _.unionWith(objects, others, _.isEqual);
8437     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
8438     */
8439    var unionWith = baseRest(function(arrays) {
8440      var comparator = last(arrays);
8441      comparator = typeof comparator == 'function' ? comparator : undefined;
8442      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
8443    });
8444
8445    /**
8446     * Creates a duplicate-free version of an array, using
8447     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8448     * for equality comparisons, in which only the first occurrence of each element
8449     * is kept. The order of result values is determined by the order they occur
8450     * in the array.
8451     *
8452     * @static
8453     * @memberOf _
8454     * @since 0.1.0
8455     * @category Array
8456     * @param {Array} array The array to inspect.
8457     * @returns {Array} Returns the new duplicate free array.
8458     * @example
8459     *
8460     * _.uniq([2, 1, 2]);
8461     * // => [2, 1]
8462     */
8463    function uniq(array) {
8464      return (array && array.length) ? baseUniq(array) : [];
8465    }
8466
8467    /**
8468     * This method is like `_.uniq` except that it accepts `iteratee` which is
8469     * invoked for each element in `array` to generate the criterion by which
8470     * uniqueness is computed. The order of result values is determined by the
8471     * order they occur in the array. The iteratee is invoked with one argument:
8472     * (value).
8473     *
8474     * @static
8475     * @memberOf _
8476     * @since 4.0.0
8477     * @category Array
8478     * @param {Array} array The array to inspect.
8479     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8480     * @returns {Array} Returns the new duplicate free array.
8481     * @example
8482     *
8483     * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
8484     * // => [2.1, 1.2]
8485     *
8486     * // The `_.property` iteratee shorthand.
8487     * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
8488     * // => [{ 'x': 1 }, { 'x': 2 }]
8489     */
8490    function uniqBy(array, iteratee) {
8491      return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
8492    }
8493
8494    /**
8495     * This method is like `_.uniq` except that it accepts `comparator` which
8496     * is invoked to compare elements of `array`. The order of result values is
8497     * determined by the order they occur in the array.The comparator is invoked
8498     * with two arguments: (arrVal, othVal).
8499     *
8500     * @static
8501     * @memberOf _
8502     * @since 4.0.0
8503     * @category Array
8504     * @param {Array} array The array to inspect.
8505     * @param {Function} [comparator] The comparator invoked per element.
8506     * @returns {Array} Returns the new duplicate free array.
8507     * @example
8508     *
8509     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
8510     *
8511     * _.uniqWith(objects, _.isEqual);
8512     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
8513     */
8514    function uniqWith(array, comparator) {
8515      comparator = typeof comparator == 'function' ? comparator : undefined;
8516      return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
8517    }
8518
8519    /**
8520     * This method is like `_.zip` except that it accepts an array of grouped
8521     * elements and creates an array regrouping the elements to their pre-zip
8522     * configuration.
8523     *
8524     * @static
8525     * @memberOf _
8526     * @since 1.2.0
8527     * @category Array
8528     * @param {Array} array The array of grouped elements to process.
8529     * @returns {Array} Returns the new array of regrouped elements.
8530     * @example
8531     *
8532     * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
8533     * // => [['a', 1, true], ['b', 2, false]]
8534     *
8535     * _.unzip(zipped);
8536     * // => [['a', 'b'], [1, 2], [true, false]]
8537     */
8538    function unzip(array) {
8539      if (!(array && array.length)) {
8540        return [];
8541      }
8542      var length = 0;
8543      array = arrayFilter(array, function(group) {
8544        if (isArrayLikeObject(group)) {
8545          length = nativeMax(group.length, length);
8546          return true;
8547        }
8548      });
8549      return baseTimes(length, function(index) {
8550        return arrayMap(array, baseProperty(index));
8551      });
8552    }
8553
8554    /**
8555     * This method is like `_.unzip` except that it accepts `iteratee` to specify
8556     * how regrouped values should be combined. The iteratee is invoked with the
8557     * elements of each group: (...group).
8558     *
8559     * @static
8560     * @memberOf _
8561     * @since 3.8.0
8562     * @category Array
8563     * @param {Array} array The array of grouped elements to process.
8564     * @param {Function} [iteratee=_.identity] The function to combine
8565     *  regrouped values.
8566     * @returns {Array} Returns the new array of regrouped elements.
8567     * @example
8568     *
8569     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
8570     * // => [[1, 10, 100], [2, 20, 200]]
8571     *
8572     * _.unzipWith(zipped, _.add);
8573     * // => [3, 30, 300]
8574     */
8575    function unzipWith(array, iteratee) {
8576      if (!(array && array.length)) {
8577        return [];
8578      }
8579      var result = unzip(array);
8580      if (iteratee == null) {
8581        return result;
8582      }
8583      return arrayMap(result, function(group) {
8584        return apply(iteratee, undefined, group);
8585      });
8586    }
8587
8588    /**
8589     * Creates an array excluding all given values using
8590     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8591     * for equality comparisons.
8592     *
8593     * **Note:** Unlike `_.pull`, this method returns a new array.
8594     *
8595     * @static
8596     * @memberOf _
8597     * @since 0.1.0
8598     * @category Array
8599     * @param {Array} array The array to inspect.
8600     * @param {...*} [values] The values to exclude.
8601     * @returns {Array} Returns the new array of filtered values.
8602     * @see _.difference, _.xor
8603     * @example
8604     *
8605     * _.without([2, 1, 2, 3], 1, 2);
8606     * // => [3]
8607     */
8608    var without = baseRest(function(array, values) {
8609      return isArrayLikeObject(array)
8610        ? baseDifference(array, values)
8611        : [];
8612    });
8613
8614    /**
8615     * Creates an array of unique values that is the
8616     * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
8617     * of the given arrays. The order of result values is determined by the order
8618     * they occur in the arrays.
8619     *
8620     * @static
8621     * @memberOf _
8622     * @since 2.4.0
8623     * @category Array
8624     * @param {...Array} [arrays] The arrays to inspect.
8625     * @returns {Array} Returns the new array of filtered values.
8626     * @see _.difference, _.without
8627     * @example
8628     *
8629     * _.xor([2, 1], [2, 3]);
8630     * // => [1, 3]
8631     */
8632    var xor = baseRest(function(arrays) {
8633      return baseXor(arrayFilter(arrays, isArrayLikeObject));
8634    });
8635
8636    /**
8637     * This method is like `_.xor` except that it accepts `iteratee` which is
8638     * invoked for each element of each `arrays` to generate the criterion by
8639     * which by which they're compared. The order of result values is determined
8640     * by the order they occur in the arrays. The iteratee is invoked with one
8641     * argument: (value).
8642     *
8643     * @static
8644     * @memberOf _
8645     * @since 4.0.0
8646     * @category Array
8647     * @param {...Array} [arrays] The arrays to inspect.
8648     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8649     * @returns {Array} Returns the new array of filtered values.
8650     * @example
8651     *
8652     * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
8653     * // => [1.2, 3.4]
8654     *
8655     * // The `_.property` iteratee shorthand.
8656     * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8657     * // => [{ 'x': 2 }]
8658     */
8659    var xorBy = baseRest(function(arrays) {
8660      var iteratee = last(arrays);
8661      if (isArrayLikeObject(iteratee)) {
8662        iteratee = undefined;
8663      }
8664      return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
8665    });
8666
8667    /**
8668     * This method is like `_.xor` except that it accepts `comparator` which is
8669     * invoked to compare elements of `arrays`. The order of result values is
8670     * determined by the order they occur in the arrays. The comparator is invoked
8671     * with two arguments: (arrVal, othVal).
8672     *
8673     * @static
8674     * @memberOf _
8675     * @since 4.0.0
8676     * @category Array
8677     * @param {...Array} [arrays] The arrays to inspect.
8678     * @param {Function} [comparator] The comparator invoked per element.
8679     * @returns {Array} Returns the new array of filtered values.
8680     * @example
8681     *
8682     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8683     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8684     *
8685     * _.xorWith(objects, others, _.isEqual);
8686     * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
8687     */
8688    var xorWith = baseRest(function(arrays) {
8689      var comparator = last(arrays);
8690      comparator = typeof comparator == 'function' ? comparator : undefined;
8691      return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
8692    });
8693
8694    /**
8695     * Creates an array of grouped elements, the first of which contains the
8696     * first elements of the given arrays, the second of which contains the
8697     * second elements of the given arrays, and so on.
8698     *
8699     * @static
8700     * @memberOf _
8701     * @since 0.1.0
8702     * @category Array
8703     * @param {...Array} [arrays] The arrays to process.
8704     * @returns {Array} Returns the new array of grouped elements.
8705     * @example
8706     *
8707     * _.zip(['a', 'b'], [1, 2], [true, false]);
8708     * // => [['a', 1, true], ['b', 2, false]]
8709     */
8710    var zip = baseRest(unzip);
8711
8712    /**
8713     * This method is like `_.fromPairs` except that it accepts two arrays,
8714     * one of property identifiers and one of corresponding values.
8715     *
8716     * @static
8717     * @memberOf _
8718     * @since 0.4.0
8719     * @category Array
8720     * @param {Array} [props=[]] The property identifiers.
8721     * @param {Array} [values=[]] The property values.
8722     * @returns {Object} Returns the new object.
8723     * @example
8724     *
8725     * _.zipObject(['a', 'b'], [1, 2]);
8726     * // => { 'a': 1, 'b': 2 }
8727     */
8728    function zipObject(props, values) {
8729      return baseZipObject(props || [], values || [], assignValue);
8730    }
8731
8732    /**
8733     * This method is like `_.zipObject` except that it supports property paths.
8734     *
8735     * @static
8736     * @memberOf _
8737     * @since 4.1.0
8738     * @category Array
8739     * @param {Array} [props=[]] The property identifiers.
8740     * @param {Array} [values=[]] The property values.
8741     * @returns {Object} Returns the new object.
8742     * @example
8743     *
8744     * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
8745     * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
8746     */
8747    function zipObjectDeep(props, values) {
8748      return baseZipObject(props || [], values || [], baseSet);
8749    }
8750
8751    /**
8752     * This method is like `_.zip` except that it accepts `iteratee` to specify
8753     * how grouped values should be combined. The iteratee is invoked with the
8754     * elements of each group: (...group).
8755     *
8756     * @static
8757     * @memberOf _
8758     * @since 3.8.0
8759     * @category Array
8760     * @param {...Array} [arrays] The arrays to process.
8761     * @param {Function} [iteratee=_.identity] The function to combine
8762     *  grouped values.
8763     * @returns {Array} Returns the new array of grouped elements.
8764     * @example
8765     *
8766     * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
8767     *   return a + b + c;
8768     * });
8769     * // => [111, 222]
8770     */
8771    var zipWith = baseRest(function(arrays) {
8772      var length = arrays.length,
8773          iteratee = length > 1 ? arrays[length - 1] : undefined;
8774
8775      iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
8776      return unzipWith(arrays, iteratee);
8777    });
8778
8779    /*------------------------------------------------------------------------*/
8780
8781    /**
8782     * Creates a `lodash` wrapper instance that wraps `value` with explicit method
8783     * chain sequences enabled. The result of such sequences must be unwrapped
8784     * with `_#value`.
8785     *
8786     * @static
8787     * @memberOf _
8788     * @since 1.3.0
8789     * @category Seq
8790     * @param {*} value The value to wrap.
8791     * @returns {Object} Returns the new `lodash` wrapper instance.
8792     * @example
8793     *
8794     * var users = [
8795     *   { 'user': 'barney',  'age': 36 },
8796     *   { 'user': 'fred',    'age': 40 },
8797     *   { 'user': 'pebbles', 'age': 1 }
8798     * ];
8799     *
8800     * var youngest = _
8801     *   .chain(users)
8802     *   .sortBy('age')
8803     *   .map(function(o) {
8804     *     return o.user + ' is ' + o.age;
8805     *   })
8806     *   .head()
8807     *   .value();
8808     * // => 'pebbles is 1'
8809     */
8810    function chain(value) {
8811      var result = lodash(value);
8812      result.__chain__ = true;
8813      return result;
8814    }
8815
8816    /**
8817     * This method invokes `interceptor` and returns `value`. The interceptor
8818     * is invoked with one argument; (value). The purpose of this method is to
8819     * "tap into" a method chain sequence in order to modify intermediate results.
8820     *
8821     * @static
8822     * @memberOf _
8823     * @since 0.1.0
8824     * @category Seq
8825     * @param {*} value The value to provide to `interceptor`.
8826     * @param {Function} interceptor The function to invoke.
8827     * @returns {*} Returns `value`.
8828     * @example
8829     *
8830     * _([1, 2, 3])
8831     *  .tap(function(array) {
8832     *    // Mutate input array.
8833     *    array.pop();
8834     *  })
8835     *  .reverse()
8836     *  .value();
8837     * // => [2, 1]
8838     */
8839    function tap(value, interceptor) {
8840      interceptor(value);
8841      return value;
8842    }
8843
8844    /**
8845     * This method is like `_.tap` except that it returns the result of `interceptor`.
8846     * The purpose of this method is to "pass thru" values replacing intermediate
8847     * results in a method chain sequence.
8848     *
8849     * @static
8850     * @memberOf _
8851     * @since 3.0.0
8852     * @category Seq
8853     * @param {*} value The value to provide to `interceptor`.
8854     * @param {Function} interceptor The function to invoke.
8855     * @returns {*} Returns the result of `interceptor`.
8856     * @example
8857     *
8858     * _('  abc  ')
8859     *  .chain()
8860     *  .trim()
8861     *  .thru(function(value) {
8862     *    return [value];
8863     *  })
8864     *  .value();
8865     * // => ['abc']
8866     */
8867    function thru(value, interceptor) {
8868      return interceptor(value);
8869    }
8870
8871    /**
8872     * This method is the wrapper version of `_.at`.
8873     *
8874     * @name at
8875     * @memberOf _
8876     * @since 1.0.0
8877     * @category Seq
8878     * @param {...(string|string[])} [paths] The property paths to pick.
8879     * @returns {Object} Returns the new `lodash` wrapper instance.
8880     * @example
8881     *
8882     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
8883     *
8884     * _(object).at(['a[0].b.c', 'a[1]']).value();
8885     * // => [3, 4]
8886     */
8887    var wrapperAt = flatRest(function(paths) {
8888      var length = paths.length,
8889          start = length ? paths[0] : 0,
8890          value = this.__wrapped__,
8891          interceptor = function(object) { return baseAt(object, paths); };
8892
8893      if (length > 1 || this.__actions__.length ||
8894          !(value instanceof LazyWrapper) || !isIndex(start)) {
8895        return this.thru(interceptor);
8896      }
8897      value = value.slice(start, +start + (length ? 1 : 0));
8898      value.__actions__.push({
8899        'func': thru,
8900        'args': [interceptor],
8901        'thisArg': undefined
8902      });
8903      return new LodashWrapper(value, this.__chain__).thru(function(array) {
8904        if (length && !array.length) {
8905          array.push(undefined);
8906        }
8907        return array;
8908      });
8909    });
8910
8911    /**
8912     * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
8913     *
8914     * @name chain
8915     * @memberOf _
8916     * @since 0.1.0
8917     * @category Seq
8918     * @returns {Object} Returns the new `lodash` wrapper instance.
8919     * @example
8920     *
8921     * var users = [
8922     *   { 'user': 'barney', 'age': 36 },
8923     *   { 'user': 'fred',   'age': 40 }
8924     * ];
8925     *
8926     * // A sequence without explicit chaining.
8927     * _(users).head();
8928     * // => { 'user': 'barney', 'age': 36 }
8929     *
8930     * // A sequence with explicit chaining.
8931     * _(users)
8932     *   .chain()
8933     *   .head()
8934     *   .pick('user')
8935     *   .value();
8936     * // => { 'user': 'barney' }
8937     */
8938    function wrapperChain() {
8939      return chain(this);
8940    }
8941
8942    /**
8943     * Executes the chain sequence and returns the wrapped result.
8944     *
8945     * @name commit
8946     * @memberOf _
8947     * @since 3.2.0
8948     * @category Seq
8949     * @returns {Object} Returns the new `lodash` wrapper instance.
8950     * @example
8951     *
8952     * var array = [1, 2];
8953     * var wrapped = _(array).push(3);
8954     *
8955     * console.log(array);
8956     * // => [1, 2]
8957     *
8958     * wrapped = wrapped.commit();
8959     * console.log(array);
8960     * // => [1, 2, 3]
8961     *
8962     * wrapped.last();
8963     * // => 3
8964     *
8965     * console.log(array);
8966     * // => [1, 2, 3]
8967     */
8968    function wrapperCommit() {
8969      return new LodashWrapper(this.value(), this.__chain__);
8970    }
8971
8972    /**
8973     * Gets the next value on a wrapped object following the
8974     * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
8975     *
8976     * @name next
8977     * @memberOf _
8978     * @since 4.0.0
8979     * @category Seq
8980     * @returns {Object} Returns the next iterator value.
8981     * @example
8982     *
8983     * var wrapped = _([1, 2]);
8984     *
8985     * wrapped.next();
8986     * // => { 'done': false, 'value': 1 }
8987     *
8988     * wrapped.next();
8989     * // => { 'done': false, 'value': 2 }
8990     *
8991     * wrapped.next();
8992     * // => { 'done': true, 'value': undefined }
8993     */
8994    function wrapperNext() {
8995      if (this.__values__ === undefined) {
8996        this.__values__ = toArray(this.value());
8997      }
8998      var done = this.__index__ >= this.__values__.length,
8999          value = done ? undefined : this.__values__[this.__index__++];
9000
9001      return { 'done': done, 'value': value };
9002    }
9003
9004    /**
9005     * Enables the wrapper to be iterable.
9006     *
9007     * @name Symbol.iterator
9008     * @memberOf _
9009     * @since 4.0.0
9010     * @category Seq
9011     * @returns {Object} Returns the wrapper object.
9012     * @example
9013     *
9014     * var wrapped = _([1, 2]);
9015     *
9016     * wrapped[Symbol.iterator]() === wrapped;
9017     * // => true
9018     *
9019     * Array.from(wrapped);
9020     * // => [1, 2]
9021     */
9022    function wrapperToIterator() {
9023      return this;
9024    }
9025
9026    /**
9027     * Creates a clone of the chain sequence planting `value` as the wrapped value.
9028     *
9029     * @name plant
9030     * @memberOf _
9031     * @since 3.2.0
9032     * @category Seq
9033     * @param {*} value The value to plant.
9034     * @returns {Object} Returns the new `lodash` wrapper instance.
9035     * @example
9036     *
9037     * function square(n) {
9038     *   return n * n;
9039     * }
9040     *
9041     * var wrapped = _([1, 2]).map(square);
9042     * var other = wrapped.plant([3, 4]);
9043     *
9044     * other.value();
9045     * // => [9, 16]
9046     *
9047     * wrapped.value();
9048     * // => [1, 4]
9049     */
9050    function wrapperPlant(value) {
9051      var result,
9052          parent = this;
9053
9054      while (parent instanceof baseLodash) {
9055        var clone = wrapperClone(parent);
9056        clone.__index__ = 0;
9057        clone.__values__ = undefined;
9058        if (result) {
9059          previous.__wrapped__ = clone;
9060        } else {
9061          result = clone;
9062        }
9063        var previous = clone;
9064        parent = parent.__wrapped__;
9065      }
9066      previous.__wrapped__ = value;
9067      return result;
9068    }
9069
9070    /**
9071     * This method is the wrapper version of `_.reverse`.
9072     *
9073     * **Note:** This method mutates the wrapped array.
9074     *
9075     * @name reverse
9076     * @memberOf _
9077     * @since 0.1.0
9078     * @category Seq
9079     * @returns {Object} Returns the new `lodash` wrapper instance.
9080     * @example
9081     *
9082     * var array = [1, 2, 3];
9083     *
9084     * _(array).reverse().value()
9085     * // => [3, 2, 1]
9086     *
9087     * console.log(array);
9088     * // => [3, 2, 1]
9089     */
9090    function wrapperReverse() {
9091      var value = this.__wrapped__;
9092      if (value instanceof LazyWrapper) {
9093        var wrapped = value;
9094        if (this.__actions__.length) {
9095          wrapped = new LazyWrapper(this);
9096        }
9097        wrapped = wrapped.reverse();
9098        wrapped.__actions__.push({
9099          'func': thru,
9100          'args': [reverse],
9101          'thisArg': undefined
9102        });
9103        return new LodashWrapper(wrapped, this.__chain__);
9104      }
9105      return this.thru(reverse);
9106    }
9107
9108    /**
9109     * Executes the chain sequence to resolve the unwrapped value.
9110     *
9111     * @name value
9112     * @memberOf _
9113     * @since 0.1.0
9114     * @alias toJSON, valueOf
9115     * @category Seq
9116     * @returns {*} Returns the resolved unwrapped value.
9117     * @example
9118     *
9119     * _([1, 2, 3]).value();
9120     * // => [1, 2, 3]
9121     */
9122    function wrapperValue() {
9123      return baseWrapperValue(this.__wrapped__, this.__actions__);
9124    }
9125
9126    /*------------------------------------------------------------------------*/
9127
9128    /**
9129     * Creates an object composed of keys generated from the results of running
9130     * each element of `collection` thru `iteratee`. The corresponding value of
9131     * each key is the number of times the key was returned by `iteratee`. The
9132     * iteratee is invoked with one argument: (value).
9133     *
9134     * @static
9135     * @memberOf _
9136     * @since 0.5.0
9137     * @category Collection
9138     * @param {Array|Object} collection The collection to iterate over.
9139     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9140     * @returns {Object} Returns the composed aggregate object.
9141     * @example
9142     *
9143     * _.countBy([6.1, 4.2, 6.3], Math.floor);
9144     * // => { '4': 1, '6': 2 }
9145     *
9146     * // The `_.property` iteratee shorthand.
9147     * _.countBy(['one', 'two', 'three'], 'length');
9148     * // => { '3': 2, '5': 1 }
9149     */
9150    var countBy = createAggregator(function(result, value, key) {
9151      if (hasOwnProperty.call(result, key)) {
9152        ++result[key];
9153      } else {
9154        baseAssignValue(result, key, 1);
9155      }
9156    });
9157
9158    /**
9159     * Checks if `predicate` returns truthy for **all** elements of `collection`.
9160     * Iteration is stopped once `predicate` returns falsey. The predicate is
9161     * invoked with three arguments: (value, index|key, collection).
9162     *
9163     * **Note:** This method returns `true` for
9164     * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
9165     * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
9166     * elements of empty collections.
9167     *
9168     * @static
9169     * @memberOf _
9170     * @since 0.1.0
9171     * @category Collection
9172     * @param {Array|Object} collection The collection to iterate over.
9173     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9174     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9175     * @returns {boolean} Returns `true` if all elements pass the predicate check,
9176     *  else `false`.
9177     * @example
9178     *
9179     * _.every([true, 1, null, 'yes'], Boolean);
9180     * // => false
9181     *
9182     * var users = [
9183     *   { 'user': 'barney', 'age': 36, 'active': false },
9184     *   { 'user': 'fred',   'age': 40, 'active': false }
9185     * ];
9186     *
9187     * // The `_.matches` iteratee shorthand.
9188     * _.every(users, { 'user': 'barney', 'active': false });
9189     * // => false
9190     *
9191     * // The `_.matchesProperty` iteratee shorthand.
9192     * _.every(users, ['active', false]);
9193     * // => true
9194     *
9195     * // The `_.property` iteratee shorthand.
9196     * _.every(users, 'active');
9197     * // => false
9198     */
9199    function every(collection, predicate, guard) {
9200      var func = isArray(collection) ? arrayEvery : baseEvery;
9201      if (guard && isIterateeCall(collection, predicate, guard)) {
9202        predicate = undefined;
9203      }
9204      return func(collection, getIteratee(predicate, 3));
9205    }
9206
9207    /**
9208     * Iterates over elements of `collection`, returning an array of all elements
9209     * `predicate` returns truthy for. The predicate is invoked with three
9210     * arguments: (value, index|key, collection).
9211     *
9212     * **Note:** Unlike `_.remove`, this method returns a new array.
9213     *
9214     * @static
9215     * @memberOf _
9216     * @since 0.1.0
9217     * @category Collection
9218     * @param {Array|Object} collection The collection to iterate over.
9219     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9220     * @returns {Array} Returns the new filtered array.
9221     * @see _.reject
9222     * @example
9223     *
9224     * var users = [
9225     *   { 'user': 'barney', 'age': 36, 'active': true },
9226     *   { 'user': 'fred',   'age': 40, 'active': false }
9227     * ];
9228     *
9229     * _.filter(users, function(o) { return !o.active; });
9230     * // => objects for ['fred']
9231     *
9232     * // The `_.matches` iteratee shorthand.
9233     * _.filter(users, { 'age': 36, 'active': true });
9234     * // => objects for ['barney']
9235     *
9236     * // The `_.matchesProperty` iteratee shorthand.
9237     * _.filter(users, ['active', false]);
9238     * // => objects for ['fred']
9239     *
9240     * // The `_.property` iteratee shorthand.
9241     * _.filter(users, 'active');
9242     * // => objects for ['barney']
9243     *
9244     * // Combining several predicates using `_.overEvery` or `_.overSome`.
9245     * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
9246     * // => objects for ['fred', 'barney']
9247     */
9248    function filter(collection, predicate) {
9249      var func = isArray(collection) ? arrayFilter : baseFilter;
9250      return func(collection, getIteratee(predicate, 3));
9251    }
9252
9253    /**
9254     * Iterates over elements of `collection`, returning the first element
9255     * `predicate` returns truthy for. The predicate is invoked with three
9256     * arguments: (value, index|key, collection).
9257     *
9258     * @static
9259     * @memberOf _
9260     * @since 0.1.0
9261     * @category Collection
9262     * @param {Array|Object} collection The collection to inspect.
9263     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9264     * @param {number} [fromIndex=0] The index to search from.
9265     * @returns {*} Returns the matched element, else `undefined`.
9266     * @example
9267     *
9268     * var users = [
9269     *   { 'user': 'barney',  'age': 36, 'active': true },
9270     *   { 'user': 'fred',    'age': 40, 'active': false },
9271     *   { 'user': 'pebbles', 'age': 1,  'active': true }
9272     * ];
9273     *
9274     * _.find(users, function(o) { return o.age < 40; });
9275     * // => object for 'barney'
9276     *
9277     * // The `_.matches` iteratee shorthand.
9278     * _.find(users, { 'age': 1, 'active': true });
9279     * // => object for 'pebbles'
9280     *
9281     * // The `_.matchesProperty` iteratee shorthand.
9282     * _.find(users, ['active', false]);
9283     * // => object for 'fred'
9284     *
9285     * // The `_.property` iteratee shorthand.
9286     * _.find(users, 'active');
9287     * // => object for 'barney'
9288     */
9289    var find = createFind(findIndex);
9290
9291    /**
9292     * This method is like `_.find` except that it iterates over elements of
9293     * `collection` from right to left.
9294     *
9295     * @static
9296     * @memberOf _
9297     * @since 2.0.0
9298     * @category Collection
9299     * @param {Array|Object} collection The collection to inspect.
9300     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9301     * @param {number} [fromIndex=collection.length-1] The index to search from.
9302     * @returns {*} Returns the matched element, else `undefined`.
9303     * @example
9304     *
9305     * _.findLast([1, 2, 3, 4], function(n) {
9306     *   return n % 2 == 1;
9307     * });
9308     * // => 3
9309     */
9310    var findLast = createFind(findLastIndex);
9311
9312    /**
9313     * Creates a flattened array of values by running each element in `collection`
9314     * thru `iteratee` and flattening the mapped results. The iteratee is invoked
9315     * with three arguments: (value, index|key, collection).
9316     *
9317     * @static
9318     * @memberOf _
9319     * @since 4.0.0
9320     * @category Collection
9321     * @param {Array|Object} collection The collection to iterate over.
9322     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9323     * @returns {Array} Returns the new flattened array.
9324     * @example
9325     *
9326     * function duplicate(n) {
9327     *   return [n, n];
9328     * }
9329     *
9330     * _.flatMap([1, 2], duplicate);
9331     * // => [1, 1, 2, 2]
9332     */
9333    function flatMap(collection, iteratee) {
9334      return baseFlatten(map(collection, iteratee), 1);
9335    }
9336
9337    /**
9338     * This method is like `_.flatMap` except that it recursively flattens the
9339     * mapped results.
9340     *
9341     * @static
9342     * @memberOf _
9343     * @since 4.7.0
9344     * @category Collection
9345     * @param {Array|Object} collection The collection to iterate over.
9346     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9347     * @returns {Array} Returns the new flattened array.
9348     * @example
9349     *
9350     * function duplicate(n) {
9351     *   return [[[n, n]]];
9352     * }
9353     *
9354     * _.flatMapDeep([1, 2], duplicate);
9355     * // => [1, 1, 2, 2]
9356     */
9357    function flatMapDeep(collection, iteratee) {
9358      return baseFlatten(map(collection, iteratee), INFINITY);
9359    }
9360
9361    /**
9362     * This method is like `_.flatMap` except that it recursively flattens the
9363     * mapped results up to `depth` times.
9364     *
9365     * @static
9366     * @memberOf _
9367     * @since 4.7.0
9368     * @category Collection
9369     * @param {Array|Object} collection The collection to iterate over.
9370     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9371     * @param {number} [depth=1] The maximum recursion depth.
9372     * @returns {Array} Returns the new flattened array.
9373     * @example
9374     *
9375     * function duplicate(n) {
9376     *   return [[[n, n]]];
9377     * }
9378     *
9379     * _.flatMapDepth([1, 2], duplicate, 2);
9380     * // => [[1, 1], [2, 2]]
9381     */
9382    function flatMapDepth(collection, iteratee, depth) {
9383      depth = depth === undefined ? 1 : toInteger(depth);
9384      return baseFlatten(map(collection, iteratee), depth);
9385    }
9386
9387    /**
9388     * Iterates over elements of `collection` and invokes `iteratee` for each element.
9389     * The iteratee is invoked with three arguments: (value, index|key, collection).
9390     * Iteratee functions may exit iteration early by explicitly returning `false`.
9391     *
9392     * **Note:** As with other "Collections" methods, objects with a "length"
9393     * property are iterated like arrays. To avoid this behavior use `_.forIn`
9394     * or `_.forOwn` for object iteration.
9395     *
9396     * @static
9397     * @memberOf _
9398     * @since 0.1.0
9399     * @alias each
9400     * @category Collection
9401     * @param {Array|Object} collection The collection to iterate over.
9402     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9403     * @returns {Array|Object} Returns `collection`.
9404     * @see _.forEachRight
9405     * @example
9406     *
9407     * _.forEach([1, 2], function(value) {
9408     *   console.log(value);
9409     * });
9410     * // => Logs `1` then `2`.
9411     *
9412     * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
9413     *   console.log(key);
9414     * });
9415     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
9416     */
9417    function forEach(collection, iteratee) {
9418      var func = isArray(collection) ? arrayEach : baseEach;
9419      return func(collection, getIteratee(iteratee, 3));
9420    }
9421
9422    /**
9423     * This method is like `_.forEach` except that it iterates over elements of
9424     * `collection` from right to left.
9425     *
9426     * @static
9427     * @memberOf _
9428     * @since 2.0.0
9429     * @alias eachRight
9430     * @category Collection
9431     * @param {Array|Object} collection The collection to iterate over.
9432     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9433     * @returns {Array|Object} Returns `collection`.
9434     * @see _.forEach
9435     * @example
9436     *
9437     * _.forEachRight([1, 2], function(value) {
9438     *   console.log(value);
9439     * });
9440     * // => Logs `2` then `1`.
9441     */
9442    function forEachRight(collection, iteratee) {
9443      var func = isArray(collection) ? arrayEachRight : baseEachRight;
9444      return func(collection, getIteratee(iteratee, 3));
9445    }
9446
9447    /**
9448     * Creates an object composed of keys generated from the results of running
9449     * each element of `collection` thru `iteratee`. The order of grouped values
9450     * is determined by the order they occur in `collection`. The corresponding
9451     * value of each key is an array of elements responsible for generating the
9452     * key. The iteratee is invoked with one argument: (value).
9453     *
9454     * @static
9455     * @memberOf _
9456     * @since 0.1.0
9457     * @category Collection
9458     * @param {Array|Object} collection The collection to iterate over.
9459     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9460     * @returns {Object} Returns the composed aggregate object.
9461     * @example
9462     *
9463     * _.groupBy([6.1, 4.2, 6.3], Math.floor);
9464     * // => { '4': [4.2], '6': [6.1, 6.3] }
9465     *
9466     * // The `_.property` iteratee shorthand.
9467     * _.groupBy(['one', 'two', 'three'], 'length');
9468     * // => { '3': ['one', 'two'], '5': ['three'] }
9469     */
9470    var groupBy = createAggregator(function(result, value, key) {
9471      if (hasOwnProperty.call(result, key)) {
9472        result[key].push(value);
9473      } else {
9474        baseAssignValue(result, key, [value]);
9475      }
9476    });
9477
9478    /**
9479     * Checks if `value` is in `collection`. If `collection` is a string, it's
9480     * checked for a substring of `value`, otherwise
9481     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9482     * is used for equality comparisons. If `fromIndex` is negative, it's used as
9483     * the offset from the end of `collection`.
9484     *
9485     * @static
9486     * @memberOf _
9487     * @since 0.1.0
9488     * @category Collection
9489     * @param {Array|Object|string} collection The collection to inspect.
9490     * @param {*} value The value to search for.
9491     * @param {number} [fromIndex=0] The index to search from.
9492     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
9493     * @returns {boolean} Returns `true` if `value` is found, else `false`.
9494     * @example
9495     *
9496     * _.includes([1, 2, 3], 1);
9497     * // => true
9498     *
9499     * _.includes([1, 2, 3], 1, 2);
9500     * // => false
9501     *
9502     * _.includes({ 'a': 1, 'b': 2 }, 1);
9503     * // => true
9504     *
9505     * _.includes('abcd', 'bc');
9506     * // => true
9507     */
9508    function includes(collection, value, fromIndex, guard) {
9509      collection = isArrayLike(collection) ? collection : values(collection);
9510      fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
9511
9512      var length = collection.length;
9513      if (fromIndex < 0) {
9514        fromIndex = nativeMax(length + fromIndex, 0);
9515      }
9516      return isString(collection)
9517        ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
9518        : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
9519    }
9520
9521    /**
9522     * Invokes the method at `path` of each element in `collection`, returning
9523     * an array of the results of each invoked method. Any additional arguments
9524     * are provided to each invoked method. If `path` is a function, it's invoked
9525     * for, and `this` bound to, each element in `collection`.
9526     *
9527     * @static
9528     * @memberOf _
9529     * @since 4.0.0
9530     * @category Collection
9531     * @param {Array|Object} collection The collection to iterate over.
9532     * @param {Array|Function|string} path The path of the method to invoke or
9533     *  the function invoked per iteration.
9534     * @param {...*} [args] The arguments to invoke each method with.
9535     * @returns {Array} Returns the array of results.
9536     * @example
9537     *
9538     * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
9539     * // => [[1, 5, 7], [1, 2, 3]]
9540     *
9541     * _.invokeMap([123, 456], String.prototype.split, '');
9542     * // => [['1', '2', '3'], ['4', '5', '6']]
9543     */
9544    var invokeMap = baseRest(function(collection, path, args) {
9545      var index = -1,
9546          isFunc = typeof path == 'function',
9547          result = isArrayLike(collection) ? Array(collection.length) : [];
9548
9549      baseEach(collection, function(value) {
9550        result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
9551      });
9552      return result;
9553    });
9554
9555    /**
9556     * Creates an object composed of keys generated from the results of running
9557     * each element of `collection` thru `iteratee`. The corresponding value of
9558     * each key is the last element responsible for generating the key. The
9559     * iteratee is invoked with one argument: (value).
9560     *
9561     * @static
9562     * @memberOf _
9563     * @since 4.0.0
9564     * @category Collection
9565     * @param {Array|Object} collection The collection to iterate over.
9566     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9567     * @returns {Object} Returns the composed aggregate object.
9568     * @example
9569     *
9570     * var array = [
9571     *   { 'dir': 'left', 'code': 97 },
9572     *   { 'dir': 'right', 'code': 100 }
9573     * ];
9574     *
9575     * _.keyBy(array, function(o) {
9576     *   return String.fromCharCode(o.code);
9577     * });
9578     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
9579     *
9580     * _.keyBy(array, 'dir');
9581     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
9582     */
9583    var keyBy = createAggregator(function(result, value, key) {
9584      baseAssignValue(result, key, value);
9585    });
9586
9587    /**
9588     * Creates an array of values by running each element in `collection` thru
9589     * `iteratee`. The iteratee is invoked with three arguments:
9590     * (value, index|key, collection).
9591     *
9592     * Many lodash methods are guarded to work as iteratees for methods like
9593     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
9594     *
9595     * The guarded methods are:
9596     * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
9597     * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
9598     * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
9599     * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
9600     *
9601     * @static
9602     * @memberOf _
9603     * @since 0.1.0
9604     * @category Collection
9605     * @param {Array|Object} collection The collection to iterate over.
9606     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9607     * @returns {Array} Returns the new mapped array.
9608     * @example
9609     *
9610     * function square(n) {
9611     *   return n * n;
9612     * }
9613     *
9614     * _.map([4, 8], square);
9615     * // => [16, 64]
9616     *
9617     * _.map({ 'a': 4, 'b': 8 }, square);
9618     * // => [16, 64] (iteration order is not guaranteed)
9619     *
9620     * var users = [
9621     *   { 'user': 'barney' },
9622     *   { 'user': 'fred' }
9623     * ];
9624     *
9625     * // The `_.property` iteratee shorthand.
9626     * _.map(users, 'user');
9627     * // => ['barney', 'fred']
9628     */
9629    function map(collection, iteratee) {
9630      var func = isArray(collection) ? arrayMap : baseMap;
9631      return func(collection, getIteratee(iteratee, 3));
9632    }
9633
9634    /**
9635     * This method is like `_.sortBy` except that it allows specifying the sort
9636     * orders of the iteratees to sort by. If `orders` is unspecified, all values
9637     * are sorted in ascending order. Otherwise, specify an order of "desc" for
9638     * descending or "asc" for ascending sort order of corresponding values.
9639     *
9640     * @static
9641     * @memberOf _
9642     * @since 4.0.0
9643     * @category Collection
9644     * @param {Array|Object} collection The collection to iterate over.
9645     * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
9646     *  The iteratees to sort by.
9647     * @param {string[]} [orders] The sort orders of `iteratees`.
9648     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
9649     * @returns {Array} Returns the new sorted array.
9650     * @example
9651     *
9652     * var users = [
9653     *   { 'user': 'fred',   'age': 48 },
9654     *   { 'user': 'barney', 'age': 34 },
9655     *   { 'user': 'fred',   'age': 40 },
9656     *   { 'user': 'barney', 'age': 36 }
9657     * ];
9658     *
9659     * // Sort by `user` in ascending order and by `age` in descending order.
9660     * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
9661     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
9662     */
9663    function orderBy(collection, iteratees, orders, guard) {
9664      if (collection == null) {
9665        return [];
9666      }
9667      if (!isArray(iteratees)) {
9668        iteratees = iteratees == null ? [] : [iteratees];
9669      }
9670      orders = guard ? undefined : orders;
9671      if (!isArray(orders)) {
9672        orders = orders == null ? [] : [orders];
9673      }
9674      return baseOrderBy(collection, iteratees, orders);
9675    }
9676
9677    /**
9678     * Creates an array of elements split into two groups, the first of which
9679     * contains elements `predicate` returns truthy for, the second of which
9680     * contains elements `predicate` returns falsey for. The predicate is
9681     * invoked with one argument: (value).
9682     *
9683     * @static
9684     * @memberOf _
9685     * @since 3.0.0
9686     * @category Collection
9687     * @param {Array|Object} collection The collection to iterate over.
9688     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9689     * @returns {Array} Returns the array of grouped elements.
9690     * @example
9691     *
9692     * var users = [
9693     *   { 'user': 'barney',  'age': 36, 'active': false },
9694     *   { 'user': 'fred',    'age': 40, 'active': true },
9695     *   { 'user': 'pebbles', 'age': 1,  'active': false }
9696     * ];
9697     *
9698     * _.partition(users, function(o) { return o.active; });
9699     * // => objects for [['fred'], ['barney', 'pebbles']]
9700     *
9701     * // The `_.matches` iteratee shorthand.
9702     * _.partition(users, { 'age': 1, 'active': false });
9703     * // => objects for [['pebbles'], ['barney', 'fred']]
9704     *
9705     * // The `_.matchesProperty` iteratee shorthand.
9706     * _.partition(users, ['active', false]);
9707     * // => objects for [['barney', 'pebbles'], ['fred']]
9708     *
9709     * // The `_.property` iteratee shorthand.
9710     * _.partition(users, 'active');
9711     * // => objects for [['fred'], ['barney', 'pebbles']]
9712     */
9713    var partition = createAggregator(function(result, value, key) {
9714      result[key ? 0 : 1].push(value);
9715    }, function() { return [[], []]; });
9716
9717    /**
9718     * Reduces `collection` to a value which is the accumulated result of running
9719     * each element in `collection` thru `iteratee`, where each successive
9720     * invocation is supplied the return value of the previous. If `accumulator`
9721     * is not given, the first element of `collection` is used as the initial
9722     * value. The iteratee is invoked with four arguments:
9723     * (accumulator, value, index|key, collection).
9724     *
9725     * Many lodash methods are guarded to work as iteratees for methods like
9726     * `_.reduce`, `_.reduceRight`, and `_.transform`.
9727     *
9728     * The guarded methods are:
9729     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
9730     * and `sortBy`
9731     *
9732     * @static
9733     * @memberOf _
9734     * @since 0.1.0
9735     * @category Collection
9736     * @param {Array|Object} collection The collection to iterate over.
9737     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9738     * @param {*} [accumulator] The initial value.
9739     * @returns {*} Returns the accumulated value.
9740     * @see _.reduceRight
9741     * @example
9742     *
9743     * _.reduce([1, 2], function(sum, n) {
9744     *   return sum + n;
9745     * }, 0);
9746     * // => 3
9747     *
9748     * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
9749     *   (result[value] || (result[value] = [])).push(key);
9750     *   return result;
9751     * }, {});
9752     * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
9753     */
9754    function reduce(collection, iteratee, accumulator) {
9755      var func = isArray(collection) ? arrayReduce : baseReduce,
9756          initAccum = arguments.length < 3;
9757
9758      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
9759    }
9760
9761    /**
9762     * This method is like `_.reduce` except that it iterates over elements of
9763     * `collection` from right to left.
9764     *
9765     * @static
9766     * @memberOf _
9767     * @since 0.1.0
9768     * @category Collection
9769     * @param {Array|Object} collection The collection to iterate over.
9770     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9771     * @param {*} [accumulator] The initial value.
9772     * @returns {*} Returns the accumulated value.
9773     * @see _.reduce
9774     * @example
9775     *
9776     * var array = [[0, 1], [2, 3], [4, 5]];
9777     *
9778     * _.reduceRight(array, function(flattened, other) {
9779     *   return flattened.concat(other);
9780     * }, []);
9781     * // => [4, 5, 2, 3, 0, 1]
9782     */
9783    function reduceRight(collection, iteratee, accumulator) {
9784      var func = isArray(collection) ? arrayReduceRight : baseReduce,
9785          initAccum = arguments.length < 3;
9786
9787      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
9788    }
9789
9790    /**
9791     * The opposite of `_.filter`; this method returns the elements of `collection`
9792     * that `predicate` does **not** return truthy for.
9793     *
9794     * @static
9795     * @memberOf _
9796     * @since 0.1.0
9797     * @category Collection
9798     * @param {Array|Object} collection The collection to iterate over.
9799     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9800     * @returns {Array} Returns the new filtered array.
9801     * @see _.filter
9802     * @example
9803     *
9804     * var users = [
9805     *   { 'user': 'barney', 'age': 36, 'active': false },
9806     *   { 'user': 'fred',   'age': 40, 'active': true }
9807     * ];
9808     *
9809     * _.reject(users, function(o) { return !o.active; });
9810     * // => objects for ['fred']
9811     *
9812     * // The `_.matches` iteratee shorthand.
9813     * _.reject(users, { 'age': 40, 'active': true });
9814     * // => objects for ['barney']
9815     *
9816     * // The `_.matchesProperty` iteratee shorthand.
9817     * _.reject(users, ['active', false]);
9818     * // => objects for ['fred']
9819     *
9820     * // The `_.property` iteratee shorthand.
9821     * _.reject(users, 'active');
9822     * // => objects for ['barney']
9823     */
9824    function reject(collection, predicate) {
9825      var func = isArray(collection) ? arrayFilter : baseFilter;
9826      return func(collection, negate(getIteratee(predicate, 3)));
9827    }
9828
9829    /**
9830     * Gets a random element from `collection`.
9831     *
9832     * @static
9833     * @memberOf _
9834     * @since 2.0.0
9835     * @category Collection
9836     * @param {Array|Object} collection The collection to sample.
9837     * @returns {*} Returns the random element.
9838     * @example
9839     *
9840     * _.sample([1, 2, 3, 4]);
9841     * // => 2
9842     */
9843    function sample(collection) {
9844      var func = isArray(collection) ? arraySample : baseSample;
9845      return func(collection);
9846    }
9847
9848    /**
9849     * Gets `n` random elements at unique keys from `collection` up to the
9850     * size of `collection`.
9851     *
9852     * @static
9853     * @memberOf _
9854     * @since 4.0.0
9855     * @category Collection
9856     * @param {Array|Object} collection The collection to sample.
9857     * @param {number} [n=1] The number of elements to sample.
9858     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9859     * @returns {Array} Returns the random elements.
9860     * @example
9861     *
9862     * _.sampleSize([1, 2, 3], 2);
9863     * // => [3, 1]
9864     *
9865     * _.sampleSize([1, 2, 3], 4);
9866     * // => [2, 3, 1]
9867     */
9868    function sampleSize(collection, n, guard) {
9869      if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
9870        n = 1;
9871      } else {
9872        n = toInteger(n);
9873      }
9874      var func = isArray(collection) ? arraySampleSize : baseSampleSize;
9875      return func(collection, n);
9876    }
9877
9878    /**
9879     * Creates an array of shuffled values, using a version of the
9880     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
9881     *
9882     * @static
9883     * @memberOf _
9884     * @since 0.1.0
9885     * @category Collection
9886     * @param {Array|Object} collection The collection to shuffle.
9887     * @returns {Array} Returns the new shuffled array.
9888     * @example
9889     *
9890     * _.shuffle([1, 2, 3, 4]);
9891     * // => [4, 1, 3, 2]
9892     */
9893    function shuffle(collection) {
9894      var func = isArray(collection) ? arrayShuffle : baseShuffle;
9895      return func(collection);
9896    }
9897
9898    /**
9899     * Gets the size of `collection` by returning its length for array-like
9900     * values or the number of own enumerable string keyed properties for objects.
9901     *
9902     * @static
9903     * @memberOf _
9904     * @since 0.1.0
9905     * @category Collection
9906     * @param {Array|Object|string} collection The collection to inspect.
9907     * @returns {number} Returns the collection size.
9908     * @example
9909     *
9910     * _.size([1, 2, 3]);
9911     * // => 3
9912     *
9913     * _.size({ 'a': 1, 'b': 2 });
9914     * // => 2
9915     *
9916     * _.size('pebbles');
9917     * // => 7
9918     */
9919    function size(collection) {
9920      if (collection == null) {
9921        return 0;
9922      }
9923      if (isArrayLike(collection)) {
9924        return isString(collection) ? stringSize(collection) : collection.length;
9925      }
9926      var tag = getTag(collection);
9927      if (tag == mapTag || tag == setTag) {
9928        return collection.size;
9929      }
9930      return baseKeys(collection).length;
9931    }
9932
9933    /**
9934     * Checks if `predicate` returns truthy for **any** element of `collection`.
9935     * Iteration is stopped once `predicate` returns truthy. The predicate is
9936     * invoked with three arguments: (value, index|key, collection).
9937     *
9938     * @static
9939     * @memberOf _
9940     * @since 0.1.0
9941     * @category Collection
9942     * @param {Array|Object} collection The collection to iterate over.
9943     * @param {Function} [predicate=_.identity] The function invoked per iteration.
9944     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9945     * @returns {boolean} Returns `true` if any element passes the predicate check,
9946     *  else `false`.
9947     * @example
9948     *
9949     * _.some([null, 0, 'yes', false], Boolean);
9950     * // => true
9951     *
9952     * var users = [
9953     *   { 'user': 'barney', 'active': true },
9954     *   { 'user': 'fred',   'active': false }
9955     * ];
9956     *
9957     * // The `_.matches` iteratee shorthand.
9958     * _.some(users, { 'user': 'barney', 'active': false });
9959     * // => false
9960     *
9961     * // The `_.matchesProperty` iteratee shorthand.
9962     * _.some(users, ['active', false]);
9963     * // => true
9964     *
9965     * // The `_.property` iteratee shorthand.
9966     * _.some(users, 'active');
9967     * // => true
9968     */
9969    function some(collection, predicate, guard) {
9970      var func = isArray(collection) ? arraySome : baseSome;
9971      if (guard && isIterateeCall(collection, predicate, guard)) {
9972        predicate = undefined;
9973      }
9974      return func(collection, getIteratee(predicate, 3));
9975    }
9976
9977    /**
9978     * Creates an array of elements, sorted in ascending order by the results of
9979     * running each element in a collection thru each iteratee. This method
9980     * performs a stable sort, that is, it preserves the original sort order of
9981     * equal elements. The iteratees are invoked with one argument: (value).
9982     *
9983     * @static
9984     * @memberOf _
9985     * @since 0.1.0
9986     * @category Collection
9987     * @param {Array|Object} collection The collection to iterate over.
9988     * @param {...(Function|Function[])} [iteratees=[_.identity]]
9989     *  The iteratees to sort by.
9990     * @returns {Array} Returns the new sorted array.
9991     * @example
9992     *
9993     * var users = [
9994     *   { 'user': 'fred',   'age': 48 },
9995     *   { 'user': 'barney', 'age': 36 },
9996     *   { 'user': 'fred',   'age': 30 },
9997     *   { 'user': 'barney', 'age': 34 }
9998     * ];
9999     *
10000     * _.sortBy(users, [function(o) { return o.user; }]);
10001     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
10002     *
10003     * _.sortBy(users, ['user', 'age']);
10004     * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
10005     */
10006    var sortBy = baseRest(function(collection, iteratees) {
10007      if (collection == null) {
10008        return [];
10009      }
10010      var length = iteratees.length;
10011      if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10012        iteratees = [];
10013      } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10014        iteratees = [iteratees[0]];
10015      }
10016      return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10017    });
10018
10019    /*------------------------------------------------------------------------*/
10020
10021    /**
10022     * Gets the timestamp of the number of milliseconds that have elapsed since
10023     * the Unix epoch (1 January 1970 00:00:00 UTC).
10024     *
10025     * @static
10026     * @memberOf _
10027     * @since 2.4.0
10028     * @category Date
10029     * @returns {number} Returns the timestamp.
10030     * @example
10031     *
10032     * _.defer(function(stamp) {
10033     *   console.log(_.now() - stamp);
10034     * }, _.now());
10035     * // => Logs the number of milliseconds it took for the deferred invocation.
10036     */
10037    var now = ctxNow || function() {
10038      return root.Date.now();
10039    };
10040
10041    /*------------------------------------------------------------------------*/
10042
10043    /**
10044     * The opposite of `_.before`; this method creates a function that invokes
10045     * `func` once it's called `n` or more times.
10046     *
10047     * @static
10048     * @memberOf _
10049     * @since 0.1.0
10050     * @category Function
10051     * @param {number} n The number of calls before `func` is invoked.
10052     * @param {Function} func The function to restrict.
10053     * @returns {Function} Returns the new restricted function.
10054     * @example
10055     *
10056     * var saves = ['profile', 'settings'];
10057     *
10058     * var done = _.after(saves.length, function() {
10059     *   console.log('done saving!');
10060     * });
10061     *
10062     * _.forEach(saves, function(type) {
10063     *   asyncSave({ 'type': type, 'complete': done });
10064     * });
10065     * // => Logs 'done saving!' after the two async saves have completed.
10066     */
10067    function after(n, func) {
10068      if (typeof func != 'function') {
10069        throw new TypeError(FUNC_ERROR_TEXT);
10070      }
10071      n = toInteger(n);
10072      return function() {
10073        if (--n < 1) {
10074          return func.apply(this, arguments);
10075        }
10076      };
10077    }
10078
10079    /**
10080     * Creates a function that invokes `func`, with up to `n` arguments,
10081     * ignoring any additional arguments.
10082     *
10083     * @static
10084     * @memberOf _
10085     * @since 3.0.0
10086     * @category Function
10087     * @param {Function} func The function to cap arguments for.
10088     * @param {number} [n=func.length] The arity cap.
10089     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10090     * @returns {Function} Returns the new capped function.
10091     * @example
10092     *
10093     * _.map(['6', '8', '10'], _.ary(parseInt, 1));
10094     * // => [6, 8, 10]
10095     */
10096    function ary(func, n, guard) {
10097      n = guard ? undefined : n;
10098      n = (func && n == null) ? func.length : n;
10099      return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
10100    }
10101
10102    /**
10103     * Creates a function that invokes `func`, with the `this` binding and arguments
10104     * of the created function, while it's called less than `n` times. Subsequent
10105     * calls to the created function return the result of the last `func` invocation.
10106     *
10107     * @static
10108     * @memberOf _
10109     * @since 3.0.0
10110     * @category Function
10111     * @param {number} n The number of calls at which `func` is no longer invoked.
10112     * @param {Function} func The function to restrict.
10113     * @returns {Function} Returns the new restricted function.
10114     * @example
10115     *
10116     * jQuery(element).on('click', _.before(5, addContactToList));
10117     * // => Allows adding up to 4 contacts to the list.
10118     */
10119    function before(n, func) {
10120      var result;
10121      if (typeof func != 'function') {
10122        throw new TypeError(FUNC_ERROR_TEXT);
10123      }
10124      n = toInteger(n);
10125      return function() {
10126        if (--n > 0) {
10127          result = func.apply(this, arguments);
10128        }
10129        if (n <= 1) {
10130          func = undefined;
10131        }
10132        return result;
10133      };
10134    }
10135
10136    /**
10137     * Creates a function that invokes `func` with the `this` binding of `thisArg`
10138     * and `partials` prepended to the arguments it receives.
10139     *
10140     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
10141     * may be used as a placeholder for partially applied arguments.
10142     *
10143     * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
10144     * property of bound functions.
10145     *
10146     * @static
10147     * @memberOf _
10148     * @since 0.1.0
10149     * @category Function
10150     * @param {Function} func The function to bind.
10151     * @param {*} thisArg The `this` binding of `func`.
10152     * @param {...*} [partials] The arguments to be partially applied.
10153     * @returns {Function} Returns the new bound function.
10154     * @example
10155     *
10156     * function greet(greeting, punctuation) {
10157     *   return greeting + ' ' + this.user + punctuation;
10158     * }
10159     *
10160     * var object = { 'user': 'fred' };
10161     *
10162     * var bound = _.bind(greet, object, 'hi');
10163     * bound('!');
10164     * // => 'hi fred!'
10165     *
10166     * // Bound with placeholders.
10167     * var bound = _.bind(greet, object, _, '!');
10168     * bound('hi');
10169     * // => 'hi fred!'
10170     */
10171    var bind = baseRest(function(func, thisArg, partials) {
10172      var bitmask = WRAP_BIND_FLAG;
10173      if (partials.length) {
10174        var holders = replaceHolders(partials, getHolder(bind));
10175        bitmask |= WRAP_PARTIAL_FLAG;
10176      }
10177      return createWrap(func, bitmask, thisArg, partials, holders);
10178    });
10179
10180    /**
10181     * Creates a function that invokes the method at `object[key]` with `partials`
10182     * prepended to the arguments it receives.
10183     *
10184     * This method differs from `_.bind` by allowing bound functions to reference
10185     * methods that may be redefined or don't yet exist. See
10186     * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
10187     * for more details.
10188     *
10189     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
10190     * builds, may be used as a placeholder for partially applied arguments.
10191     *
10192     * @static
10193     * @memberOf _
10194     * @since 0.10.0
10195     * @category Function
10196     * @param {Object} object The object to invoke the method on.
10197     * @param {string} key The key of the method.
10198     * @param {...*} [partials] The arguments to be partially applied.
10199     * @returns {Function} Returns the new bound function.
10200     * @example
10201     *
10202     * var object = {
10203     *   'user': 'fred',
10204     *   'greet': function(greeting, punctuation) {
10205     *     return greeting + ' ' + this.user + punctuation;
10206     *   }
10207     * };
10208     *
10209     * var bound = _.bindKey(object, 'greet', 'hi');
10210     * bound('!');
10211     * // => 'hi fred!'
10212     *
10213     * object.greet = function(greeting, punctuation) {
10214     *   return greeting + 'ya ' + this.user + punctuation;
10215     * };
10216     *
10217     * bound('!');
10218     * // => 'hiya fred!'
10219     *
10220     * // Bound with placeholders.
10221     * var bound = _.bindKey(object, 'greet', _, '!');
10222     * bound('hi');
10223     * // => 'hiya fred!'
10224     */
10225    var bindKey = baseRest(function(object, key, partials) {
10226      var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10227      if (partials.length) {
10228        var holders = replaceHolders(partials, getHolder(bindKey));
10229        bitmask |= WRAP_PARTIAL_FLAG;
10230      }
10231      return createWrap(key, bitmask, object, partials, holders);
10232    });
10233
10234    /**
10235     * Creates a function that accepts arguments of `func` and either invokes
10236     * `func` returning its result, if at least `arity` number of arguments have
10237     * been provided, or returns a function that accepts the remaining `func`
10238     * arguments, and so on. The arity of `func` may be specified if `func.length`
10239     * is not sufficient.
10240     *
10241     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
10242     * may be used as a placeholder for provided arguments.
10243     *
10244     * **Note:** This method doesn't set the "length" property of curried functions.
10245     *
10246     * @static
10247     * @memberOf _
10248     * @since 2.0.0
10249     * @category Function
10250     * @param {Function} func The function to curry.
10251     * @param {number} [arity=func.length] The arity of `func`.
10252     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10253     * @returns {Function} Returns the new curried function.
10254     * @example
10255     *
10256     * var abc = function(a, b, c) {
10257     *   return [a, b, c];
10258     * };
10259     *
10260     * var curried = _.curry(abc);
10261     *
10262     * curried(1)(2)(3);
10263     * // => [1, 2, 3]
10264     *
10265     * curried(1, 2)(3);
10266     * // => [1, 2, 3]
10267     *
10268     * curried(1, 2, 3);
10269     * // => [1, 2, 3]
10270     *
10271     * // Curried with placeholders.
10272     * curried(1)(_, 3)(2);
10273     * // => [1, 2, 3]
10274     */
10275    function curry(func, arity, guard) {
10276      arity = guard ? undefined : arity;
10277      var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10278      result.placeholder = curry.placeholder;
10279      return result;
10280    }
10281
10282    /**
10283     * This method is like `_.curry` except that arguments are applied to `func`
10284     * in the manner of `_.partialRight` instead of `_.partial`.
10285     *
10286     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
10287     * builds, may be used as a placeholder for provided arguments.
10288     *
10289     * **Note:** This method doesn't set the "length" property of curried functions.
10290     *
10291     * @static
10292     * @memberOf _
10293     * @since 3.0.0
10294     * @category Function
10295     * @param {Function} func The function to curry.
10296     * @param {number} [arity=func.length] The arity of `func`.
10297     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10298     * @returns {Function} Returns the new curried function.
10299     * @example
10300     *
10301     * var abc = function(a, b, c) {
10302     *   return [a, b, c];
10303     * };
10304     *
10305     * var curried = _.curryRight(abc);
10306     *
10307     * curried(3)(2)(1);
10308     * // => [1, 2, 3]
10309     *
10310     * curried(2, 3)(1);
10311     * // => [1, 2, 3]
10312     *
10313     * curried(1, 2, 3);
10314     * // => [1, 2, 3]
10315     *
10316     * // Curried with placeholders.
10317     * curried(3)(1, _)(2);
10318     * // => [1, 2, 3]
10319     */
10320    function curryRight(func, arity, guard) {
10321      arity = guard ? undefined : arity;
10322      var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10323      result.placeholder = curryRight.placeholder;
10324      return result;
10325    }
10326
10327    /**
10328     * Creates a debounced function that delays invoking `func` until after `wait`
10329     * milliseconds have elapsed since the last time the debounced function was
10330     * invoked. The debounced function comes with a `cancel` method to cancel
10331     * delayed `func` invocations and a `flush` method to immediately invoke them.
10332     * Provide `options` to indicate whether `func` should be invoked on the
10333     * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
10334     * with the last arguments provided to the debounced function. Subsequent
10335     * calls to the debounced function return the result of the last `func`
10336     * invocation.
10337     *
10338     * **Note:** If `leading` and `trailing` options are `true`, `func` is
10339     * invoked on the trailing edge of the timeout only if the debounced function
10340     * is invoked more than once during the `wait` timeout.
10341     *
10342     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
10343     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
10344     *
10345     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
10346     * for details over the differences between `_.debounce` and `_.throttle`.
10347     *
10348     * @static
10349     * @memberOf _
10350     * @since 0.1.0
10351     * @category Function
10352     * @param {Function} func The function to debounce.
10353     * @param {number} [wait=0] The number of milliseconds to delay.
10354     * @param {Object} [options={}] The options object.
10355     * @param {boolean} [options.leading=false]
10356     *  Specify invoking on the leading edge of the timeout.
10357     * @param {number} [options.maxWait]
10358     *  The maximum time `func` is allowed to be delayed before it's invoked.
10359     * @param {boolean} [options.trailing=true]
10360     *  Specify invoking on the trailing edge of the timeout.
10361     * @returns {Function} Returns the new debounced function.
10362     * @example
10363     *
10364     * // Avoid costly calculations while the window size is in flux.
10365     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
10366     *
10367     * // Invoke `sendMail` when clicked, debouncing subsequent calls.
10368     * jQuery(element).on('click', _.debounce(sendMail, 300, {
10369     *   'leading': true,
10370     *   'trailing': false
10371     * }));
10372     *
10373     * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
10374     * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
10375     * var source = new EventSource('/stream');
10376     * jQuery(source).on('message', debounced);
10377     *
10378     * // Cancel the trailing debounced invocation.
10379     * jQuery(window).on('popstate', debounced.cancel);
10380     */
10381    function debounce(func, wait, options) {
10382      var lastArgs,
10383          lastThis,
10384          maxWait,
10385          result,
10386          timerId,
10387          lastCallTime,
10388          lastInvokeTime = 0,
10389          leading = false,
10390          maxing = false,
10391          trailing = true;
10392
10393      if (typeof func != 'function') {
10394        throw new TypeError(FUNC_ERROR_TEXT);
10395      }
10396      wait = toNumber(wait) || 0;
10397      if (isObject(options)) {
10398        leading = !!options.leading;
10399        maxing = 'maxWait' in options;
10400        maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
10401        trailing = 'trailing' in options ? !!options.trailing : trailing;
10402      }
10403
10404      function invokeFunc(time) {
10405        var args = lastArgs,
10406            thisArg = lastThis;
10407
10408        lastArgs = lastThis = undefined;
10409        lastInvokeTime = time;
10410        result = func.apply(thisArg, args);
10411        return result;
10412      }
10413
10414      function leadingEdge(time) {
10415        // Reset any `maxWait` timer.
10416        lastInvokeTime = time;
10417        // Start the timer for the trailing edge.
10418        timerId = setTimeout(timerExpired, wait);
10419        // Invoke the leading edge.
10420        return leading ? invokeFunc(time) : result;
10421      }
10422
10423      function remainingWait(time) {
10424        var timeSinceLastCall = time - lastCallTime,
10425            timeSinceLastInvoke = time - lastInvokeTime,
10426            timeWaiting = wait - timeSinceLastCall;
10427
10428        return maxing
10429          ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
10430          : timeWaiting;
10431      }
10432
10433      function shouldInvoke(time) {
10434        var timeSinceLastCall = time - lastCallTime,
10435            timeSinceLastInvoke = time - lastInvokeTime;
10436
10437        // Either this is the first call, activity has stopped and we're at the
10438        // trailing edge, the system time has gone backwards and we're treating
10439        // it as the trailing edge, or we've hit the `maxWait` limit.
10440        return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
10441          (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
10442      }
10443
10444      function timerExpired() {
10445        var time = now();
10446        if (shouldInvoke(time)) {
10447          return trailingEdge(time);
10448        }
10449        // Restart the timer.
10450        timerId = setTimeout(timerExpired, remainingWait(time));
10451      }
10452
10453      function trailingEdge(time) {
10454        timerId = undefined;
10455
10456        // Only invoke if we have `lastArgs` which means `func` has been
10457        // debounced at least once.
10458        if (trailing && lastArgs) {
10459          return invokeFunc(time);
10460        }
10461        lastArgs = lastThis = undefined;
10462        return result;
10463      }
10464
10465      function cancel() {
10466        if (timerId !== undefined) {
10467          clearTimeout(timerId);
10468        }
10469        lastInvokeTime = 0;
10470        lastArgs = lastCallTime = lastThis = timerId = undefined;
10471      }
10472
10473      function flush() {
10474        return timerId === undefined ? result : trailingEdge(now());
10475      }
10476
10477      function debounced() {
10478        var time = now(),
10479            isInvoking = shouldInvoke(time);
10480
10481        lastArgs = arguments;
10482        lastThis = this;
10483        lastCallTime = time;
10484
10485        if (isInvoking) {
10486          if (timerId === undefined) {
10487            return leadingEdge(lastCallTime);
10488          }
10489          if (maxing) {
10490            // Handle invocations in a tight loop.
10491            clearTimeout(timerId);
10492            timerId = setTimeout(timerExpired, wait);
10493            return invokeFunc(lastCallTime);
10494          }
10495        }
10496        if (timerId === undefined) {
10497          timerId = setTimeout(timerExpired, wait);
10498        }
10499        return result;
10500      }
10501      debounced.cancel = cancel;
10502      debounced.flush = flush;
10503      return debounced;
10504    }
10505
10506    /**
10507     * Defers invoking the `func` until the current call stack has cleared. Any
10508     * additional arguments are provided to `func` when it's invoked.
10509     *
10510     * @static
10511     * @memberOf _
10512     * @since 0.1.0
10513     * @category Function
10514     * @param {Function} func The function to defer.
10515     * @param {...*} [args] The arguments to invoke `func` with.
10516     * @returns {number} Returns the timer id.
10517     * @example
10518     *
10519     * _.defer(function(text) {
10520     *   console.log(text);
10521     * }, 'deferred');
10522     * // => Logs 'deferred' after one millisecond.
10523     */
10524    var defer = baseRest(function(func, args) {
10525      return baseDelay(func, 1, args);
10526    });
10527
10528    /**
10529     * Invokes `func` after `wait` milliseconds. Any additional arguments are
10530     * provided to `func` when it's invoked.
10531     *
10532     * @static
10533     * @memberOf _
10534     * @since 0.1.0
10535     * @category Function
10536     * @param {Function} func The function to delay.
10537     * @param {number} wait The number of milliseconds to delay invocation.
10538     * @param {...*} [args] The arguments to invoke `func` with.
10539     * @returns {number} Returns the timer id.
10540     * @example
10541     *
10542     * _.delay(function(text) {
10543     *   console.log(text);
10544     * }, 1000, 'later');
10545     * // => Logs 'later' after one second.
10546     */
10547    var delay = baseRest(function(func, wait, args) {
10548      return baseDelay(func, toNumber(wait) || 0, args);
10549    });
10550
10551    /**
10552     * Creates a function that invokes `func` with arguments reversed.
10553     *
10554     * @static
10555     * @memberOf _
10556     * @since 4.0.0
10557     * @category Function
10558     * @param {Function} func The function to flip arguments for.
10559     * @returns {Function} Returns the new flipped function.
10560     * @example
10561     *
10562     * var flipped = _.flip(function() {
10563     *   return _.toArray(arguments);
10564     * });
10565     *
10566     * flipped('a', 'b', 'c', 'd');
10567     * // => ['d', 'c', 'b', 'a']
10568     */
10569    function flip(func) {
10570      return createWrap(func, WRAP_FLIP_FLAG);
10571    }
10572
10573    /**
10574     * Creates a function that memoizes the result of `func`. If `resolver` is
10575     * provided, it determines the cache key for storing the result based on the
10576     * arguments provided to the memoized function. By default, the first argument
10577     * provided to the memoized function is used as the map cache key. The `func`
10578     * is invoked with the `this` binding of the memoized function.
10579     *
10580     * **Note:** The cache is exposed as the `cache` property on the memoized
10581     * function. Its creation may be customized by replacing the `_.memoize.Cache`
10582     * constructor with one whose instances implement the
10583     * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
10584     * method interface of `clear`, `delete`, `get`, `has`, and `set`.
10585     *
10586     * @static
10587     * @memberOf _
10588     * @since 0.1.0
10589     * @category Function
10590     * @param {Function} func The function to have its output memoized.
10591     * @param {Function} [resolver] The function to resolve the cache key.
10592     * @returns {Function} Returns the new memoized function.
10593     * @example
10594     *
10595     * var object = { 'a': 1, 'b': 2 };
10596     * var other = { 'c': 3, 'd': 4 };
10597     *
10598     * var values = _.memoize(_.values);
10599     * values(object);
10600     * // => [1, 2]
10601     *
10602     * values(other);
10603     * // => [3, 4]
10604     *
10605     * object.a = 2;
10606     * values(object);
10607     * // => [1, 2]
10608     *
10609     * // Modify the result cache.
10610     * values.cache.set(object, ['a', 'b']);
10611     * values(object);
10612     * // => ['a', 'b']
10613     *
10614     * // Replace `_.memoize.Cache`.
10615     * _.memoize.Cache = WeakMap;
10616     */
10617    function memoize(func, resolver) {
10618      if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
10619        throw new TypeError(FUNC_ERROR_TEXT);
10620      }
10621      var memoized = function() {
10622        var args = arguments,
10623            key = resolver ? resolver.apply(this, args) : args[0],
10624            cache = memoized.cache;
10625
10626        if (cache.has(key)) {
10627          return cache.get(key);
10628        }
10629        var result = func.apply(this, args);
10630        memoized.cache = cache.set(key, result) || cache;
10631        return result;
10632      };
10633      memoized.cache = new (memoize.Cache || MapCache);
10634      return memoized;
10635    }
10636
10637    // Expose `MapCache`.
10638    memoize.Cache = MapCache;
10639
10640    /**
10641     * Creates a function that negates the result of the predicate `func`. The
10642     * `func` predicate is invoked with the `this` binding and arguments of the
10643     * created function.
10644     *
10645     * @static
10646     * @memberOf _
10647     * @since 3.0.0
10648     * @category Function
10649     * @param {Function} predicate The predicate to negate.
10650     * @returns {Function} Returns the new negated function.
10651     * @example
10652     *
10653     * function isEven(n) {
10654     *   return n % 2 == 0;
10655     * }
10656     *
10657     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
10658     * // => [1, 3, 5]
10659     */
10660    function negate(predicate) {
10661      if (typeof predicate != 'function') {
10662        throw new TypeError(FUNC_ERROR_TEXT);
10663      }
10664      return function() {
10665        var args = arguments;
10666        switch (args.length) {
10667          case 0: return !predicate.call(this);
10668          case 1: return !predicate.call(this, args[0]);
10669          case 2: return !predicate.call(this, args[0], args[1]);
10670          case 3: return !predicate.call(this, args[0], args[1], args[2]);
10671        }
10672        return !predicate.apply(this, args);
10673      };
10674    }
10675
10676    /**
10677     * Creates a function that is restricted to invoking `func` once. Repeat calls
10678     * to the function return the value of the first invocation. The `func` is
10679     * invoked with the `this` binding and arguments of the created function.
10680     *
10681     * @static
10682     * @memberOf _
10683     * @since 0.1.0
10684     * @category Function
10685     * @param {Function} func The function to restrict.
10686     * @returns {Function} Returns the new restricted function.
10687     * @example
10688     *
10689     * var initialize = _.once(createApplication);
10690     * initialize();
10691     * initialize();
10692     * // => `createApplication` is invoked once
10693     */
10694    function once(func) {
10695      return before(2, func);
10696    }
10697
10698    /**
10699     * Creates a function that invokes `func` with its arguments transformed.
10700     *
10701     * @static
10702     * @since 4.0.0
10703     * @memberOf _
10704     * @category Function
10705     * @param {Function} func The function to wrap.
10706     * @param {...(Function|Function[])} [transforms=[_.identity]]
10707     *  The argument transforms.
10708     * @returns {Function} Returns the new function.
10709     * @example
10710     *
10711     * function doubled(n) {
10712     *   return n * 2;
10713     * }
10714     *
10715     * function square(n) {
10716     *   return n * n;
10717     * }
10718     *
10719     * var func = _.overArgs(function(x, y) {
10720     *   return [x, y];
10721     * }, [square, doubled]);
10722     *
10723     * func(9, 3);
10724     * // => [81, 6]
10725     *
10726     * func(10, 5);
10727     * // => [100, 10]
10728     */
10729    var overArgs = castRest(function(func, transforms) {
10730      transforms = (transforms.length == 1 && isArray(transforms[0]))
10731        ? arrayMap(transforms[0], baseUnary(getIteratee()))
10732        : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
10733
10734      var funcsLength = transforms.length;
10735      return baseRest(function(args) {
10736        var index = -1,
10737            length = nativeMin(args.length, funcsLength);
10738
10739        while (++index < length) {
10740          args[index] = transforms[index].call(this, args[index]);
10741        }
10742        return apply(func, this, args);
10743      });
10744    });
10745
10746    /**
10747     * Creates a function that invokes `func` with `partials` prepended to the
10748     * arguments it receives. This method is like `_.bind` except it does **not**
10749     * alter the `this` binding.
10750     *
10751     * The `_.partial.placeholder` value, which defaults to `_` in monolithic
10752     * builds, may be used as a placeholder for partially applied arguments.
10753     *
10754     * **Note:** This method doesn't set the "length" property of partially
10755     * applied functions.
10756     *
10757     * @static
10758     * @memberOf _
10759     * @since 0.2.0
10760     * @category Function
10761     * @param {Function} func The function to partially apply arguments to.
10762     * @param {...*} [partials] The arguments to be partially applied.
10763     * @returns {Function} Returns the new partially applied function.
10764     * @example
10765     *
10766     * function greet(greeting, name) {
10767     *   return greeting + ' ' + name;
10768     * }
10769     *
10770     * var sayHelloTo = _.partial(greet, 'hello');
10771     * sayHelloTo('fred');
10772     * // => 'hello fred'
10773     *
10774     * // Partially applied with placeholders.
10775     * var greetFred = _.partial(greet, _, 'fred');
10776     * greetFred('hi');
10777     * // => 'hi fred'
10778     */
10779    var partial = baseRest(function(func, partials) {
10780      var holders = replaceHolders(partials, getHolder(partial));
10781      return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
10782    });
10783
10784    /**
10785     * This method is like `_.partial` except that partially applied arguments
10786     * are appended to the arguments it receives.
10787     *
10788     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
10789     * builds, may be used as a placeholder for partially applied arguments.
10790     *
10791     * **Note:** This method doesn't set the "length" property of partially
10792     * applied functions.
10793     *
10794     * @static
10795     * @memberOf _
10796     * @since 1.0.0
10797     * @category Function
10798     * @param {Function} func The function to partially apply arguments to.
10799     * @param {...*} [partials] The arguments to be partially applied.
10800     * @returns {Function} Returns the new partially applied function.
10801     * @example
10802     *
10803     * function greet(greeting, name) {
10804     *   return greeting + ' ' + name;
10805     * }
10806     *
10807     * var greetFred = _.partialRight(greet, 'fred');
10808     * greetFred('hi');
10809     * // => 'hi fred'
10810     *
10811     * // Partially applied with placeholders.
10812     * var sayHelloTo = _.partialRight(greet, 'hello', _);
10813     * sayHelloTo('fred');
10814     * // => 'hello fred'
10815     */
10816    var partialRight = baseRest(function(func, partials) {
10817      var holders = replaceHolders(partials, getHolder(partialRight));
10818      return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
10819    });
10820
10821    /**
10822     * Creates a function that invokes `func` with arguments arranged according
10823     * to the specified `indexes` where the argument value at the first index is
10824     * provided as the first argument, the argument value at the second index is
10825     * provided as the second argument, and so on.
10826     *
10827     * @static
10828     * @memberOf _
10829     * @since 3.0.0
10830     * @category Function
10831     * @param {Function} func The function to rearrange arguments for.
10832     * @param {...(number|number[])} indexes The arranged argument indexes.
10833     * @returns {Function} Returns the new function.
10834     * @example
10835     *
10836     * var rearged = _.rearg(function(a, b, c) {
10837     *   return [a, b, c];
10838     * }, [2, 0, 1]);
10839     *
10840     * rearged('b', 'c', 'a')
10841     * // => ['a', 'b', 'c']
10842     */
10843    var rearg = flatRest(function(func, indexes) {
10844      return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
10845    });
10846
10847    /**
10848     * Creates a function that invokes `func` with the `this` binding of the
10849     * created function and arguments from `start` and beyond provided as
10850     * an array.
10851     *
10852     * **Note:** This method is based on the
10853     * [rest parameter](https://mdn.io/rest_parameters).
10854     *
10855     * @static
10856     * @memberOf _
10857     * @since 4.0.0
10858     * @category Function
10859     * @param {Function} func The function to apply a rest parameter to.
10860     * @param {number} [start=func.length-1] The start position of the rest parameter.
10861     * @returns {Function} Returns the new function.
10862     * @example
10863     *
10864     * var say = _.rest(function(what, names) {
10865     *   return what + ' ' + _.initial(names).join(', ') +
10866     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
10867     * });
10868     *
10869     * say('hello', 'fred', 'barney', 'pebbles');
10870     * // => 'hello fred, barney, & pebbles'
10871     */
10872    function rest(func, start) {
10873      if (typeof func != 'function') {
10874        throw new TypeError(FUNC_ERROR_TEXT);
10875      }
10876      start = start === undefined ? start : toInteger(start);
10877      return baseRest(func, start);
10878    }
10879
10880    /**
10881     * Creates a function that invokes `func` with the `this` binding of the
10882     * create function and an array of arguments much like
10883     * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
10884     *
10885     * **Note:** This method is based on the
10886     * [spread operator](https://mdn.io/spread_operator).
10887     *
10888     * @static
10889     * @memberOf _
10890     * @since 3.2.0
10891     * @category Function
10892     * @param {Function} func The function to spread arguments over.
10893     * @param {number} [start=0] The start position of the spread.
10894     * @returns {Function} Returns the new function.
10895     * @example
10896     *
10897     * var say = _.spread(function(who, what) {
10898     *   return who + ' says ' + what;
10899     * });
10900     *
10901     * say(['fred', 'hello']);
10902     * // => 'fred says hello'
10903     *
10904     * var numbers = Promise.all([
10905     *   Promise.resolve(40),
10906     *   Promise.resolve(36)
10907     * ]);
10908     *
10909     * numbers.then(_.spread(function(x, y) {
10910     *   return x + y;
10911     * }));
10912     * // => a Promise of 76
10913     */
10914    function spread(func, start) {
10915      if (typeof func != 'function') {
10916        throw new TypeError(FUNC_ERROR_TEXT);
10917      }
10918      start = start == null ? 0 : nativeMax(toInteger(start), 0);
10919      return baseRest(function(args) {
10920        var array = args[start],
10921            otherArgs = castSlice(args, 0, start);
10922
10923        if (array) {
10924          arrayPush(otherArgs, array);
10925        }
10926        return apply(func, this, otherArgs);
10927      });
10928    }
10929
10930    /**
10931     * Creates a throttled function that only invokes `func` at most once per
10932     * every `wait` milliseconds. The throttled function comes with a `cancel`
10933     * method to cancel delayed `func` invocations and a `flush` method to
10934     * immediately invoke them. Provide `options` to indicate whether `func`
10935     * should be invoked on the leading and/or trailing edge of the `wait`
10936     * timeout. The `func` is invoked with the last arguments provided to the
10937     * throttled function. Subsequent calls to the throttled function return the
10938     * result of the last `func` invocation.
10939     *
10940     * **Note:** If `leading` and `trailing` options are `true`, `func` is
10941     * invoked on the trailing edge of the timeout only if the throttled function
10942     * is invoked more than once during the `wait` timeout.
10943     *
10944     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
10945     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
10946     *
10947     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
10948     * for details over the differences between `_.throttle` and `_.debounce`.
10949     *
10950     * @static
10951     * @memberOf _
10952     * @since 0.1.0
10953     * @category Function
10954     * @param {Function} func The function to throttle.
10955     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
10956     * @param {Object} [options={}] The options object.
10957     * @param {boolean} [options.leading=true]
10958     *  Specify invoking on the leading edge of the timeout.
10959     * @param {boolean} [options.trailing=true]
10960     *  Specify invoking on the trailing edge of the timeout.
10961     * @returns {Function} Returns the new throttled function.
10962     * @example
10963     *
10964     * // Avoid excessively updating the position while scrolling.
10965     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
10966     *
10967     * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
10968     * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
10969     * jQuery(element).on('click', throttled);
10970     *
10971     * // Cancel the trailing throttled invocation.
10972     * jQuery(window).on('popstate', throttled.cancel);
10973     */
10974    function throttle(func, wait, options) {
10975      var leading = true,
10976          trailing = true;
10977
10978      if (typeof func != 'function') {
10979        throw new TypeError(FUNC_ERROR_TEXT);
10980      }
10981      if (isObject(options)) {
10982        leading = 'leading' in options ? !!options.leading : leading;
10983        trailing = 'trailing' in options ? !!options.trailing : trailing;
10984      }
10985      return debounce(func, wait, {
10986        'leading': leading,
10987        'maxWait': wait,
10988        'trailing': trailing
10989      });
10990    }
10991
10992    /**
10993     * Creates a function that accepts up to one argument, ignoring any
10994     * additional arguments.
10995     *
10996     * @static
10997     * @memberOf _
10998     * @since 4.0.0
10999     * @category Function
11000     * @param {Function} func The function to cap arguments for.
11001     * @returns {Function} Returns the new capped function.
11002     * @example
11003     *
11004     * _.map(['6', '8', '10'], _.unary(parseInt));
11005     * // => [6, 8, 10]
11006     */
11007    function unary(func) {
11008      return ary(func, 1);
11009    }
11010
11011    /**
11012     * Creates a function that provides `value` to `wrapper` as its first
11013     * argument. Any additional arguments provided to the function are appended
11014     * to those provided to the `wrapper`. The wrapper is invoked with the `this`
11015     * binding of the created function.
11016     *
11017     * @static
11018     * @memberOf _
11019     * @since 0.1.0
11020     * @category Function
11021     * @param {*} value The value to wrap.
11022     * @param {Function} [wrapper=identity] The wrapper function.
11023     * @returns {Function} Returns the new function.
11024     * @example
11025     *
11026     * var p = _.wrap(_.escape, function(func, text) {
11027     *   return '<p>' + func(text) + '</p>';
11028     * });
11029     *
11030     * p('fred, barney, & pebbles');
11031     * // => '<p>fred, barney, &amp; pebbles</p>'
11032     */
11033    function wrap(value, wrapper) {
11034      return partial(castFunction(wrapper), value);
11035    }
11036
11037    /*------------------------------------------------------------------------*/
11038
11039    /**
11040     * Casts `value` as an array if it's not one.
11041     *
11042     * @static
11043     * @memberOf _
11044     * @since 4.4.0
11045     * @category Lang
11046     * @param {*} value The value to inspect.
11047     * @returns {Array} Returns the cast array.
11048     * @example
11049     *
11050     * _.castArray(1);
11051     * // => [1]
11052     *
11053     * _.castArray({ 'a': 1 });
11054     * // => [{ 'a': 1 }]
11055     *
11056     * _.castArray('abc');
11057     * // => ['abc']
11058     *
11059     * _.castArray(null);
11060     * // => [null]
11061     *
11062     * _.castArray(undefined);
11063     * // => [undefined]
11064     *
11065     * _.castArray();
11066     * // => []
11067     *
11068     * var array = [1, 2, 3];
11069     * console.log(_.castArray(array) === array);
11070     * // => true
11071     */
11072    function castArray() {
11073      if (!arguments.length) {
11074        return [];
11075      }
11076      var value = arguments[0];
11077      return isArray(value) ? value : [value];
11078    }
11079
11080    /**
11081     * Creates a shallow clone of `value`.
11082     *
11083     * **Note:** This method is loosely based on the
11084     * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
11085     * and supports cloning arrays, array buffers, booleans, date objects, maps,
11086     * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
11087     * arrays. The own enumerable properties of `arguments` objects are cloned
11088     * as plain objects. An empty object is returned for uncloneable values such
11089     * as error objects, functions, DOM nodes, and WeakMaps.
11090     *
11091     * @static
11092     * @memberOf _
11093     * @since 0.1.0
11094     * @category Lang
11095     * @param {*} value The value to clone.
11096     * @returns {*} Returns the cloned value.
11097     * @see _.cloneDeep
11098     * @example
11099     *
11100     * var objects = [{ 'a': 1 }, { 'b': 2 }];
11101     *
11102     * var shallow = _.clone(objects);
11103     * console.log(shallow[0] === objects[0]);
11104     * // => true
11105     */
11106    function clone(value) {
11107      return baseClone(value, CLONE_SYMBOLS_FLAG);
11108    }
11109
11110    /**
11111     * This method is like `_.clone` except that it accepts `customizer` which
11112     * is invoked to produce the cloned value. If `customizer` returns `undefined`,
11113     * cloning is handled by the method instead. The `customizer` is invoked with
11114     * up to four arguments; (value [, index|key, object, stack]).
11115     *
11116     * @static
11117     * @memberOf _
11118     * @since 4.0.0
11119     * @category Lang
11120     * @param {*} value The value to clone.
11121     * @param {Function} [customizer] The function to customize cloning.
11122     * @returns {*} Returns the cloned value.
11123     * @see _.cloneDeepWith
11124     * @example
11125     *
11126     * function customizer(value) {
11127     *   if (_.isElement(value)) {
11128     *     return value.cloneNode(false);
11129     *   }
11130     * }
11131     *
11132     * var el = _.cloneWith(document.body, customizer);
11133     *
11134     * console.log(el === document.body);
11135     * // => false
11136     * console.log(el.nodeName);
11137     * // => 'BODY'
11138     * console.log(el.childNodes.length);
11139     * // => 0
11140     */
11141    function cloneWith(value, customizer) {
11142      customizer = typeof customizer == 'function' ? customizer : undefined;
11143      return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
11144    }
11145
11146    /**
11147     * This method is like `_.clone` except that it recursively clones `value`.
11148     *
11149     * @static
11150     * @memberOf _
11151     * @since 1.0.0
11152     * @category Lang
11153     * @param {*} value The value to recursively clone.
11154     * @returns {*} Returns the deep cloned value.
11155     * @see _.clone
11156     * @example
11157     *
11158     * var objects = [{ 'a': 1 }, { 'b': 2 }];
11159     *
11160     * var deep = _.cloneDeep(objects);
11161     * console.log(deep[0] === objects[0]);
11162     * // => false
11163     */
11164    function cloneDeep(value) {
11165      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
11166    }
11167
11168    /**
11169     * This method is like `_.cloneWith` except that it recursively clones `value`.
11170     *
11171     * @static
11172     * @memberOf _
11173     * @since 4.0.0
11174     * @category Lang
11175     * @param {*} value The value to recursively clone.
11176     * @param {Function} [customizer] The function to customize cloning.
11177     * @returns {*} Returns the deep cloned value.
11178     * @see _.cloneWith
11179     * @example
11180     *
11181     * function customizer(value) {
11182     *   if (_.isElement(value)) {
11183     *     return value.cloneNode(true);
11184     *   }
11185     * }
11186     *
11187     * var el = _.cloneDeepWith(document.body, customizer);
11188     *
11189     * console.log(el === document.body);
11190     * // => false
11191     * console.log(el.nodeName);
11192     * // => 'BODY'
11193     * console.log(el.childNodes.length);
11194     * // => 20
11195     */
11196    function cloneDeepWith(value, customizer) {
11197      customizer = typeof customizer == 'function' ? customizer : undefined;
11198      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
11199    }
11200
11201    /**
11202     * Checks if `object` conforms to `source` by invoking the predicate
11203     * properties of `source` with the corresponding property values of `object`.
11204     *
11205     * **Note:** This method is equivalent to `_.conforms` when `source` is
11206     * partially applied.
11207     *
11208     * @static
11209     * @memberOf _
11210     * @since 4.14.0
11211     * @category Lang
11212     * @param {Object} object The object to inspect.
11213     * @param {Object} source The object of property predicates to conform to.
11214     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
11215     * @example
11216     *
11217     * var object = { 'a': 1, 'b': 2 };
11218     *
11219     * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
11220     * // => true
11221     *
11222     * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
11223     * // => false
11224     */
11225    function conformsTo(object, source) {
11226      return source == null || baseConformsTo(object, source, keys(source));
11227    }
11228
11229    /**
11230     * Performs a
11231     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11232     * comparison between two values to determine if they are equivalent.
11233     *
11234     * @static
11235     * @memberOf _
11236     * @since 4.0.0
11237     * @category Lang
11238     * @param {*} value The value to compare.
11239     * @param {*} other The other value to compare.
11240     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11241     * @example
11242     *
11243     * var object = { 'a': 1 };
11244     * var other = { 'a': 1 };
11245     *
11246     * _.eq(object, object);
11247     * // => true
11248     *
11249     * _.eq(object, other);
11250     * // => false
11251     *
11252     * _.eq('a', 'a');
11253     * // => true
11254     *
11255     * _.eq('a', Object('a'));
11256     * // => false
11257     *
11258     * _.eq(NaN, NaN);
11259     * // => true
11260     */
11261    function eq(value, other) {
11262      return value === other || (value !== value && other !== other);
11263    }
11264
11265    /**
11266     * Checks if `value` is greater than `other`.
11267     *
11268     * @static
11269     * @memberOf _
11270     * @since 3.9.0
11271     * @category Lang
11272     * @param {*} value The value to compare.
11273     * @param {*} other The other value to compare.
11274     * @returns {boolean} Returns `true` if `value` is greater than `other`,
11275     *  else `false`.
11276     * @see _.lt
11277     * @example
11278     *
11279     * _.gt(3, 1);
11280     * // => true
11281     *
11282     * _.gt(3, 3);
11283     * // => false
11284     *
11285     * _.gt(1, 3);
11286     * // => false
11287     */
11288    var gt = createRelationalOperation(baseGt);
11289
11290    /**
11291     * Checks if `value` is greater than or equal to `other`.
11292     *
11293     * @static
11294     * @memberOf _
11295     * @since 3.9.0
11296     * @category Lang
11297     * @param {*} value The value to compare.
11298     * @param {*} other The other value to compare.
11299     * @returns {boolean} Returns `true` if `value` is greater than or equal to
11300     *  `other`, else `false`.
11301     * @see _.lte
11302     * @example
11303     *
11304     * _.gte(3, 1);
11305     * // => true
11306     *
11307     * _.gte(3, 3);
11308     * // => true
11309     *
11310     * _.gte(1, 3);
11311     * // => false
11312     */
11313    var gte = createRelationalOperation(function(value, other) {
11314      return value >= other;
11315    });
11316
11317    /**
11318     * Checks if `value` is likely an `arguments` object.
11319     *
11320     * @static
11321     * @memberOf _
11322     * @since 0.1.0
11323     * @category Lang
11324     * @param {*} value The value to check.
11325     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
11326     *  else `false`.
11327     * @example
11328     *
11329     * _.isArguments(function() { return arguments; }());
11330     * // => true
11331     *
11332     * _.isArguments([1, 2, 3]);
11333     * // => false
11334     */
11335    var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
11336      return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
11337        !propertyIsEnumerable.call(value, 'callee');
11338    };
11339
11340    /**
11341     * Checks if `value` is classified as an `Array` object.
11342     *
11343     * @static
11344     * @memberOf _
11345     * @since 0.1.0
11346     * @category Lang
11347     * @param {*} value The value to check.
11348     * @returns {boolean} Returns `true` if `value` is an array, else `false`.
11349     * @example
11350     *
11351     * _.isArray([1, 2, 3]);
11352     * // => true
11353     *
11354     * _.isArray(document.body.children);
11355     * // => false
11356     *
11357     * _.isArray('abc');
11358     * // => false
11359     *
11360     * _.isArray(_.noop);
11361     * // => false
11362     */
11363    var isArray = Array.isArray;
11364
11365    /**
11366     * Checks if `value` is classified as an `ArrayBuffer` object.
11367     *
11368     * @static
11369     * @memberOf _
11370     * @since 4.3.0
11371     * @category Lang
11372     * @param {*} value The value to check.
11373     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
11374     * @example
11375     *
11376     * _.isArrayBuffer(new ArrayBuffer(2));
11377     * // => true
11378     *
11379     * _.isArrayBuffer(new Array(2));
11380     * // => false
11381     */
11382    var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
11383
11384    /**
11385     * Checks if `value` is array-like. A value is considered array-like if it's
11386     * not a function and has a `value.length` that's an integer greater than or
11387     * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
11388     *
11389     * @static
11390     * @memberOf _
11391     * @since 4.0.0
11392     * @category Lang
11393     * @param {*} value The value to check.
11394     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
11395     * @example
11396     *
11397     * _.isArrayLike([1, 2, 3]);
11398     * // => true
11399     *
11400     * _.isArrayLike(document.body.children);
11401     * // => true
11402     *
11403     * _.isArrayLike('abc');
11404     * // => true
11405     *
11406     * _.isArrayLike(_.noop);
11407     * // => false
11408     */
11409    function isArrayLike(value) {
11410      return value != null && isLength(value.length) && !isFunction(value);
11411    }
11412
11413    /**
11414     * This method is like `_.isArrayLike` except that it also checks if `value`
11415     * is an object.
11416     *
11417     * @static
11418     * @memberOf _
11419     * @since 4.0.0
11420     * @category Lang
11421     * @param {*} value The value to check.
11422     * @returns {boolean} Returns `true` if `value` is an array-like object,
11423     *  else `false`.
11424     * @example
11425     *
11426     * _.isArrayLikeObject([1, 2, 3]);
11427     * // => true
11428     *
11429     * _.isArrayLikeObject(document.body.children);
11430     * // => true
11431     *
11432     * _.isArrayLikeObject('abc');
11433     * // => false
11434     *
11435     * _.isArrayLikeObject(_.noop);
11436     * // => false
11437     */
11438    function isArrayLikeObject(value) {
11439      return isObjectLike(value) && isArrayLike(value);
11440    }
11441
11442    /**
11443     * Checks if `value` is classified as a boolean primitive or object.
11444     *
11445     * @static
11446     * @memberOf _
11447     * @since 0.1.0
11448     * @category Lang
11449     * @param {*} value The value to check.
11450     * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
11451     * @example
11452     *
11453     * _.isBoolean(false);
11454     * // => true
11455     *
11456     * _.isBoolean(null);
11457     * // => false
11458     */
11459    function isBoolean(value) {
11460      return value === true || value === false ||
11461        (isObjectLike(value) && baseGetTag(value) == boolTag);
11462    }
11463
11464    /**
11465     * Checks if `value` is a buffer.
11466     *
11467     * @static
11468     * @memberOf _
11469     * @since 4.3.0
11470     * @category Lang
11471     * @param {*} value The value to check.
11472     * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
11473     * @example
11474     *
11475     * _.isBuffer(new Buffer(2));
11476     * // => true
11477     *
11478     * _.isBuffer(new Uint8Array(2));
11479     * // => false
11480     */
11481    var isBuffer = nativeIsBuffer || stubFalse;
11482
11483    /**
11484     * Checks if `value` is classified as a `Date` object.
11485     *
11486     * @static
11487     * @memberOf _
11488     * @since 0.1.0
11489     * @category Lang
11490     * @param {*} value The value to check.
11491     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
11492     * @example
11493     *
11494     * _.isDate(new Date);
11495     * // => true
11496     *
11497     * _.isDate('Mon April 23 2012');
11498     * // => false
11499     */
11500    var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
11501
11502    /**
11503     * Checks if `value` is likely a DOM element.
11504     *
11505     * @static
11506     * @memberOf _
11507     * @since 0.1.0
11508     * @category Lang
11509     * @param {*} value The value to check.
11510     * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
11511     * @example
11512     *
11513     * _.isElement(document.body);
11514     * // => true
11515     *
11516     * _.isElement('<body>');
11517     * // => false
11518     */
11519    function isElement(value) {
11520      return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
11521    }
11522
11523    /**
11524     * Checks if `value` is an empty object, collection, map, or set.
11525     *
11526     * Objects are considered empty if they have no own enumerable string keyed
11527     * properties.
11528     *
11529     * Array-like values such as `arguments` objects, arrays, buffers, strings, or
11530     * jQuery-like collections are considered empty if they have a `length` of `0`.
11531     * Similarly, maps and sets are considered empty if they have a `size` of `0`.
11532     *
11533     * @static
11534     * @memberOf _
11535     * @since 0.1.0
11536     * @category Lang
11537     * @param {*} value The value to check.
11538     * @returns {boolean} Returns `true` if `value` is empty, else `false`.
11539     * @example
11540     *
11541     * _.isEmpty(null);
11542     * // => true
11543     *
11544     * _.isEmpty(true);
11545     * // => true
11546     *
11547     * _.isEmpty(1);
11548     * // => true
11549     *
11550     * _.isEmpty([1, 2, 3]);
11551     * // => false
11552     *
11553     * _.isEmpty({ 'a': 1 });
11554     * // => false
11555     */
11556    function isEmpty(value) {
11557      if (value == null) {
11558        return true;
11559      }
11560      if (isArrayLike(value) &&
11561          (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
11562            isBuffer(value) || isTypedArray(value) || isArguments(value))) {
11563        return !value.length;
11564      }
11565      var tag = getTag(value);
11566      if (tag == mapTag || tag == setTag) {
11567        return !value.size;
11568      }
11569      if (isPrototype(value)) {
11570        return !baseKeys(value).length;
11571      }
11572      for (var key in value) {
11573        if (hasOwnProperty.call(value, key)) {
11574          return false;
11575        }
11576      }
11577      return true;
11578    }
11579
11580    /**
11581     * Performs a deep comparison between two values to determine if they are
11582     * equivalent.
11583     *
11584     * **Note:** This method supports comparing arrays, array buffers, booleans,
11585     * date objects, error objects, maps, numbers, `Object` objects, regexes,
11586     * sets, strings, symbols, and typed arrays. `Object` objects are compared
11587     * by their own, not inherited, enumerable properties. Functions and DOM
11588     * nodes are compared by strict equality, i.e. `===`.
11589     *
11590     * @static
11591     * @memberOf _
11592     * @since 0.1.0
11593     * @category Lang
11594     * @param {*} value The value to compare.
11595     * @param {*} other The other value to compare.
11596     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11597     * @example
11598     *
11599     * var object = { 'a': 1 };
11600     * var other = { 'a': 1 };
11601     *
11602     * _.isEqual(object, other);
11603     * // => true
11604     *
11605     * object === other;
11606     * // => false
11607     */
11608    function isEqual(value, other) {
11609      return baseIsEqual(value, other);
11610    }
11611
11612    /**
11613     * This method is like `_.isEqual` except that it accepts `customizer` which
11614     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
11615     * are handled by the method instead. The `customizer` is invoked with up to
11616     * six arguments: (objValue, othValue [, index|key, object, other, stack]).
11617     *
11618     * @static
11619     * @memberOf _
11620     * @since 4.0.0
11621     * @category Lang
11622     * @param {*} value The value to compare.
11623     * @param {*} other The other value to compare.
11624     * @param {Function} [customizer] The function to customize comparisons.
11625     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11626     * @example
11627     *
11628     * function isGreeting(value) {
11629     *   return /^h(?:i|ello)$/.test(value);
11630     * }
11631     *
11632     * function customizer(objValue, othValue) {
11633     *   if (isGreeting(objValue) && isGreeting(othValue)) {
11634     *     return true;
11635     *   }
11636     * }
11637     *
11638     * var array = ['hello', 'goodbye'];
11639     * var other = ['hi', 'goodbye'];
11640     *
11641     * _.isEqualWith(array, other, customizer);
11642     * // => true
11643     */
11644    function isEqualWith(value, other, customizer) {
11645      customizer = typeof customizer == 'function' ? customizer : undefined;
11646      var result = customizer ? customizer(value, other) : undefined;
11647      return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
11648    }
11649
11650    /**
11651     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
11652     * `SyntaxError`, `TypeError`, or `URIError` object.
11653     *
11654     * @static
11655     * @memberOf _
11656     * @since 3.0.0
11657     * @category Lang
11658     * @param {*} value The value to check.
11659     * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
11660     * @example
11661     *
11662     * _.isError(new Error);
11663     * // => true
11664     *
11665     * _.isError(Error);
11666     * // => false
11667     */
11668    function isError(value) {
11669      if (!isObjectLike(value)) {
11670        return false;
11671      }
11672      var tag = baseGetTag(value);
11673      return tag == errorTag || tag == domExcTag ||
11674        (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
11675    }
11676
11677    /**
11678     * Checks if `value` is a finite primitive number.
11679     *
11680     * **Note:** This method is based on
11681     * [`Number.isFinite`](https://mdn.io/Number/isFinite).
11682     *
11683     * @static
11684     * @memberOf _
11685     * @since 0.1.0
11686     * @category Lang
11687     * @param {*} value The value to check.
11688     * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
11689     * @example
11690     *
11691     * _.isFinite(3);
11692     * // => true
11693     *
11694     * _.isFinite(Number.MIN_VALUE);
11695     * // => true
11696     *
11697     * _.isFinite(Infinity);
11698     * // => false
11699     *
11700     * _.isFinite('3');
11701     * // => false
11702     */
11703    function isFinite(value) {
11704      return typeof value == 'number' && nativeIsFinite(value);
11705    }
11706
11707    /**
11708     * Checks if `value` is classified as a `Function` object.
11709     *
11710     * @static
11711     * @memberOf _
11712     * @since 0.1.0
11713     * @category Lang
11714     * @param {*} value The value to check.
11715     * @returns {boolean} Returns `true` if `value` is a function, else `false`.
11716     * @example
11717     *
11718     * _.isFunction(_);
11719     * // => true
11720     *
11721     * _.isFunction(/abc/);
11722     * // => false
11723     */
11724    function isFunction(value) {
11725      if (!isObject(value)) {
11726        return false;
11727      }
11728      // The use of `Object#toString` avoids issues with the `typeof` operator
11729      // in Safari 9 which returns 'object' for typed arrays and other constructors.
11730      var tag = baseGetTag(value);
11731      return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
11732    }
11733
11734    /**
11735     * Checks if `value` is an integer.
11736     *
11737     * **Note:** This method is based on
11738     * [`Number.isInteger`](https://mdn.io/Number/isInteger).
11739     *
11740     * @static
11741     * @memberOf _
11742     * @since 4.0.0
11743     * @category Lang
11744     * @param {*} value The value to check.
11745     * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
11746     * @example
11747     *
11748     * _.isInteger(3);
11749     * // => true
11750     *
11751     * _.isInteger(Number.MIN_VALUE);
11752     * // => false
11753     *
11754     * _.isInteger(Infinity);
11755     * // => false
11756     *
11757     * _.isInteger('3');
11758     * // => false
11759     */
11760    function isInteger(value) {
11761      return typeof value == 'number' && value == toInteger(value);
11762    }
11763
11764    /**
11765     * Checks if `value` is a valid array-like length.
11766     *
11767     * **Note:** This method is loosely based on
11768     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
11769     *
11770     * @static
11771     * @memberOf _
11772     * @since 4.0.0
11773     * @category Lang
11774     * @param {*} value The value to check.
11775     * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
11776     * @example
11777     *
11778     * _.isLength(3);
11779     * // => true
11780     *
11781     * _.isLength(Number.MIN_VALUE);
11782     * // => false
11783     *
11784     * _.isLength(Infinity);
11785     * // => false
11786     *
11787     * _.isLength('3');
11788     * // => false
11789     */
11790    function isLength(value) {
11791      return typeof value == 'number' &&
11792        value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
11793    }
11794
11795    /**
11796     * Checks if `value` is the
11797     * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
11798     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
11799     *
11800     * @static
11801     * @memberOf _
11802     * @since 0.1.0
11803     * @category Lang
11804     * @param {*} value The value to check.
11805     * @returns {boolean} Returns `true` if `value` is an object, else `false`.
11806     * @example
11807     *
11808     * _.isObject({});
11809     * // => true
11810     *
11811     * _.isObject([1, 2, 3]);
11812     * // => true
11813     *
11814     * _.isObject(_.noop);
11815     * // => true
11816     *
11817     * _.isObject(null);
11818     * // => false
11819     */
11820    function isObject(value) {
11821      var type = typeof value;
11822      return value != null && (type == 'object' || type == 'function');
11823    }
11824
11825    /**
11826     * Checks if `value` is object-like. A value is object-like if it's not `null`
11827     * and has a `typeof` result of "object".
11828     *
11829     * @static
11830     * @memberOf _
11831     * @since 4.0.0
11832     * @category Lang
11833     * @param {*} value The value to check.
11834     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
11835     * @example
11836     *
11837     * _.isObjectLike({});
11838     * // => true
11839     *
11840     * _.isObjectLike([1, 2, 3]);
11841     * // => true
11842     *
11843     * _.isObjectLike(_.noop);
11844     * // => false
11845     *
11846     * _.isObjectLike(null);
11847     * // => false
11848     */
11849    function isObjectLike(value) {
11850      return value != null && typeof value == 'object';
11851    }
11852
11853    /**
11854     * Checks if `value` is classified as a `Map` object.
11855     *
11856     * @static
11857     * @memberOf _
11858     * @since 4.3.0
11859     * @category Lang
11860     * @param {*} value The value to check.
11861     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
11862     * @example
11863     *
11864     * _.isMap(new Map);
11865     * // => true
11866     *
11867     * _.isMap(new WeakMap);
11868     * // => false
11869     */
11870    var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
11871
11872    /**
11873     * Performs a partial deep comparison between `object` and `source` to
11874     * determine if `object` contains equivalent property values.
11875     *
11876     * **Note:** This method is equivalent to `_.matches` when `source` is
11877     * partially applied.
11878     *
11879     * Partial comparisons will match empty array and empty object `source`
11880     * values against any array or object value, respectively. See `_.isEqual`
11881     * for a list of supported value comparisons.
11882     *
11883     * @static
11884     * @memberOf _
11885     * @since 3.0.0
11886     * @category Lang
11887     * @param {Object} object The object to inspect.
11888     * @param {Object} source The object of property values to match.
11889     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
11890     * @example
11891     *
11892     * var object = { 'a': 1, 'b': 2 };
11893     *
11894     * _.isMatch(object, { 'b': 2 });
11895     * // => true
11896     *
11897     * _.isMatch(object, { 'b': 1 });
11898     * // => false
11899     */
11900    function isMatch(object, source) {
11901      return object === source || baseIsMatch(object, source, getMatchData(source));
11902    }
11903
11904    /**
11905     * This method is like `_.isMatch` except that it accepts `customizer` which
11906     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
11907     * are handled by the method instead. The `customizer` is invoked with five
11908     * arguments: (objValue, srcValue, index|key, object, source).
11909     *
11910     * @static
11911     * @memberOf _
11912     * @since 4.0.0
11913     * @category Lang
11914     * @param {Object} object The object to inspect.
11915     * @param {Object} source The object of property values to match.
11916     * @param {Function} [customizer] The function to customize comparisons.
11917     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
11918     * @example
11919     *
11920     * function isGreeting(value) {
11921     *   return /^h(?:i|ello)$/.test(value);
11922     * }
11923     *
11924     * function customizer(objValue, srcValue) {
11925     *   if (isGreeting(objValue) && isGreeting(srcValue)) {
11926     *     return true;
11927     *   }
11928     * }
11929     *
11930     * var object = { 'greeting': 'hello' };
11931     * var source = { 'greeting': 'hi' };
11932     *
11933     * _.isMatchWith(object, source, customizer);
11934     * // => true
11935     */
11936    function isMatchWith(object, source, customizer) {
11937      customizer = typeof customizer == 'function' ? customizer : undefined;
11938      return baseIsMatch(object, source, getMatchData(source), customizer);
11939    }
11940
11941    /**
11942     * Checks if `value` is `NaN`.
11943     *
11944     * **Note:** This method is based on
11945     * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
11946     * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
11947     * `undefined` and other non-number values.
11948     *
11949     * @static
11950     * @memberOf _
11951     * @since 0.1.0
11952     * @category Lang
11953     * @param {*} value The value to check.
11954     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
11955     * @example
11956     *
11957     * _.isNaN(NaN);
11958     * // => true
11959     *
11960     * _.isNaN(new Number(NaN));
11961     * // => true
11962     *
11963     * isNaN(undefined);
11964     * // => true
11965     *
11966     * _.isNaN(undefined);
11967     * // => false
11968     */
11969    function isNaN(value) {
11970      // An `NaN` primitive is the only value that is not equal to itself.
11971      // Perform the `toStringTag` check first to avoid errors with some
11972      // ActiveX objects in IE.
11973      return isNumber(value) && value != +value;
11974    }
11975
11976    /**
11977     * Checks if `value` is a pristine native function.
11978     *
11979     * **Note:** This method can't reliably detect native functions in the presence
11980     * of the core-js package because core-js circumvents this kind of detection.
11981     * Despite multiple requests, the core-js maintainer has made it clear: any
11982     * attempt to fix the detection will be obstructed. As a result, we're left
11983     * with little choice but to throw an error. Unfortunately, this also affects
11984     * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
11985     * which rely on core-js.
11986     *
11987     * @static
11988     * @memberOf _
11989     * @since 3.0.0
11990     * @category Lang
11991     * @param {*} value The value to check.
11992     * @returns {boolean} Returns `true` if `value` is a native function,
11993     *  else `false`.
11994     * @example
11995     *
11996     * _.isNative(Array.prototype.push);
11997     * // => true
11998     *
11999     * _.isNative(_);
12000     * // => false
12001     */
12002    function isNative(value) {
12003      if (isMaskable(value)) {
12004        throw new Error(CORE_ERROR_TEXT);
12005      }
12006      return baseIsNative(value);
12007    }
12008
12009    /**
12010     * Checks if `value` is `null`.
12011     *
12012     * @static
12013     * @memberOf _
12014     * @since 0.1.0
12015     * @category Lang
12016     * @param {*} value The value to check.
12017     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
12018     * @example
12019     *
12020     * _.isNull(null);
12021     * // => true
12022     *
12023     * _.isNull(void 0);
12024     * // => false
12025     */
12026    function isNull(value) {
12027      return value === null;
12028    }
12029
12030    /**
12031     * Checks if `value` is `null` or `undefined`.
12032     *
12033     * @static
12034     * @memberOf _
12035     * @since 4.0.0
12036     * @category Lang
12037     * @param {*} value The value to check.
12038     * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
12039     * @example
12040     *
12041     * _.isNil(null);
12042     * // => true
12043     *
12044     * _.isNil(void 0);
12045     * // => true
12046     *
12047     * _.isNil(NaN);
12048     * // => false
12049     */
12050    function isNil(value) {
12051      return value == null;
12052    }
12053
12054    /**
12055     * Checks if `value` is classified as a `Number` primitive or object.
12056     *
12057     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
12058     * classified as numbers, use the `_.isFinite` method.
12059     *
12060     * @static
12061     * @memberOf _
12062     * @since 0.1.0
12063     * @category Lang
12064     * @param {*} value The value to check.
12065     * @returns {boolean} Returns `true` if `value` is a number, else `false`.
12066     * @example
12067     *
12068     * _.isNumber(3);
12069     * // => true
12070     *
12071     * _.isNumber(Number.MIN_VALUE);
12072     * // => true
12073     *
12074     * _.isNumber(Infinity);
12075     * // => true
12076     *
12077     * _.isNumber('3');
12078     * // => false
12079     */
12080    function isNumber(value) {
12081      return typeof value == 'number' ||
12082        (isObjectLike(value) && baseGetTag(value) == numberTag);
12083    }
12084
12085    /**
12086     * Checks if `value` is a plain object, that is, an object created by the
12087     * `Object` constructor or one with a `[[Prototype]]` of `null`.
12088     *
12089     * @static
12090     * @memberOf _
12091     * @since 0.8.0
12092     * @category Lang
12093     * @param {*} value The value to check.
12094     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
12095     * @example
12096     *
12097     * function Foo() {
12098     *   this.a = 1;
12099     * }
12100     *
12101     * _.isPlainObject(new Foo);
12102     * // => false
12103     *
12104     * _.isPlainObject([1, 2, 3]);
12105     * // => false
12106     *
12107     * _.isPlainObject({ 'x': 0, 'y': 0 });
12108     * // => true
12109     *
12110     * _.isPlainObject(Object.create(null));
12111     * // => true
12112     */
12113    function isPlainObject(value) {
12114      if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
12115        return false;
12116      }
12117      var proto = getPrototype(value);
12118      if (proto === null) {
12119        return true;
12120      }
12121      var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
12122      return typeof Ctor == 'function' && Ctor instanceof Ctor &&
12123        funcToString.call(Ctor) == objectCtorString;
12124    }
12125
12126    /**
12127     * Checks if `value` is classified as a `RegExp` object.
12128     *
12129     * @static
12130     * @memberOf _
12131     * @since 0.1.0
12132     * @category Lang
12133     * @param {*} value The value to check.
12134     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
12135     * @example
12136     *
12137     * _.isRegExp(/abc/);
12138     * // => true
12139     *
12140     * _.isRegExp('/abc/');
12141     * // => false
12142     */
12143    var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
12144
12145    /**
12146     * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
12147     * double precision number which isn't the result of a rounded unsafe integer.
12148     *
12149     * **Note:** This method is based on
12150     * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
12151     *
12152     * @static
12153     * @memberOf _
12154     * @since 4.0.0
12155     * @category Lang
12156     * @param {*} value The value to check.
12157     * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
12158     * @example
12159     *
12160     * _.isSafeInteger(3);
12161     * // => true
12162     *
12163     * _.isSafeInteger(Number.MIN_VALUE);
12164     * // => false
12165     *
12166     * _.isSafeInteger(Infinity);
12167     * // => false
12168     *
12169     * _.isSafeInteger('3');
12170     * // => false
12171     */
12172    function isSafeInteger(value) {
12173      return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
12174    }
12175
12176    /**
12177     * Checks if `value` is classified as a `Set` object.
12178     *
12179     * @static
12180     * @memberOf _
12181     * @since 4.3.0
12182     * @category Lang
12183     * @param {*} value The value to check.
12184     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
12185     * @example
12186     *
12187     * _.isSet(new Set);
12188     * // => true
12189     *
12190     * _.isSet(new WeakSet);
12191     * // => false
12192     */
12193    var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
12194
12195    /**
12196     * Checks if `value` is classified as a `String` primitive or object.
12197     *
12198     * @static
12199     * @since 0.1.0
12200     * @memberOf _
12201     * @category Lang
12202     * @param {*} value The value to check.
12203     * @returns {boolean} Returns `true` if `value` is a string, else `false`.
12204     * @example
12205     *
12206     * _.isString('abc');
12207     * // => true
12208     *
12209     * _.isString(1);
12210     * // => false
12211     */
12212    function isString(value) {
12213      return typeof value == 'string' ||
12214        (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
12215    }
12216
12217    /**
12218     * Checks if `value` is classified as a `Symbol` primitive or object.
12219     *
12220     * @static
12221     * @memberOf _
12222     * @since 4.0.0
12223     * @category Lang
12224     * @param {*} value The value to check.
12225     * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
12226     * @example
12227     *
12228     * _.isSymbol(Symbol.iterator);
12229     * // => true
12230     *
12231     * _.isSymbol('abc');
12232     * // => false
12233     */
12234    function isSymbol(value) {
12235      return typeof value == 'symbol' ||
12236        (isObjectLike(value) && baseGetTag(value) == symbolTag);
12237    }
12238
12239    /**
12240     * Checks if `value` is classified as a typed array.
12241     *
12242     * @static
12243     * @memberOf _
12244     * @since 3.0.0
12245     * @category Lang
12246     * @param {*} value The value to check.
12247     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
12248     * @example
12249     *
12250     * _.isTypedArray(new Uint8Array);
12251     * // => true
12252     *
12253     * _.isTypedArray([]);
12254     * // => false
12255     */
12256    var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
12257
12258    /**
12259     * Checks if `value` is `undefined`.
12260     *
12261     * @static
12262     * @since 0.1.0
12263     * @memberOf _
12264     * @category Lang
12265     * @param {*} value The value to check.
12266     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
12267     * @example
12268     *
12269     * _.isUndefined(void 0);
12270     * // => true
12271     *
12272     * _.isUndefined(null);
12273     * // => false
12274     */
12275    function isUndefined(value) {
12276      return value === undefined;
12277    }
12278
12279    /**
12280     * Checks if `value` is classified as a `WeakMap` object.
12281     *
12282     * @static
12283     * @memberOf _
12284     * @since 4.3.0
12285     * @category Lang
12286     * @param {*} value The value to check.
12287     * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
12288     * @example
12289     *
12290     * _.isWeakMap(new WeakMap);
12291     * // => true
12292     *
12293     * _.isWeakMap(new Map);
12294     * // => false
12295     */
12296    function isWeakMap(value) {
12297      return isObjectLike(value) && getTag(value) == weakMapTag;
12298    }
12299
12300    /**
12301     * Checks if `value` is classified as a `WeakSet` object.
12302     *
12303     * @static
12304     * @memberOf _
12305     * @since 4.3.0
12306     * @category Lang
12307     * @param {*} value The value to check.
12308     * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
12309     * @example
12310     *
12311     * _.isWeakSet(new WeakSet);
12312     * // => true
12313     *
12314     * _.isWeakSet(new Set);
12315     * // => false
12316     */
12317    function isWeakSet(value) {
12318      return isObjectLike(value) && baseGetTag(value) == weakSetTag;
12319    }
12320
12321    /**
12322     * Checks if `value` is less than `other`.
12323     *
12324     * @static
12325     * @memberOf _
12326     * @since 3.9.0
12327     * @category Lang
12328     * @param {*} value The value to compare.
12329     * @param {*} other The other value to compare.
12330     * @returns {boolean} Returns `true` if `value` is less than `other`,
12331     *  else `false`.
12332     * @see _.gt
12333     * @example
12334     *
12335     * _.lt(1, 3);
12336     * // => true
12337     *
12338     * _.lt(3, 3);
12339     * // => false
12340     *
12341     * _.lt(3, 1);
12342     * // => false
12343     */
12344    var lt = createRelationalOperation(baseLt);
12345
12346    /**
12347     * Checks if `value` is less than or equal to `other`.
12348     *
12349     * @static
12350     * @memberOf _
12351     * @since 3.9.0
12352     * @category Lang
12353     * @param {*} value The value to compare.
12354     * @param {*} other The other value to compare.
12355     * @returns {boolean} Returns `true` if `value` is less than or equal to
12356     *  `other`, else `false`.
12357     * @see _.gte
12358     * @example
12359     *
12360     * _.lte(1, 3);
12361     * // => true
12362     *
12363     * _.lte(3, 3);
12364     * // => true
12365     *
12366     * _.lte(3, 1);
12367     * // => false
12368     */
12369    var lte = createRelationalOperation(function(value, other) {
12370      return value <= other;
12371    });
12372
12373    /**
12374     * Converts `value` to an array.
12375     *
12376     * @static
12377     * @since 0.1.0
12378     * @memberOf _
12379     * @category Lang
12380     * @param {*} value The value to convert.
12381     * @returns {Array} Returns the converted array.
12382     * @example
12383     *
12384     * _.toArray({ 'a': 1, 'b': 2 });
12385     * // => [1, 2]
12386     *
12387     * _.toArray('abc');
12388     * // => ['a', 'b', 'c']
12389     *
12390     * _.toArray(1);
12391     * // => []
12392     *
12393     * _.toArray(null);
12394     * // => []
12395     */
12396    function toArray(value) {
12397      if (!value) {
12398        return [];
12399      }
12400      if (isArrayLike(value)) {
12401        return isString(value) ? stringToArray(value) : copyArray(value);
12402      }
12403      if (symIterator && value[symIterator]) {
12404        return iteratorToArray(value[symIterator]());
12405      }
12406      var tag = getTag(value),
12407          func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
12408
12409      return func(value);
12410    }
12411
12412    /**
12413     * Converts `value` to a finite number.
12414     *
12415     * @static
12416     * @memberOf _
12417     * @since 4.12.0
12418     * @category Lang
12419     * @param {*} value The value to convert.
12420     * @returns {number} Returns the converted number.
12421     * @example
12422     *
12423     * _.toFinite(3.2);
12424     * // => 3.2
12425     *
12426     * _.toFinite(Number.MIN_VALUE);
12427     * // => 5e-324
12428     *
12429     * _.toFinite(Infinity);
12430     * // => 1.7976931348623157e+308
12431     *
12432     * _.toFinite('3.2');
12433     * // => 3.2
12434     */
12435    function toFinite(value) {
12436      if (!value) {
12437        return value === 0 ? value : 0;
12438      }
12439      value = toNumber(value);
12440      if (value === INFINITY || value === -INFINITY) {
12441        var sign = (value < 0 ? -1 : 1);
12442        return sign * MAX_INTEGER;
12443      }
12444      return value === value ? value : 0;
12445    }
12446
12447    /**
12448     * Converts `value` to an integer.
12449     *
12450     * **Note:** This method is loosely based on
12451     * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
12452     *
12453     * @static
12454     * @memberOf _
12455     * @since 4.0.0
12456     * @category Lang
12457     * @param {*} value The value to convert.
12458     * @returns {number} Returns the converted integer.
12459     * @example
12460     *
12461     * _.toInteger(3.2);
12462     * // => 3
12463     *
12464     * _.toInteger(Number.MIN_VALUE);
12465     * // => 0
12466     *
12467     * _.toInteger(Infinity);
12468     * // => 1.7976931348623157e+308
12469     *
12470     * _.toInteger('3.2');
12471     * // => 3
12472     */
12473    function toInteger(value) {
12474      var result = toFinite(value),
12475          remainder = result % 1;
12476
12477      return result === result ? (remainder ? result - remainder : result) : 0;
12478    }
12479
12480    /**
12481     * Converts `value` to an integer suitable for use as the length of an
12482     * array-like object.
12483     *
12484     * **Note:** This method is based on
12485     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12486     *
12487     * @static
12488     * @memberOf _
12489     * @since 4.0.0
12490     * @category Lang
12491     * @param {*} value The value to convert.
12492     * @returns {number} Returns the converted integer.
12493     * @example
12494     *
12495     * _.toLength(3.2);
12496     * // => 3
12497     *
12498     * _.toLength(Number.MIN_VALUE);
12499     * // => 0
12500     *
12501     * _.toLength(Infinity);
12502     * // => 4294967295
12503     *
12504     * _.toLength('3.2');
12505     * // => 3
12506     */
12507    function toLength(value) {
12508      return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
12509    }
12510
12511    /**
12512     * Converts `value` to a number.
12513     *
12514     * @static
12515     * @memberOf _
12516     * @since 4.0.0
12517     * @category Lang
12518     * @param {*} value The value to process.
12519     * @returns {number} Returns the number.
12520     * @example
12521     *
12522     * _.toNumber(3.2);
12523     * // => 3.2
12524     *
12525     * _.toNumber(Number.MIN_VALUE);
12526     * // => 5e-324
12527     *
12528     * _.toNumber(Infinity);
12529     * // => Infinity
12530     *
12531     * _.toNumber('3.2');
12532     * // => 3.2
12533     */
12534    function toNumber(value) {
12535      if (typeof value == 'number') {
12536        return value;
12537      }
12538      if (isSymbol(value)) {
12539        return NAN;
12540      }
12541      if (isObject(value)) {
12542        var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
12543        value = isObject(other) ? (other + '') : other;
12544      }
12545      if (typeof value != 'string') {
12546        return value === 0 ? value : +value;
12547      }
12548      value = baseTrim(value);
12549      var isBinary = reIsBinary.test(value);
12550      return (isBinary || reIsOctal.test(value))
12551        ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
12552        : (reIsBadHex.test(value) ? NAN : +value);
12553    }
12554
12555    /**
12556     * Converts `value` to a plain object flattening inherited enumerable string
12557     * keyed properties of `value` to own properties of the plain object.
12558     *
12559     * @static
12560     * @memberOf _
12561     * @since 3.0.0
12562     * @category Lang
12563     * @param {*} value The value to convert.
12564     * @returns {Object} Returns the converted plain object.
12565     * @example
12566     *
12567     * function Foo() {
12568     *   this.b = 2;
12569     * }
12570     *
12571     * Foo.prototype.c = 3;
12572     *
12573     * _.assign({ 'a': 1 }, new Foo);
12574     * // => { 'a': 1, 'b': 2 }
12575     *
12576     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
12577     * // => { 'a': 1, 'b': 2, 'c': 3 }
12578     */
12579    function toPlainObject(value) {
12580      return copyObject(value, keysIn(value));
12581    }
12582
12583    /**
12584     * Converts `value` to a safe integer. A safe integer can be compared and
12585     * represented correctly.
12586     *
12587     * @static
12588     * @memberOf _
12589     * @since 4.0.0
12590     * @category Lang
12591     * @param {*} value The value to convert.
12592     * @returns {number} Returns the converted integer.
12593     * @example
12594     *
12595     * _.toSafeInteger(3.2);
12596     * // => 3
12597     *
12598     * _.toSafeInteger(Number.MIN_VALUE);
12599     * // => 0
12600     *
12601     * _.toSafeInteger(Infinity);
12602     * // => 9007199254740991
12603     *
12604     * _.toSafeInteger('3.2');
12605     * // => 3
12606     */
12607    function toSafeInteger(value) {
12608      return value
12609        ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
12610        : (value === 0 ? value : 0);
12611    }
12612
12613    /**
12614     * Converts `value` to a string. An empty string is returned for `null`
12615     * and `undefined` values. The sign of `-0` is preserved.
12616     *
12617     * @static
12618     * @memberOf _
12619     * @since 4.0.0
12620     * @category Lang
12621     * @param {*} value The value to convert.
12622     * @returns {string} Returns the converted string.
12623     * @example
12624     *
12625     * _.toString(null);
12626     * // => ''
12627     *
12628     * _.toString(-0);
12629     * // => '-0'
12630     *
12631     * _.toString([1, 2, 3]);
12632     * // => '1,2,3'
12633     */
12634    function toString(value) {
12635      return value == null ? '' : baseToString(value);
12636    }
12637
12638    /*------------------------------------------------------------------------*/
12639
12640    /**
12641     * Assigns own enumerable string keyed properties of source objects to the
12642     * destination object. Source objects are applied from left to right.
12643     * Subsequent sources overwrite property assignments of previous sources.
12644     *
12645     * **Note:** This method mutates `object` and is loosely based on
12646     * [`Object.assign`](https://mdn.io/Object/assign).
12647     *
12648     * @static
12649     * @memberOf _
12650     * @since 0.10.0
12651     * @category Object
12652     * @param {Object} object The destination object.
12653     * @param {...Object} [sources] The source objects.
12654     * @returns {Object} Returns `object`.
12655     * @see _.assignIn
12656     * @example
12657     *
12658     * function Foo() {
12659     *   this.a = 1;
12660     * }
12661     *
12662     * function Bar() {
12663     *   this.c = 3;
12664     * }
12665     *
12666     * Foo.prototype.b = 2;
12667     * Bar.prototype.d = 4;
12668     *
12669     * _.assign({ 'a': 0 }, new Foo, new Bar);
12670     * // => { 'a': 1, 'c': 3 }
12671     */
12672    var assign = createAssigner(function(object, source) {
12673      if (isPrototype(source) || isArrayLike(source)) {
12674        copyObject(source, keys(source), object);
12675        return;
12676      }
12677      for (var key in source) {
12678        if (hasOwnProperty.call(source, key)) {
12679          assignValue(object, key, source[key]);
12680        }
12681      }
12682    });
12683
12684    /**
12685     * This method is like `_.assign` except that it iterates over own and
12686     * inherited source properties.
12687     *
12688     * **Note:** This method mutates `object`.
12689     *
12690     * @static
12691     * @memberOf _
12692     * @since 4.0.0
12693     * @alias extend
12694     * @category Object
12695     * @param {Object} object The destination object.
12696     * @param {...Object} [sources] The source objects.
12697     * @returns {Object} Returns `object`.
12698     * @see _.assign
12699     * @example
12700     *
12701     * function Foo() {
12702     *   this.a = 1;
12703     * }
12704     *
12705     * function Bar() {
12706     *   this.c = 3;
12707     * }
12708     *
12709     * Foo.prototype.b = 2;
12710     * Bar.prototype.d = 4;
12711     *
12712     * _.assignIn({ 'a': 0 }, new Foo, new Bar);
12713     * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
12714     */
12715    var assignIn = createAssigner(function(object, source) {
12716      copyObject(source, keysIn(source), object);
12717    });
12718
12719    /**
12720     * This method is like `_.assignIn` except that it accepts `customizer`
12721     * which is invoked to produce the assigned values. If `customizer` returns
12722     * `undefined`, assignment is handled by the method instead. The `customizer`
12723     * is invoked with five arguments: (objValue, srcValue, key, object, source).
12724     *
12725     * **Note:** This method mutates `object`.
12726     *
12727     * @static
12728     * @memberOf _
12729     * @since 4.0.0
12730     * @alias extendWith
12731     * @category Object
12732     * @param {Object} object The destination object.
12733     * @param {...Object} sources The source objects.
12734     * @param {Function} [customizer] The function to customize assigned values.
12735     * @returns {Object} Returns `object`.
12736     * @see _.assignWith
12737     * @example
12738     *
12739     * function customizer(objValue, srcValue) {
12740     *   return _.isUndefined(objValue) ? srcValue : objValue;
12741     * }
12742     *
12743     * var defaults = _.partialRight(_.assignInWith, customizer);
12744     *
12745     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12746     * // => { 'a': 1, 'b': 2 }
12747     */
12748    var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
12749      copyObject(source, keysIn(source), object, customizer);
12750    });
12751
12752    /**
12753     * This method is like `_.assign` except that it accepts `customizer`
12754     * which is invoked to produce the assigned values. If `customizer` returns
12755     * `undefined`, assignment is handled by the method instead. The `customizer`
12756     * is invoked with five arguments: (objValue, srcValue, key, object, source).
12757     *
12758     * **Note:** This method mutates `object`.
12759     *
12760     * @static
12761     * @memberOf _
12762     * @since 4.0.0
12763     * @category Object
12764     * @param {Object} object The destination object.
12765     * @param {...Object} sources The source objects.
12766     * @param {Function} [customizer] The function to customize assigned values.
12767     * @returns {Object} Returns `object`.
12768     * @see _.assignInWith
12769     * @example
12770     *
12771     * function customizer(objValue, srcValue) {
12772     *   return _.isUndefined(objValue) ? srcValue : objValue;
12773     * }
12774     *
12775     * var defaults = _.partialRight(_.assignWith, customizer);
12776     *
12777     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12778     * // => { 'a': 1, 'b': 2 }
12779     */
12780    var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
12781      copyObject(source, keys(source), object, customizer);
12782    });
12783
12784    /**
12785     * Creates an array of values corresponding to `paths` of `object`.
12786     *
12787     * @static
12788     * @memberOf _
12789     * @since 1.0.0
12790     * @category Object
12791     * @param {Object} object The object to iterate over.
12792     * @param {...(string|string[])} [paths] The property paths to pick.
12793     * @returns {Array} Returns the picked values.
12794     * @example
12795     *
12796     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
12797     *
12798     * _.at(object, ['a[0].b.c', 'a[1]']);
12799     * // => [3, 4]
12800     */
12801    var at = flatRest(baseAt);
12802
12803    /**
12804     * Creates an object that inherits from the `prototype` object. If a
12805     * `properties` object is given, its own enumerable string keyed properties
12806     * are assigned to the created object.
12807     *
12808     * @static
12809     * @memberOf _
12810     * @since 2.3.0
12811     * @category Object
12812     * @param {Object} prototype The object to inherit from.
12813     * @param {Object} [properties] The properties to assign to the object.
12814     * @returns {Object} Returns the new object.
12815     * @example
12816     *
12817     * function Shape() {
12818     *   this.x = 0;
12819     *   this.y = 0;
12820     * }
12821     *
12822     * function Circle() {
12823     *   Shape.call(this);
12824     * }
12825     *
12826     * Circle.prototype = _.create(Shape.prototype, {
12827     *   'constructor': Circle
12828     * });
12829     *
12830     * var circle = new Circle;
12831     * circle instanceof Circle;
12832     * // => true
12833     *
12834     * circle instanceof Shape;
12835     * // => true
12836     */
12837    function create(prototype, properties) {
12838      var result = baseCreate(prototype);
12839      return properties == null ? result : baseAssign(result, properties);
12840    }
12841
12842    /**
12843     * Assigns own and inherited enumerable string keyed properties of source
12844     * objects to the destination object for all destination properties that
12845     * resolve to `undefined`. Source objects are applied from left to right.
12846     * Once a property is set, additional values of the same property are ignored.
12847     *
12848     * **Note:** This method mutates `object`.
12849     *
12850     * @static
12851     * @since 0.1.0
12852     * @memberOf _
12853     * @category Object
12854     * @param {Object} object The destination object.
12855     * @param {...Object} [sources] The source objects.
12856     * @returns {Object} Returns `object`.
12857     * @see _.defaultsDeep
12858     * @example
12859     *
12860     * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12861     * // => { 'a': 1, 'b': 2 }
12862     */
12863    var defaults = baseRest(function(object, sources) {
12864      object = Object(object);
12865
12866      var index = -1;
12867      var length = sources.length;
12868      var guard = length > 2 ? sources[2] : undefined;
12869
12870      if (guard && isIterateeCall(sources[0], sources[1], guard)) {
12871        length = 1;
12872      }
12873
12874      while (++index < length) {
12875        var source = sources[index];
12876        var props = keysIn(source);
12877        var propsIndex = -1;
12878        var propsLength = props.length;
12879
12880        while (++propsIndex < propsLength) {
12881          var key = props[propsIndex];
12882          var value = object[key];
12883
12884          if (value === undefined ||
12885              (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
12886            object[key] = source[key];
12887          }
12888        }
12889      }
12890
12891      return object;
12892    });
12893
12894    /**
12895     * This method is like `_.defaults` except that it recursively assigns
12896     * default properties.
12897     *
12898     * **Note:** This method mutates `object`.
12899     *
12900     * @static
12901     * @memberOf _
12902     * @since 3.10.0
12903     * @category Object
12904     * @param {Object} object The destination object.
12905     * @param {...Object} [sources] The source objects.
12906     * @returns {Object} Returns `object`.
12907     * @see _.defaults
12908     * @example
12909     *
12910     * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
12911     * // => { 'a': { 'b': 2, 'c': 3 } }
12912     */
12913    var defaultsDeep = baseRest(function(args) {
12914      args.push(undefined, customDefaultsMerge);
12915      return apply(mergeWith, undefined, args);
12916    });
12917
12918    /**
12919     * This method is like `_.find` except that it returns the key of the first
12920     * element `predicate` returns truthy for instead of the element itself.
12921     *
12922     * @static
12923     * @memberOf _
12924     * @since 1.1.0
12925     * @category Object
12926     * @param {Object} object The object to inspect.
12927     * @param {Function} [predicate=_.identity] The function invoked per iteration.
12928     * @returns {string|undefined} Returns the key of the matched element,
12929     *  else `undefined`.
12930     * @example
12931     *
12932     * var users = {
12933     *   'barney':  { 'age': 36, 'active': true },
12934     *   'fred':    { 'age': 40, 'active': false },
12935     *   'pebbles': { 'age': 1,  'active': true }
12936     * };
12937     *
12938     * _.findKey(users, function(o) { return o.age < 40; });
12939     * // => 'barney' (iteration order is not guaranteed)
12940     *
12941     * // The `_.matches` iteratee shorthand.
12942     * _.findKey(users, { 'age': 1, 'active': true });
12943     * // => 'pebbles'
12944     *
12945     * // The `_.matchesProperty` iteratee shorthand.
12946     * _.findKey(users, ['active', false]);
12947     * // => 'fred'
12948     *
12949     * // The `_.property` iteratee shorthand.
12950     * _.findKey(users, 'active');
12951     * // => 'barney'
12952     */
12953    function findKey(object, predicate) {
12954      return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
12955    }
12956
12957    /**
12958     * This method is like `_.findKey` except that it iterates over elements of
12959     * a collection in the opposite order.
12960     *
12961     * @static
12962     * @memberOf _
12963     * @since 2.0.0
12964     * @category Object
12965     * @param {Object} object The object to inspect.
12966     * @param {Function} [predicate=_.identity] The function invoked per iteration.
12967     * @returns {string|undefined} Returns the key of the matched element,
12968     *  else `undefined`.
12969     * @example
12970     *
12971     * var users = {
12972     *   'barney':  { 'age': 36, 'active': true },
12973     *   'fred':    { 'age': 40, 'active': false },
12974     *   'pebbles': { 'age': 1,  'active': true }
12975     * };
12976     *
12977     * _.findLastKey(users, function(o) { return o.age < 40; });
12978     * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
12979     *
12980     * // The `_.matches` iteratee shorthand.
12981     * _.findLastKey(users, { 'age': 36, 'active': true });
12982     * // => 'barney'
12983     *
12984     * // The `_.matchesProperty` iteratee shorthand.
12985     * _.findLastKey(users, ['active', false]);
12986     * // => 'fred'
12987     *
12988     * // The `_.property` iteratee shorthand.
12989     * _.findLastKey(users, 'active');
12990     * // => 'pebbles'
12991     */
12992    function findLastKey(object, predicate) {
12993      return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
12994    }
12995
12996    /**
12997     * Iterates over own and inherited enumerable string keyed properties of an
12998     * object and invokes `iteratee` for each property. The iteratee is invoked
12999     * with three arguments: (value, key, object). Iteratee functions may exit
13000     * iteration early by explicitly returning `false`.
13001     *
13002     * @static
13003     * @memberOf _
13004     * @since 0.3.0
13005     * @category Object
13006     * @param {Object} object The object to iterate over.
13007     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13008     * @returns {Object} Returns `object`.
13009     * @see _.forInRight
13010     * @example
13011     *
13012     * function Foo() {
13013     *   this.a = 1;
13014     *   this.b = 2;
13015     * }
13016     *
13017     * Foo.prototype.c = 3;
13018     *
13019     * _.forIn(new Foo, function(value, key) {
13020     *   console.log(key);
13021     * });
13022     * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
13023     */
13024    function forIn(object, iteratee) {
13025      return object == null
13026        ? object
13027        : baseFor(object, getIteratee(iteratee, 3), keysIn);
13028    }
13029
13030    /**
13031     * This method is like `_.forIn` except that it iterates over properties of
13032     * `object` in the opposite order.
13033     *
13034     * @static
13035     * @memberOf _
13036     * @since 2.0.0
13037     * @category Object
13038     * @param {Object} object The object to iterate over.
13039     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13040     * @returns {Object} Returns `object`.
13041     * @see _.forIn
13042     * @example
13043     *
13044     * function Foo() {
13045     *   this.a = 1;
13046     *   this.b = 2;
13047     * }
13048     *
13049     * Foo.prototype.c = 3;
13050     *
13051     * _.forInRight(new Foo, function(value, key) {
13052     *   console.log(key);
13053     * });
13054     * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
13055     */
13056    function forInRight(object, iteratee) {
13057      return object == null
13058        ? object
13059        : baseForRight(object, getIteratee(iteratee, 3), keysIn);
13060    }
13061
13062    /**
13063     * Iterates over own enumerable string keyed properties of an object and
13064     * invokes `iteratee` for each property. The iteratee is invoked with three
13065     * arguments: (value, key, object). Iteratee functions may exit iteration
13066     * early by explicitly returning `false`.
13067     *
13068     * @static
13069     * @memberOf _
13070     * @since 0.3.0
13071     * @category Object
13072     * @param {Object} object The object to iterate over.
13073     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13074     * @returns {Object} Returns `object`.
13075     * @see _.forOwnRight
13076     * @example
13077     *
13078     * function Foo() {
13079     *   this.a = 1;
13080     *   this.b = 2;
13081     * }
13082     *
13083     * Foo.prototype.c = 3;
13084     *
13085     * _.forOwn(new Foo, function(value, key) {
13086     *   console.log(key);
13087     * });
13088     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
13089     */
13090    function forOwn(object, iteratee) {
13091      return object && baseForOwn(object, getIteratee(iteratee, 3));
13092    }
13093
13094    /**
13095     * This method is like `_.forOwn` except that it iterates over properties of
13096     * `object` in the opposite order.
13097     *
13098     * @static
13099     * @memberOf _
13100     * @since 2.0.0
13101     * @category Object
13102     * @param {Object} object The object to iterate over.
13103     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13104     * @returns {Object} Returns `object`.
13105     * @see _.forOwn
13106     * @example
13107     *
13108     * function Foo() {
13109     *   this.a = 1;
13110     *   this.b = 2;
13111     * }
13112     *
13113     * Foo.prototype.c = 3;
13114     *
13115     * _.forOwnRight(new Foo, function(value, key) {
13116     *   console.log(key);
13117     * });
13118     * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
13119     */
13120    function forOwnRight(object, iteratee) {
13121      return object && baseForOwnRight(object, getIteratee(iteratee, 3));
13122    }
13123
13124    /**
13125     * Creates an array of function property names from own enumerable properties
13126     * of `object`.
13127     *
13128     * @static
13129     * @since 0.1.0
13130     * @memberOf _
13131     * @category Object
13132     * @param {Object} object The object to inspect.
13133     * @returns {Array} Returns the function names.
13134     * @see _.functionsIn
13135     * @example
13136     *
13137     * function Foo() {
13138     *   this.a = _.constant('a');
13139     *   this.b = _.constant('b');
13140     * }
13141     *
13142     * Foo.prototype.c = _.constant('c');
13143     *
13144     * _.functions(new Foo);
13145     * // => ['a', 'b']
13146     */
13147    function functions(object) {
13148      return object == null ? [] : baseFunctions(object, keys(object));
13149    }
13150
13151    /**
13152     * Creates an array of function property names from own and inherited
13153     * enumerable properties of `object`.
13154     *
13155     * @static
13156     * @memberOf _
13157     * @since 4.0.0
13158     * @category Object
13159     * @param {Object} object The object to inspect.
13160     * @returns {Array} Returns the function names.
13161     * @see _.functions
13162     * @example
13163     *
13164     * function Foo() {
13165     *   this.a = _.constant('a');
13166     *   this.b = _.constant('b');
13167     * }
13168     *
13169     * Foo.prototype.c = _.constant('c');
13170     *
13171     * _.functionsIn(new Foo);
13172     * // => ['a', 'b', 'c']
13173     */
13174    function functionsIn(object) {
13175      return object == null ? [] : baseFunctions(object, keysIn(object));
13176    }
13177
13178    /**
13179     * Gets the value at `path` of `object`. If the resolved value is
13180     * `undefined`, the `defaultValue` is returned in its place.
13181     *
13182     * @static
13183     * @memberOf _
13184     * @since 3.7.0
13185     * @category Object
13186     * @param {Object} object The object to query.
13187     * @param {Array|string} path The path of the property to get.
13188     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13189     * @returns {*} Returns the resolved value.
13190     * @example
13191     *
13192     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13193     *
13194     * _.get(object, 'a[0].b.c');
13195     * // => 3
13196     *
13197     * _.get(object, ['a', '0', 'b', 'c']);
13198     * // => 3
13199     *
13200     * _.get(object, 'a.b.c', 'default');
13201     * // => 'default'
13202     */
13203    function get(object, path, defaultValue) {
13204      var result = object == null ? undefined : baseGet(object, path);
13205      return result === undefined ? defaultValue : result;
13206    }
13207
13208    /**
13209     * Checks if `path` is a direct property of `object`.
13210     *
13211     * @static
13212     * @since 0.1.0
13213     * @memberOf _
13214     * @category Object
13215     * @param {Object} object The object to query.
13216     * @param {Array|string} path The path to check.
13217     * @returns {boolean} Returns `true` if `path` exists, else `false`.
13218     * @example
13219     *
13220     * var object = { 'a': { 'b': 2 } };
13221     * var other = _.create({ 'a': _.create({ 'b': 2 }) });
13222     *
13223     * _.has(object, 'a');
13224     * // => true
13225     *
13226     * _.has(object, 'a.b');
13227     * // => true
13228     *
13229     * _.has(object, ['a', 'b']);
13230     * // => true
13231     *
13232     * _.has(other, 'a');
13233     * // => false
13234     */
13235    function has(object, path) {
13236      return object != null && hasPath(object, path, baseHas);
13237    }
13238
13239    /**
13240     * Checks if `path` is a direct or inherited property of `object`.
13241     *
13242     * @static
13243     * @memberOf _
13244     * @since 4.0.0
13245     * @category Object
13246     * @param {Object} object The object to query.
13247     * @param {Array|string} path The path to check.
13248     * @returns {boolean} Returns `true` if `path` exists, else `false`.
13249     * @example
13250     *
13251     * var object = _.create({ 'a': _.create({ 'b': 2 }) });
13252     *
13253     * _.hasIn(object, 'a');
13254     * // => true
13255     *
13256     * _.hasIn(object, 'a.b');
13257     * // => true
13258     *
13259     * _.hasIn(object, ['a', 'b']);
13260     * // => true
13261     *
13262     * _.hasIn(object, 'b');
13263     * // => false
13264     */
13265    function hasIn(object, path) {
13266      return object != null && hasPath(object, path, baseHasIn);
13267    }
13268
13269    /**
13270     * Creates an object composed of the inverted keys and values of `object`.
13271     * If `object` contains duplicate values, subsequent values overwrite
13272     * property assignments of previous values.
13273     *
13274     * @static
13275     * @memberOf _
13276     * @since 0.7.0
13277     * @category Object
13278     * @param {Object} object The object to invert.
13279     * @returns {Object} Returns the new inverted object.
13280     * @example
13281     *
13282     * var object = { 'a': 1, 'b': 2, 'c': 1 };
13283     *
13284     * _.invert(object);
13285     * // => { '1': 'c', '2': 'b' }
13286     */
13287    var invert = createInverter(function(result, value, key) {
13288      if (value != null &&
13289          typeof value.toString != 'function') {
13290        value = nativeObjectToString.call(value);
13291      }
13292
13293      result[value] = key;
13294    }, constant(identity));
13295
13296    /**
13297     * This method is like `_.invert` except that the inverted object is generated
13298     * from the results of running each element of `object` thru `iteratee`. The
13299     * corresponding inverted value of each inverted key is an array of keys
13300     * responsible for generating the inverted value. The iteratee is invoked
13301     * with one argument: (value).
13302     *
13303     * @static
13304     * @memberOf _
13305     * @since 4.1.0
13306     * @category Object
13307     * @param {Object} object The object to invert.
13308     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
13309     * @returns {Object} Returns the new inverted object.
13310     * @example
13311     *
13312     * var object = { 'a': 1, 'b': 2, 'c': 1 };
13313     *
13314     * _.invertBy(object);
13315     * // => { '1': ['a', 'c'], '2': ['b'] }
13316     *
13317     * _.invertBy(object, function(value) {
13318     *   return 'group' + value;
13319     * });
13320     * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
13321     */
13322    var invertBy = createInverter(function(result, value, key) {
13323      if (value != null &&
13324          typeof value.toString != 'function') {
13325        value = nativeObjectToString.call(value);
13326      }
13327
13328      if (hasOwnProperty.call(result, value)) {
13329        result[value].push(key);
13330      } else {
13331        result[value] = [key];
13332      }
13333    }, getIteratee);
13334
13335    /**
13336     * Invokes the method at `path` of `object`.
13337     *
13338     * @static
13339     * @memberOf _
13340     * @since 4.0.0
13341     * @category Object
13342     * @param {Object} object The object to query.
13343     * @param {Array|string} path The path of the method to invoke.
13344     * @param {...*} [args] The arguments to invoke the method with.
13345     * @returns {*} Returns the result of the invoked method.
13346     * @example
13347     *
13348     * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
13349     *
13350     * _.invoke(object, 'a[0].b.c.slice', 1, 3);
13351     * // => [2, 3]
13352     */
13353    var invoke = baseRest(baseInvoke);
13354
13355    /**
13356     * Creates an array of the own enumerable property names of `object`.
13357     *
13358     * **Note:** Non-object values are coerced to objects. See the
13359     * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
13360     * for more details.
13361     *
13362     * @static
13363     * @since 0.1.0
13364     * @memberOf _
13365     * @category Object
13366     * @param {Object} object The object to query.
13367     * @returns {Array} Returns the array of property names.
13368     * @example
13369     *
13370     * function Foo() {
13371     *   this.a = 1;
13372     *   this.b = 2;
13373     * }
13374     *
13375     * Foo.prototype.c = 3;
13376     *
13377     * _.keys(new Foo);
13378     * // => ['a', 'b'] (iteration order is not guaranteed)
13379     *
13380     * _.keys('hi');
13381     * // => ['0', '1']
13382     */
13383    function keys(object) {
13384      return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
13385    }
13386
13387    /**
13388     * Creates an array of the own and inherited enumerable property names of `object`.
13389     *
13390     * **Note:** Non-object values are coerced to objects.
13391     *
13392     * @static
13393     * @memberOf _
13394     * @since 3.0.0
13395     * @category Object
13396     * @param {Object} object The object to query.
13397     * @returns {Array} Returns the array of property names.
13398     * @example
13399     *
13400     * function Foo() {
13401     *   this.a = 1;
13402     *   this.b = 2;
13403     * }
13404     *
13405     * Foo.prototype.c = 3;
13406     *
13407     * _.keysIn(new Foo);
13408     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
13409     */
13410    function keysIn(object) {
13411      return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
13412    }
13413
13414    /**
13415     * The opposite of `_.mapValues`; this method creates an object with the
13416     * same values as `object` and keys generated by running each own enumerable
13417     * string keyed property of `object` thru `iteratee`. The iteratee is invoked
13418     * with three arguments: (value, key, object).
13419     *
13420     * @static
13421     * @memberOf _
13422     * @since 3.8.0
13423     * @category Object
13424     * @param {Object} object The object to iterate over.
13425     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13426     * @returns {Object} Returns the new mapped object.
13427     * @see _.mapValues
13428     * @example
13429     *
13430     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
13431     *   return key + value;
13432     * });
13433     * // => { 'a1': 1, 'b2': 2 }
13434     */
13435    function mapKeys(object, iteratee) {
13436      var result = {};
13437      iteratee = getIteratee(iteratee, 3);
13438
13439      baseForOwn(object, function(value, key, object) {
13440        baseAssignValue(result, iteratee(value, key, object), value);
13441      });
13442      return result;
13443    }
13444
13445    /**
13446     * Creates an object with the same keys as `object` and values generated
13447     * by running each own enumerable string keyed property of `object` thru
13448     * `iteratee`. The iteratee is invoked with three arguments:
13449     * (value, key, object).
13450     *
13451     * @static
13452     * @memberOf _
13453     * @since 2.4.0
13454     * @category Object
13455     * @param {Object} object The object to iterate over.
13456     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13457     * @returns {Object} Returns the new mapped object.
13458     * @see _.mapKeys
13459     * @example
13460     *
13461     * var users = {
13462     *   'fred':    { 'user': 'fred',    'age': 40 },
13463     *   'pebbles': { 'user': 'pebbles', 'age': 1 }
13464     * };
13465     *
13466     * _.mapValues(users, function(o) { return o.age; });
13467     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13468     *
13469     * // The `_.property` iteratee shorthand.
13470     * _.mapValues(users, 'age');
13471     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13472     */
13473    function mapValues(object, iteratee) {
13474      var result = {};
13475      iteratee = getIteratee(iteratee, 3);
13476
13477      baseForOwn(object, function(value, key, object) {
13478        baseAssignValue(result, key, iteratee(value, key, object));
13479      });
13480      return result;
13481    }
13482
13483    /**
13484     * This method is like `_.assign` except that it recursively merges own and
13485     * inherited enumerable string keyed properties of source objects into the
13486     * destination object. Source properties that resolve to `undefined` are
13487     * skipped if a destination value exists. Array and plain object properties
13488     * are merged recursively. Other objects and value types are overridden by
13489     * assignment. Source objects are applied from left to right. Subsequent
13490     * sources overwrite property assignments of previous sources.
13491     *
13492     * **Note:** This method mutates `object`.
13493     *
13494     * @static
13495     * @memberOf _
13496     * @since 0.5.0
13497     * @category Object
13498     * @param {Object} object The destination object.
13499     * @param {...Object} [sources] The source objects.
13500     * @returns {Object} Returns `object`.
13501     * @example
13502     *
13503     * var object = {
13504     *   'a': [{ 'b': 2 }, { 'd': 4 }]
13505     * };
13506     *
13507     * var other = {
13508     *   'a': [{ 'c': 3 }, { 'e': 5 }]
13509     * };
13510     *
13511     * _.merge(object, other);
13512     * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
13513     */
13514    var merge = createAssigner(function(object, source, srcIndex) {
13515      baseMerge(object, source, srcIndex);
13516    });
13517
13518    /**
13519     * This method is like `_.merge` except that it accepts `customizer` which
13520     * is invoked to produce the merged values of the destination and source
13521     * properties. If `customizer` returns `undefined`, merging is handled by the
13522     * method instead. The `customizer` is invoked with six arguments:
13523     * (objValue, srcValue, key, object, source, stack).
13524     *
13525     * **Note:** This method mutates `object`.
13526     *
13527     * @static
13528     * @memberOf _
13529     * @since 4.0.0
13530     * @category Object
13531     * @param {Object} object The destination object.
13532     * @param {...Object} sources The source objects.
13533     * @param {Function} customizer The function to customize assigned values.
13534     * @returns {Object} Returns `object`.
13535     * @example
13536     *
13537     * function customizer(objValue, srcValue) {
13538     *   if (_.isArray(objValue)) {
13539     *     return objValue.concat(srcValue);
13540     *   }
13541     * }
13542     *
13543     * var object = { 'a': [1], 'b': [2] };
13544     * var other = { 'a': [3], 'b': [4] };
13545     *
13546     * _.mergeWith(object, other, customizer);
13547     * // => { 'a': [1, 3], 'b': [2, 4] }
13548     */
13549    var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
13550      baseMerge(object, source, srcIndex, customizer);
13551    });
13552
13553    /**
13554     * The opposite of `_.pick`; this method creates an object composed of the
13555     * own and inherited enumerable property paths of `object` that are not omitted.
13556     *
13557     * **Note:** This method is considerably slower than `_.pick`.
13558     *
13559     * @static
13560     * @since 0.1.0
13561     * @memberOf _
13562     * @category Object
13563     * @param {Object} object The source object.
13564     * @param {...(string|string[])} [paths] The property paths to omit.
13565     * @returns {Object} Returns the new object.
13566     * @example
13567     *
13568     * var object = { 'a': 1, 'b': '2', 'c': 3 };
13569     *
13570     * _.omit(object, ['a', 'c']);
13571     * // => { 'b': '2' }
13572     */
13573    var omit = flatRest(function(object, paths) {
13574      var result = {};
13575      if (object == null) {
13576        return result;
13577      }
13578      var isDeep = false;
13579      paths = arrayMap(paths, function(path) {
13580        path = castPath(path, object);
13581        isDeep || (isDeep = path.length > 1);
13582        return path;
13583      });
13584      copyObject(object, getAllKeysIn(object), result);
13585      if (isDeep) {
13586        result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
13587      }
13588      var length = paths.length;
13589      while (length--) {
13590        baseUnset(result, paths[length]);
13591      }
13592      return result;
13593    });
13594
13595    /**
13596     * The opposite of `_.pickBy`; this method creates an object composed of
13597     * the own and inherited enumerable string keyed properties of `object` that
13598     * `predicate` doesn't return truthy for. The predicate is invoked with two
13599     * arguments: (value, key).
13600     *
13601     * @static
13602     * @memberOf _
13603     * @since 4.0.0
13604     * @category Object
13605     * @param {Object} object The source object.
13606     * @param {Function} [predicate=_.identity] The function invoked per property.
13607     * @returns {Object} Returns the new object.
13608     * @example
13609     *
13610     * var object = { 'a': 1, 'b': '2', 'c': 3 };
13611     *
13612     * _.omitBy(object, _.isNumber);
13613     * // => { 'b': '2' }
13614     */
13615    function omitBy(object, predicate) {
13616      return pickBy(object, negate(getIteratee(predicate)));
13617    }
13618
13619    /**
13620     * Creates an object composed of the picked `object` properties.
13621     *
13622     * @static
13623     * @since 0.1.0
13624     * @memberOf _
13625     * @category Object
13626     * @param {Object} object The source object.
13627     * @param {...(string|string[])} [paths] The property paths to pick.
13628     * @returns {Object} Returns the new object.
13629     * @example
13630     *
13631     * var object = { 'a': 1, 'b': '2', 'c': 3 };
13632     *
13633     * _.pick(object, ['a', 'c']);
13634     * // => { 'a': 1, 'c': 3 }
13635     */
13636    var pick = flatRest(function(object, paths) {
13637      return object == null ? {} : basePick(object, paths);
13638    });
13639
13640    /**
13641     * Creates an object composed of the `object` properties `predicate` returns
13642     * truthy for. The predicate is invoked with two arguments: (value, key).
13643     *
13644     * @static
13645     * @memberOf _
13646     * @since 4.0.0
13647     * @category Object
13648     * @param {Object} object The source object.
13649     * @param {Function} [predicate=_.identity] The function invoked per property.
13650     * @returns {Object} Returns the new object.
13651     * @example
13652     *
13653     * var object = { 'a': 1, 'b': '2', 'c': 3 };
13654     *
13655     * _.pickBy(object, _.isNumber);
13656     * // => { 'a': 1, 'c': 3 }
13657     */
13658    function pickBy(object, predicate) {
13659      if (object == null) {
13660        return {};
13661      }
13662      var props = arrayMap(getAllKeysIn(object), function(prop) {
13663        return [prop];
13664      });
13665      predicate = getIteratee(predicate);
13666      return basePickBy(object, props, function(value, path) {
13667        return predicate(value, path[0]);
13668      });
13669    }
13670
13671    /**
13672     * This method is like `_.get` except that if the resolved value is a
13673     * function it's invoked with the `this` binding of its parent object and
13674     * its result is returned.
13675     *
13676     * @static
13677     * @since 0.1.0
13678     * @memberOf _
13679     * @category Object
13680     * @param {Object} object The object to query.
13681     * @param {Array|string} path The path of the property to resolve.
13682     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13683     * @returns {*} Returns the resolved value.
13684     * @example
13685     *
13686     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
13687     *
13688     * _.result(object, 'a[0].b.c1');
13689     * // => 3
13690     *
13691     * _.result(object, 'a[0].b.c2');
13692     * // => 4
13693     *
13694     * _.result(object, 'a[0].b.c3', 'default');
13695     * // => 'default'
13696     *
13697     * _.result(object, 'a[0].b.c3', _.constant('default'));
13698     * // => 'default'
13699     */
13700    function result(object, path, defaultValue) {
13701      path = castPath(path, object);
13702
13703      var index = -1,
13704          length = path.length;
13705
13706      // Ensure the loop is entered when path is empty.
13707      if (!length) {
13708        length = 1;
13709        object = undefined;
13710      }
13711      while (++index < length) {
13712        var value = object == null ? undefined : object[toKey(path[index])];
13713        if (value === undefined) {
13714          index = length;
13715          value = defaultValue;
13716        }
13717        object = isFunction(value) ? value.call(object) : value;
13718      }
13719      return object;
13720    }
13721
13722    /**
13723     * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
13724     * it's created. Arrays are created for missing index properties while objects
13725     * are created for all other missing properties. Use `_.setWith` to customize
13726     * `path` creation.
13727     *
13728     * **Note:** This method mutates `object`.
13729     *
13730     * @static
13731     * @memberOf _
13732     * @since 3.7.0
13733     * @category Object
13734     * @param {Object} object The object to modify.
13735     * @param {Array|string} path The path of the property to set.
13736     * @param {*} value The value to set.
13737     * @returns {Object} Returns `object`.
13738     * @example
13739     *
13740     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13741     *
13742     * _.set(object, 'a[0].b.c', 4);
13743     * console.log(object.a[0].b.c);
13744     * // => 4
13745     *
13746     * _.set(object, ['x', '0', 'y', 'z'], 5);
13747     * console.log(object.x[0].y.z);
13748     * // => 5
13749     */
13750    function set(object, path, value) {
13751      return object == null ? object : baseSet(object, path, value);
13752    }
13753
13754    /**
13755     * This method is like `_.set` except that it accepts `customizer` which is
13756     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
13757     * path creation is handled by the method instead. The `customizer` is invoked
13758     * with three arguments: (nsValue, key, nsObject).
13759     *
13760     * **Note:** This method mutates `object`.
13761     *
13762     * @static
13763     * @memberOf _
13764     * @since 4.0.0
13765     * @category Object
13766     * @param {Object} object The object to modify.
13767     * @param {Array|string} path The path of the property to set.
13768     * @param {*} value The value to set.
13769     * @param {Function} [customizer] The function to customize assigned values.
13770     * @returns {Object} Returns `object`.
13771     * @example
13772     *
13773     * var object = {};
13774     *
13775     * _.setWith(object, '[0][1]', 'a', Object);
13776     * // => { '0': { '1': 'a' } }
13777     */
13778    function setWith(object, path, value, customizer) {
13779      customizer = typeof customizer == 'function' ? customizer : undefined;
13780      return object == null ? object : baseSet(object, path, value, customizer);
13781    }
13782
13783    /**
13784     * Creates an array of own enumerable string keyed-value pairs for `object`
13785     * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
13786     * entries are returned.
13787     *
13788     * @static
13789     * @memberOf _
13790     * @since 4.0.0
13791     * @alias entries
13792     * @category Object
13793     * @param {Object} object The object to query.
13794     * @returns {Array} Returns the key-value pairs.
13795     * @example
13796     *
13797     * function Foo() {
13798     *   this.a = 1;
13799     *   this.b = 2;
13800     * }
13801     *
13802     * Foo.prototype.c = 3;
13803     *
13804     * _.toPairs(new Foo);
13805     * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
13806     */
13807    var toPairs = createToPairs(keys);
13808
13809    /**
13810     * Creates an array of own and inherited enumerable string keyed-value pairs
13811     * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
13812     * or set, its entries are returned.
13813     *
13814     * @static
13815     * @memberOf _
13816     * @since 4.0.0
13817     * @alias entriesIn
13818     * @category Object
13819     * @param {Object} object The object to query.
13820     * @returns {Array} Returns the key-value pairs.
13821     * @example
13822     *
13823     * function Foo() {
13824     *   this.a = 1;
13825     *   this.b = 2;
13826     * }
13827     *
13828     * Foo.prototype.c = 3;
13829     *
13830     * _.toPairsIn(new Foo);
13831     * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
13832     */
13833    var toPairsIn = createToPairs(keysIn);
13834
13835    /**
13836     * An alternative to `_.reduce`; this method transforms `object` to a new
13837     * `accumulator` object which is the result of running each of its own
13838     * enumerable string keyed properties thru `iteratee`, with each invocation
13839     * potentially mutating the `accumulator` object. If `accumulator` is not
13840     * provided, a new object with the same `[[Prototype]]` will be used. The
13841     * iteratee is invoked with four arguments: (accumulator, value, key, object).
13842     * Iteratee functions may exit iteration early by explicitly returning `false`.
13843     *
13844     * @static
13845     * @memberOf _
13846     * @since 1.3.0
13847     * @category Object
13848     * @param {Object} object The object to iterate over.
13849     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13850     * @param {*} [accumulator] The custom accumulator value.
13851     * @returns {*} Returns the accumulated value.
13852     * @example
13853     *
13854     * _.transform([2, 3, 4], function(result, n) {
13855     *   result.push(n *= n);
13856     *   return n % 2 == 0;
13857     * }, []);
13858     * // => [4, 9]
13859     *
13860     * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
13861     *   (result[value] || (result[value] = [])).push(key);
13862     * }, {});
13863     * // => { '1': ['a', 'c'], '2': ['b'] }
13864     */
13865    function transform(object, iteratee, accumulator) {
13866      var isArr = isArray(object),
13867          isArrLike = isArr || isBuffer(object) || isTypedArray(object);
13868
13869      iteratee = getIteratee(iteratee, 4);
13870      if (accumulator == null) {
13871        var Ctor = object && object.constructor;
13872        if (isArrLike) {
13873          accumulator = isArr ? new Ctor : [];
13874        }
13875        else if (isObject(object)) {
13876          accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
13877        }
13878        else {
13879          accumulator = {};
13880        }
13881      }
13882      (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
13883        return iteratee(accumulator, value, index, object);
13884      });
13885      return accumulator;
13886    }
13887
13888    /**
13889     * Removes the property at `path` of `object`.
13890     *
13891     * **Note:** This method mutates `object`.
13892     *
13893     * @static
13894     * @memberOf _
13895     * @since 4.0.0
13896     * @category Object
13897     * @param {Object} object The object to modify.
13898     * @param {Array|string} path The path of the property to unset.
13899     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
13900     * @example
13901     *
13902     * var object = { 'a': [{ 'b': { 'c': 7 } }] };
13903     * _.unset(object, 'a[0].b.c');
13904     * // => true
13905     *
13906     * console.log(object);
13907     * // => { 'a': [{ 'b': {} }] };
13908     *
13909     * _.unset(object, ['a', '0', 'b', 'c']);
13910     * // => true
13911     *
13912     * console.log(object);
13913     * // => { 'a': [{ 'b': {} }] };
13914     */
13915    function unset(object, path) {
13916      return object == null ? true : baseUnset(object, path);
13917    }
13918
13919    /**
13920     * This method is like `_.set` except that accepts `updater` to produce the
13921     * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
13922     * is invoked with one argument: (value).
13923     *
13924     * **Note:** This method mutates `object`.
13925     *
13926     * @static
13927     * @memberOf _
13928     * @since 4.6.0
13929     * @category Object
13930     * @param {Object} object The object to modify.
13931     * @param {Array|string} path The path of the property to set.
13932     * @param {Function} updater The function to produce the updated value.
13933     * @returns {Object} Returns `object`.
13934     * @example
13935     *
13936     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13937     *
13938     * _.update(object, 'a[0].b.c', function(n) { return n * n; });
13939     * console.log(object.a[0].b.c);
13940     * // => 9
13941     *
13942     * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
13943     * console.log(object.x[0].y.z);
13944     * // => 0
13945     */
13946    function update(object, path, updater) {
13947      return object == null ? object : baseUpdate(object, path, castFunction(updater));
13948    }
13949
13950    /**
13951     * This method is like `_.update` except that it accepts `customizer` which is
13952     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
13953     * path creation is handled by the method instead. The `customizer` is invoked
13954     * with three arguments: (nsValue, key, nsObject).
13955     *
13956     * **Note:** This method mutates `object`.
13957     *
13958     * @static
13959     * @memberOf _
13960     * @since 4.6.0
13961     * @category Object
13962     * @param {Object} object The object to modify.
13963     * @param {Array|string} path The path of the property to set.
13964     * @param {Function} updater The function to produce the updated value.
13965     * @param {Function} [customizer] The function to customize assigned values.
13966     * @returns {Object} Returns `object`.
13967     * @example
13968     *
13969     * var object = {};
13970     *
13971     * _.updateWith(object, '[0][1]', _.constant('a'), Object);
13972     * // => { '0': { '1': 'a' } }
13973     */
13974    function updateWith(object, path, updater, customizer) {
13975      customizer = typeof customizer == 'function' ? customizer : undefined;
13976      return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
13977    }
13978
13979    /**
13980     * Creates an array of the own enumerable string keyed property values of `object`.
13981     *
13982     * **Note:** Non-object values are coerced to objects.
13983     *
13984     * @static
13985     * @since 0.1.0
13986     * @memberOf _
13987     * @category Object
13988     * @param {Object} object The object to query.
13989     * @returns {Array} Returns the array of property values.
13990     * @example
13991     *
13992     * function Foo() {
13993     *   this.a = 1;
13994     *   this.b = 2;
13995     * }
13996     *
13997     * Foo.prototype.c = 3;
13998     *
13999     * _.values(new Foo);
14000     * // => [1, 2] (iteration order is not guaranteed)
14001     *
14002     * _.values('hi');
14003     * // => ['h', 'i']
14004     */
14005    function values(object) {
14006      return object == null ? [] : baseValues(object, keys(object));
14007    }
14008
14009    /**
14010     * Creates an array of the own and inherited enumerable string keyed property
14011     * values of `object`.
14012     *
14013     * **Note:** Non-object values are coerced to objects.
14014     *
14015     * @static
14016     * @memberOf _
14017     * @since 3.0.0
14018     * @category Object
14019     * @param {Object} object The object to query.
14020     * @returns {Array} Returns the array of property values.
14021     * @example
14022     *
14023     * function Foo() {
14024     *   this.a = 1;
14025     *   this.b = 2;
14026     * }
14027     *
14028     * Foo.prototype.c = 3;
14029     *
14030     * _.valuesIn(new Foo);
14031     * // => [1, 2, 3] (iteration order is not guaranteed)
14032     */
14033    function valuesIn(object) {
14034      return object == null ? [] : baseValues(object, keysIn(object));
14035    }
14036
14037    /*------------------------------------------------------------------------*/
14038
14039    /**
14040     * Clamps `number` within the inclusive `lower` and `upper` bounds.
14041     *
14042     * @static
14043     * @memberOf _
14044     * @since 4.0.0
14045     * @category Number
14046     * @param {number} number The number to clamp.
14047     * @param {number} [lower] The lower bound.
14048     * @param {number} upper The upper bound.
14049     * @returns {number} Returns the clamped number.
14050     * @example
14051     *
14052     * _.clamp(-10, -5, 5);
14053     * // => -5
14054     *
14055     * _.clamp(10, -5, 5);
14056     * // => 5
14057     */
14058    function clamp(number, lower, upper) {
14059      if (upper === undefined) {
14060        upper = lower;
14061        lower = undefined;
14062      }
14063      if (upper !== undefined) {
14064        upper = toNumber(upper);
14065        upper = upper === upper ? upper : 0;
14066      }
14067      if (lower !== undefined) {
14068        lower = toNumber(lower);
14069        lower = lower === lower ? lower : 0;
14070      }
14071      return baseClamp(toNumber(number), lower, upper);
14072    }
14073
14074    /**
14075     * Checks if `n` is between `start` and up to, but not including, `end`. If
14076     * `end` is not specified, it's set to `start` with `start` then set to `0`.
14077     * If `start` is greater than `end` the params are swapped to support
14078     * negative ranges.
14079     *
14080     * @static
14081     * @memberOf _
14082     * @since 3.3.0
14083     * @category Number
14084     * @param {number} number The number to check.
14085     * @param {number} [start=0] The start of the range.
14086     * @param {number} end The end of the range.
14087     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
14088     * @see _.range, _.rangeRight
14089     * @example
14090     *
14091     * _.inRange(3, 2, 4);
14092     * // => true
14093     *
14094     * _.inRange(4, 8);
14095     * // => true
14096     *
14097     * _.inRange(4, 2);
14098     * // => false
14099     *
14100     * _.inRange(2, 2);
14101     * // => false
14102     *
14103     * _.inRange(1.2, 2);
14104     * // => true
14105     *
14106     * _.inRange(5.2, 4);
14107     * // => false
14108     *
14109     * _.inRange(-3, -2, -6);
14110     * // => true
14111     */
14112    function inRange(number, start, end) {
14113      start = toFinite(start);
14114      if (end === undefined) {
14115        end = start;
14116        start = 0;
14117      } else {
14118        end = toFinite(end);
14119      }
14120      number = toNumber(number);
14121      return baseInRange(number, start, end);
14122    }
14123
14124    /**
14125     * Produces a random number between the inclusive `lower` and `upper` bounds.
14126     * If only one argument is provided a number between `0` and the given number
14127     * is returned. If `floating` is `true`, or either `lower` or `upper` are
14128     * floats, a floating-point number is returned instead of an integer.
14129     *
14130     * **Note:** JavaScript follows the IEEE-754 standard for resolving
14131     * floating-point values which can produce unexpected results.
14132     *
14133     * @static
14134     * @memberOf _
14135     * @since 0.7.0
14136     * @category Number
14137     * @param {number} [lower=0] The lower bound.
14138     * @param {number} [upper=1] The upper bound.
14139     * @param {boolean} [floating] Specify returning a floating-point number.
14140     * @returns {number} Returns the random number.
14141     * @example
14142     *
14143     * _.random(0, 5);
14144     * // => an integer between 0 and 5
14145     *
14146     * _.random(5);
14147     * // => also an integer between 0 and 5
14148     *
14149     * _.random(5, true);
14150     * // => a floating-point number between 0 and 5
14151     *
14152     * _.random(1.2, 5.2);
14153     * // => a floating-point number between 1.2 and 5.2
14154     */
14155    function random(lower, upper, floating) {
14156      if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
14157        upper = floating = undefined;
14158      }
14159      if (floating === undefined) {
14160        if (typeof upper == 'boolean') {
14161          floating = upper;
14162          upper = undefined;
14163        }
14164        else if (typeof lower == 'boolean') {
14165          floating = lower;
14166          lower = undefined;
14167        }
14168      }
14169      if (lower === undefined && upper === undefined) {
14170        lower = 0;
14171        upper = 1;
14172      }
14173      else {
14174        lower = toFinite(lower);
14175        if (upper === undefined) {
14176          upper = lower;
14177          lower = 0;
14178        } else {
14179          upper = toFinite(upper);
14180        }
14181      }
14182      if (lower > upper) {
14183        var temp = lower;
14184        lower = upper;
14185        upper = temp;
14186      }
14187      if (floating || lower % 1 || upper % 1) {
14188        var rand = nativeRandom();
14189        return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
14190      }
14191      return baseRandom(lower, upper);
14192    }
14193
14194    /*------------------------------------------------------------------------*/
14195
14196    /**
14197     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
14198     *
14199     * @static
14200     * @memberOf _
14201     * @since 3.0.0
14202     * @category String
14203     * @param {string} [string=''] The string to convert.
14204     * @returns {string} Returns the camel cased string.
14205     * @example
14206     *
14207     * _.camelCase('Foo Bar');
14208     * // => 'fooBar'
14209     *
14210     * _.camelCase('--foo-bar--');
14211     * // => 'fooBar'
14212     *
14213     * _.camelCase('__FOO_BAR__');
14214     * // => 'fooBar'
14215     */
14216    var camelCase = createCompounder(function(result, word, index) {
14217      word = word.toLowerCase();
14218      return result + (index ? capitalize(word) : word);
14219    });
14220
14221    /**
14222     * Converts the first character of `string` to upper case and the remaining
14223     * to lower case.
14224     *
14225     * @static
14226     * @memberOf _
14227     * @since 3.0.0
14228     * @category String
14229     * @param {string} [string=''] The string to capitalize.
14230     * @returns {string} Returns the capitalized string.
14231     * @example
14232     *
14233     * _.capitalize('FRED');
14234     * // => 'Fred'
14235     */
14236    function capitalize(string) {
14237      return upperFirst(toString(string).toLowerCase());
14238    }
14239
14240    /**
14241     * Deburrs `string` by converting
14242     * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
14243     * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
14244     * letters to basic Latin letters and removing
14245     * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
14246     *
14247     * @static
14248     * @memberOf _
14249     * @since 3.0.0
14250     * @category String
14251     * @param {string} [string=''] The string to deburr.
14252     * @returns {string} Returns the deburred string.
14253     * @example
14254     *
14255     * _.deburr('déjà vu');
14256     * // => 'deja vu'
14257     */
14258    function deburr(string) {
14259      string = toString(string);
14260      return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
14261    }
14262
14263    /**
14264     * Checks if `string` ends with the given target string.
14265     *
14266     * @static
14267     * @memberOf _
14268     * @since 3.0.0
14269     * @category String
14270     * @param {string} [string=''] The string to inspect.
14271     * @param {string} [target] The string to search for.
14272     * @param {number} [position=string.length] The position to search up to.
14273     * @returns {boolean} Returns `true` if `string` ends with `target`,
14274     *  else `false`.
14275     * @example
14276     *
14277     * _.endsWith('abc', 'c');
14278     * // => true
14279     *
14280     * _.endsWith('abc', 'b');
14281     * // => false
14282     *
14283     * _.endsWith('abc', 'b', 2);
14284     * // => true
14285     */
14286    function endsWith(string, target, position) {
14287      string = toString(string);
14288      target = baseToString(target);
14289
14290      var length = string.length;
14291      position = position === undefined
14292        ? length
14293        : baseClamp(toInteger(position), 0, length);
14294
14295      var end = position;
14296      position -= target.length;
14297      return position >= 0 && string.slice(position, end) == target;
14298    }
14299
14300    /**
14301     * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
14302     * corresponding HTML entities.
14303     *
14304     * **Note:** No other characters are escaped. To escape additional
14305     * characters use a third-party library like [_he_](https://mths.be/he).
14306     *
14307     * Though the ">" character is escaped for symmetry, characters like
14308     * ">" and "/" don't need escaping in HTML and have no special meaning
14309     * unless they're part of a tag or unquoted attribute value. See
14310     * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
14311     * (under "semi-related fun fact") for more details.
14312     *
14313     * When working with HTML you should always
14314     * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
14315     * XSS vectors.
14316     *
14317     * @static
14318     * @since 0.1.0
14319     * @memberOf _
14320     * @category String
14321     * @param {string} [string=''] The string to escape.
14322     * @returns {string} Returns the escaped string.
14323     * @example
14324     *
14325     * _.escape('fred, barney, & pebbles');
14326     * // => 'fred, barney, &amp; pebbles'
14327     */
14328    function escape(string) {
14329      string = toString(string);
14330      return (string && reHasUnescapedHtml.test(string))
14331        ? string.replace(reUnescapedHtml, escapeHtmlChar)
14332        : string;
14333    }
14334
14335    /**
14336     * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
14337     * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
14338     *
14339     * @static
14340     * @memberOf _
14341     * @since 3.0.0
14342     * @category String
14343     * @param {string} [string=''] The string to escape.
14344     * @returns {string} Returns the escaped string.
14345     * @example
14346     *
14347     * _.escapeRegExp('[lodash](https://lodash.com/)');
14348     * // => '\[lodash\]\(https://lodash\.com/\)'
14349     */
14350    function escapeRegExp(string) {
14351      string = toString(string);
14352      return (string && reHasRegExpChar.test(string))
14353        ? string.replace(reRegExpChar, '\\$&')
14354        : string;
14355    }
14356
14357    /**
14358     * Converts `string` to
14359     * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
14360     *
14361     * @static
14362     * @memberOf _
14363     * @since 3.0.0
14364     * @category String
14365     * @param {string} [string=''] The string to convert.
14366     * @returns {string} Returns the kebab cased string.
14367     * @example
14368     *
14369     * _.kebabCase('Foo Bar');
14370     * // => 'foo-bar'
14371     *
14372     * _.kebabCase('fooBar');
14373     * // => 'foo-bar'
14374     *
14375     * _.kebabCase('__FOO_BAR__');
14376     * // => 'foo-bar'
14377     */
14378    var kebabCase = createCompounder(function(result, word, index) {
14379      return result + (index ? '-' : '') + word.toLowerCase();
14380    });
14381
14382    /**
14383     * Converts `string`, as space separated words, to lower case.
14384     *
14385     * @static
14386     * @memberOf _
14387     * @since 4.0.0
14388     * @category String
14389     * @param {string} [string=''] The string to convert.
14390     * @returns {string} Returns the lower cased string.
14391     * @example
14392     *
14393     * _.lowerCase('--Foo-Bar--');
14394     * // => 'foo bar'
14395     *
14396     * _.lowerCase('fooBar');
14397     * // => 'foo bar'
14398     *
14399     * _.lowerCase('__FOO_BAR__');
14400     * // => 'foo bar'
14401     */
14402    var lowerCase = createCompounder(function(result, word, index) {
14403      return result + (index ? ' ' : '') + word.toLowerCase();
14404    });
14405
14406    /**
14407     * Converts the first character of `string` to lower case.
14408     *
14409     * @static
14410     * @memberOf _
14411     * @since 4.0.0
14412     * @category String
14413     * @param {string} [string=''] The string to convert.
14414     * @returns {string} Returns the converted string.
14415     * @example
14416     *
14417     * _.lowerFirst('Fred');
14418     * // => 'fred'
14419     *
14420     * _.lowerFirst('FRED');
14421     * // => 'fRED'
14422     */
14423    var lowerFirst = createCaseFirst('toLowerCase');
14424
14425    /**
14426     * Pads `string` on the left and right sides if it's shorter than `length`.
14427     * Padding characters are truncated if they can't be evenly divided by `length`.
14428     *
14429     * @static
14430     * @memberOf _
14431     * @since 3.0.0
14432     * @category String
14433     * @param {string} [string=''] The string to pad.
14434     * @param {number} [length=0] The padding length.
14435     * @param {string} [chars=' '] The string used as padding.
14436     * @returns {string} Returns the padded string.
14437     * @example
14438     *
14439     * _.pad('abc', 8);
14440     * // => '  abc   '
14441     *
14442     * _.pad('abc', 8, '_-');
14443     * // => '_-abc_-_'
14444     *
14445     * _.pad('abc', 3);
14446     * // => 'abc'
14447     */
14448    function pad(string, length, chars) {
14449      string = toString(string);
14450      length = toInteger(length);
14451
14452      var strLength = length ? stringSize(string) : 0;
14453      if (!length || strLength >= length) {
14454        return string;
14455      }
14456      var mid = (length - strLength) / 2;
14457      return (
14458        createPadding(nativeFloor(mid), chars) +
14459        string +
14460        createPadding(nativeCeil(mid), chars)
14461      );
14462    }
14463
14464    /**
14465     * Pads `string` on the right side if it's shorter than `length`. Padding
14466     * characters are truncated if they exceed `length`.
14467     *
14468     * @static
14469     * @memberOf _
14470     * @since 4.0.0
14471     * @category String
14472     * @param {string} [string=''] The string to pad.
14473     * @param {number} [length=0] The padding length.
14474     * @param {string} [chars=' '] The string used as padding.
14475     * @returns {string} Returns the padded string.
14476     * @example
14477     *
14478     * _.padEnd('abc', 6);
14479     * // => 'abc   '
14480     *
14481     * _.padEnd('abc', 6, '_-');
14482     * // => 'abc_-_'
14483     *
14484     * _.padEnd('abc', 3);
14485     * // => 'abc'
14486     */
14487    function padEnd(string, length, chars) {
14488      string = toString(string);
14489      length = toInteger(length);
14490
14491      var strLength = length ? stringSize(string) : 0;
14492      return (length && strLength < length)
14493        ? (string + createPadding(length - strLength, chars))
14494        : string;
14495    }
14496
14497    /**
14498     * Pads `string` on the left side if it's shorter than `length`. Padding
14499     * characters are truncated if they exceed `length`.
14500     *
14501     * @static
14502     * @memberOf _
14503     * @since 4.0.0
14504     * @category String
14505     * @param {string} [string=''] The string to pad.
14506     * @param {number} [length=0] The padding length.
14507     * @param {string} [chars=' '] The string used as padding.
14508     * @returns {string} Returns the padded string.
14509     * @example
14510     *
14511     * _.padStart('abc', 6);
14512     * // => '   abc'
14513     *
14514     * _.padStart('abc', 6, '_-');
14515     * // => '_-_abc'
14516     *
14517     * _.padStart('abc', 3);
14518     * // => 'abc'
14519     */
14520    function padStart(string, length, chars) {
14521      string = toString(string);
14522      length = toInteger(length);
14523
14524      var strLength = length ? stringSize(string) : 0;
14525      return (length && strLength < length)
14526        ? (createPadding(length - strLength, chars) + string)
14527        : string;
14528    }
14529
14530    /**
14531     * Converts `string` to an integer of the specified radix. If `radix` is
14532     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
14533     * hexadecimal, in which case a `radix` of `16` is used.
14534     *
14535     * **Note:** This method aligns with the
14536     * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
14537     *
14538     * @static
14539     * @memberOf _
14540     * @since 1.1.0
14541     * @category String
14542     * @param {string} string The string to convert.
14543     * @param {number} [radix=10] The radix to interpret `value` by.
14544     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14545     * @returns {number} Returns the converted integer.
14546     * @example
14547     *
14548     * _.parseInt('08');
14549     * // => 8
14550     *
14551     * _.map(['6', '08', '10'], _.parseInt);
14552     * // => [6, 8, 10]
14553     */
14554    function parseInt(string, radix, guard) {
14555      if (guard || radix == null) {
14556        radix = 0;
14557      } else if (radix) {
14558        radix = +radix;
14559      }
14560      return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
14561    }
14562
14563    /**
14564     * Repeats the given string `n` times.
14565     *
14566     * @static
14567     * @memberOf _
14568     * @since 3.0.0
14569     * @category String
14570     * @param {string} [string=''] The string to repeat.
14571     * @param {number} [n=1] The number of times to repeat the string.
14572     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14573     * @returns {string} Returns the repeated string.
14574     * @example
14575     *
14576     * _.repeat('*', 3);
14577     * // => '***'
14578     *
14579     * _.repeat('abc', 2);
14580     * // => 'abcabc'
14581     *
14582     * _.repeat('abc', 0);
14583     * // => ''
14584     */
14585    function repeat(string, n, guard) {
14586      if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
14587        n = 1;
14588      } else {
14589        n = toInteger(n);
14590      }
14591      return baseRepeat(toString(string), n);
14592    }
14593
14594    /**
14595     * Replaces matches for `pattern` in `string` with `replacement`.
14596     *
14597     * **Note:** This method is based on
14598     * [`String#replace`](https://mdn.io/String/replace).
14599     *
14600     * @static
14601     * @memberOf _
14602     * @since 4.0.0
14603     * @category String
14604     * @param {string} [string=''] The string to modify.
14605     * @param {RegExp|string} pattern The pattern to replace.
14606     * @param {Function|string} replacement The match replacement.
14607     * @returns {string} Returns the modified string.
14608     * @example
14609     *
14610     * _.replace('Hi Fred', 'Fred', 'Barney');
14611     * // => 'Hi Barney'
14612     */
14613    function replace() {
14614      var args = arguments,
14615          string = toString(args[0]);
14616
14617      return args.length < 3 ? string : string.replace(args[1], args[2]);
14618    }
14619
14620    /**
14621     * Converts `string` to
14622     * [snake case](https://en.wikipedia.org/wiki/Snake_case).
14623     *
14624     * @static
14625     * @memberOf _
14626     * @since 3.0.0
14627     * @category String
14628     * @param {string} [string=''] The string to convert.
14629     * @returns {string} Returns the snake cased string.
14630     * @example
14631     *
14632     * _.snakeCase('Foo Bar');
14633     * // => 'foo_bar'
14634     *
14635     * _.snakeCase('fooBar');
14636     * // => 'foo_bar'
14637     *
14638     * _.snakeCase('--FOO-BAR--');
14639     * // => 'foo_bar'
14640     */
14641    var snakeCase = createCompounder(function(result, word, index) {
14642      return result + (index ? '_' : '') + word.toLowerCase();
14643    });
14644
14645    /**
14646     * Splits `string` by `separator`.
14647     *
14648     * **Note:** This method is based on
14649     * [`String#split`](https://mdn.io/String/split).
14650     *
14651     * @static
14652     * @memberOf _
14653     * @since 4.0.0
14654     * @category String
14655     * @param {string} [string=''] The string to split.
14656     * @param {RegExp|string} separator The separator pattern to split by.
14657     * @param {number} [limit] The length to truncate results to.
14658     * @returns {Array} Returns the string segments.
14659     * @example
14660     *
14661     * _.split('a-b-c', '-', 2);
14662     * // => ['a', 'b']
14663     */
14664    function split(string, separator, limit) {
14665      if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
14666        separator = limit = undefined;
14667      }
14668      limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
14669      if (!limit) {
14670        return [];
14671      }
14672      string = toString(string);
14673      if (string && (
14674            typeof separator == 'string' ||
14675            (separator != null && !isRegExp(separator))
14676          )) {
14677        separator = baseToString(separator);
14678        if (!separator && hasUnicode(string)) {
14679          return castSlice(stringToArray(string), 0, limit);
14680        }
14681      }
14682      return string.split(separator, limit);
14683    }
14684
14685    /**
14686     * Converts `string` to
14687     * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
14688     *
14689     * @static
14690     * @memberOf _
14691     * @since 3.1.0
14692     * @category String
14693     * @param {string} [string=''] The string to convert.
14694     * @returns {string} Returns the start cased string.
14695     * @example
14696     *
14697     * _.startCase('--foo-bar--');
14698     * // => 'Foo Bar'
14699     *
14700     * _.startCase('fooBar');
14701     * // => 'Foo Bar'
14702     *
14703     * _.startCase('__FOO_BAR__');
14704     * // => 'FOO BAR'
14705     */
14706    var startCase = createCompounder(function(result, word, index) {
14707      return result + (index ? ' ' : '') + upperFirst(word);
14708    });
14709
14710    /**
14711     * Checks if `string` starts with the given target string.
14712     *
14713     * @static
14714     * @memberOf _
14715     * @since 3.0.0
14716     * @category String
14717     * @param {string} [string=''] The string to inspect.
14718     * @param {string} [target] The string to search for.
14719     * @param {number} [position=0] The position to search from.
14720     * @returns {boolean} Returns `true` if `string` starts with `target`,
14721     *  else `false`.
14722     * @example
14723     *
14724     * _.startsWith('abc', 'a');
14725     * // => true
14726     *
14727     * _.startsWith('abc', 'b');
14728     * // => false
14729     *
14730     * _.startsWith('abc', 'b', 1);
14731     * // => true
14732     */
14733    function startsWith(string, target, position) {
14734      string = toString(string);
14735      position = position == null
14736        ? 0
14737        : baseClamp(toInteger(position), 0, string.length);
14738
14739      target = baseToString(target);
14740      return string.slice(position, position + target.length) == target;
14741    }
14742
14743    /**
14744     * Creates a compiled template function that can interpolate data properties
14745     * in "interpolate" delimiters, HTML-escape interpolated data properties in
14746     * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
14747     * properties may be accessed as free variables in the template. If a setting
14748     * object is given, it takes precedence over `_.templateSettings` values.
14749     *
14750     * **Note:** In the development build `_.template` utilizes
14751     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
14752     * for easier debugging.
14753     *
14754     * For more information on precompiling templates see
14755     * [lodash's custom builds documentation](https://lodash.com/custom-builds).
14756     *
14757     * For more information on Chrome extension sandboxes see
14758     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
14759     *
14760     * @static
14761     * @since 0.1.0
14762     * @memberOf _
14763     * @category String
14764     * @param {string} [string=''] The template string.
14765     * @param {Object} [options={}] The options object.
14766     * @param {RegExp} [options.escape=_.templateSettings.escape]
14767     *  The HTML "escape" delimiter.
14768     * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
14769     *  The "evaluate" delimiter.
14770     * @param {Object} [options.imports=_.templateSettings.imports]
14771     *  An object to import into the template as free variables.
14772     * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
14773     *  The "interpolate" delimiter.
14774     * @param {string} [options.sourceURL='lodash.templateSources[n]']
14775     *  The sourceURL of the compiled template.
14776     * @param {string} [options.variable='obj']
14777     *  The data object variable name.
14778     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14779     * @returns {Function} Returns the compiled template function.
14780     * @example
14781     *
14782     * // Use the "interpolate" delimiter to create a compiled template.
14783     * var compiled = _.template('hello <%= user %>!');
14784     * compiled({ 'user': 'fred' });
14785     * // => 'hello fred!'
14786     *
14787     * // Use the HTML "escape" delimiter to escape data property values.
14788     * var compiled = _.template('<b><%- value %></b>');
14789     * compiled({ 'value': '<script>' });
14790     * // => '<b>&lt;script&gt;</b>'
14791     *
14792     * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
14793     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
14794     * compiled({ 'users': ['fred', 'barney'] });
14795     * // => '<li>fred</li><li>barney</li>'
14796     *
14797     * // Use the internal `print` function in "evaluate" delimiters.
14798     * var compiled = _.template('<% print("hello " + user); %>!');
14799     * compiled({ 'user': 'barney' });
14800     * // => 'hello barney!'
14801     *
14802     * // Use the ES template literal delimiter as an "interpolate" delimiter.
14803     * // Disable support by replacing the "interpolate" delimiter.
14804     * var compiled = _.template('hello ${ user }!');
14805     * compiled({ 'user': 'pebbles' });
14806     * // => 'hello pebbles!'
14807     *
14808     * // Use backslashes to treat delimiters as plain text.
14809     * var compiled = _.template('<%= "\\<%- value %\\>" %>');
14810     * compiled({ 'value': 'ignored' });
14811     * // => '<%- value %>'
14812     *
14813     * // Use the `imports` option to import `jQuery` as `jq`.
14814     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
14815     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
14816     * compiled({ 'users': ['fred', 'barney'] });
14817     * // => '<li>fred</li><li>barney</li>'
14818     *
14819     * // Use the `sourceURL` option to specify a custom sourceURL for the template.
14820     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
14821     * compiled(data);
14822     * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
14823     *
14824     * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
14825     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
14826     * compiled.source;
14827     * // => function(data) {
14828     * //   var __t, __p = '';
14829     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
14830     * //   return __p;
14831     * // }
14832     *
14833     * // Use custom template delimiters.
14834     * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
14835     * var compiled = _.template('hello {{ user }}!');
14836     * compiled({ 'user': 'mustache' });
14837     * // => 'hello mustache!'
14838     *
14839     * // Use the `source` property to inline compiled templates for meaningful
14840     * // line numbers in error messages and stack traces.
14841     * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
14842     *   var JST = {\
14843     *     "main": ' + _.template(mainText).source + '\
14844     *   };\
14845     * ');
14846     */
14847    function template(string, options, guard) {
14848      // Based on John Resig's `tmpl` implementation
14849      // (http://ejohn.org/blog/javascript-micro-templating/)
14850      // and Laura Doktorova's doT.js (https://github.com/olado/doT).
14851      var settings = lodash.templateSettings;
14852
14853      if (guard && isIterateeCall(string, options, guard)) {
14854        options = undefined;
14855      }
14856      string = toString(string);
14857      options = assignInWith({}, options, settings, customDefaultsAssignIn);
14858
14859      var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
14860          importsKeys = keys(imports),
14861          importsValues = baseValues(imports, importsKeys);
14862
14863      var isEscaping,
14864          isEvaluating,
14865          index = 0,
14866          interpolate = options.interpolate || reNoMatch,
14867          source = "__p += '";
14868
14869      // Compile the regexp to match each delimiter.
14870      var reDelimiters = RegExp(
14871        (options.escape || reNoMatch).source + '|' +
14872        interpolate.source + '|' +
14873        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
14874        (options.evaluate || reNoMatch).source + '|$'
14875      , 'g');
14876
14877      // Use a sourceURL for easier debugging.
14878      // The sourceURL gets injected into the source that's eval-ed, so be careful
14879      // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
14880      // and escape the comment, thus injecting code that gets evaled.
14881      var sourceURL = '//# sourceURL=' +
14882        (hasOwnProperty.call(options, 'sourceURL')
14883          ? (options.sourceURL + '').replace(/\s/g, ' ')
14884          : ('lodash.templateSources[' + (++templateCounter) + ']')
14885        ) + '\n';
14886
14887      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
14888        interpolateValue || (interpolateValue = esTemplateValue);
14889
14890        // Escape characters that can't be included in string literals.
14891        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
14892
14893        // Replace delimiters with snippets.
14894        if (escapeValue) {
14895          isEscaping = true;
14896          source += "' +\n__e(" + escapeValue + ") +\n'";
14897        }
14898        if (evaluateValue) {
14899          isEvaluating = true;
14900          source += "';\n" + evaluateValue + ";\n__p += '";
14901        }
14902        if (interpolateValue) {
14903          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
14904        }
14905        index = offset + match.length;
14906
14907        // The JS engine embedded in Adobe products needs `match` returned in
14908        // order to produce the correct `offset` value.
14909        return match;
14910      });
14911
14912      source += "';\n";
14913
14914      // If `variable` is not specified wrap a with-statement around the generated
14915      // code to add the data object to the top of the scope chain.
14916      var variable = hasOwnProperty.call(options, 'variable') && options.variable;
14917      if (!variable) {
14918        source = 'with (obj) {\n' + source + '\n}\n';
14919      }
14920      // Throw an error if a forbidden character was found in `variable`, to prevent
14921      // potential command injection attacks.
14922      else if (reForbiddenIdentifierChars.test(variable)) {
14923        throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
14924      }
14925
14926      // Cleanup code by stripping empty strings.
14927      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
14928        .replace(reEmptyStringMiddle, '$1')
14929        .replace(reEmptyStringTrailing, '$1;');
14930
14931      // Frame code as the function body.
14932      source = 'function(' + (variable || 'obj') + ') {\n' +
14933        (variable
14934          ? ''
14935          : 'obj || (obj = {});\n'
14936        ) +
14937        "var __t, __p = ''" +
14938        (isEscaping
14939           ? ', __e = _.escape'
14940           : ''
14941        ) +
14942        (isEvaluating
14943          ? ', __j = Array.prototype.join;\n' +
14944            "function print() { __p += __j.call(arguments, '') }\n"
14945          : ';\n'
14946        ) +
14947        source +
14948        'return __p\n}';
14949
14950      var result = attempt(function() {
14951        return Function(importsKeys, sourceURL + 'return ' + source)
14952          .apply(undefined, importsValues);
14953      });
14954
14955      // Provide the compiled function's source by its `toString` method or
14956      // the `source` property as a convenience for inlining compiled templates.
14957      result.source = source;
14958      if (isError(result)) {
14959        throw result;
14960      }
14961      return result;
14962    }
14963
14964    /**
14965     * Converts `string`, as a whole, to lower case just like
14966     * [String#toLowerCase](https://mdn.io/toLowerCase).
14967     *
14968     * @static
14969     * @memberOf _
14970     * @since 4.0.0
14971     * @category String
14972     * @param {string} [string=''] The string to convert.
14973     * @returns {string} Returns the lower cased string.
14974     * @example
14975     *
14976     * _.toLower('--Foo-Bar--');
14977     * // => '--foo-bar--'
14978     *
14979     * _.toLower('fooBar');
14980     * // => 'foobar'
14981     *
14982     * _.toLower('__FOO_BAR__');
14983     * // => '__foo_bar__'
14984     */
14985    function toLower(value) {
14986      return toString(value).toLowerCase();
14987    }
14988
14989    /**
14990     * Converts `string`, as a whole, to upper case just like
14991     * [String#toUpperCase](https://mdn.io/toUpperCase).
14992     *
14993     * @static
14994     * @memberOf _
14995     * @since 4.0.0
14996     * @category String
14997     * @param {string} [string=''] The string to convert.
14998     * @returns {string} Returns the upper cased string.
14999     * @example
15000     *
15001     * _.toUpper('--foo-bar--');
15002     * // => '--FOO-BAR--'
15003     *
15004     * _.toUpper('fooBar');
15005     * // => 'FOOBAR'
15006     *
15007     * _.toUpper('__foo_bar__');
15008     * // => '__FOO_BAR__'
15009     */
15010    function toUpper(value) {
15011      return toString(value).toUpperCase();
15012    }
15013
15014    /**
15015     * Removes leading and trailing whitespace or specified characters from `string`.
15016     *
15017     * @static
15018     * @memberOf _
15019     * @since 3.0.0
15020     * @category String
15021     * @param {string} [string=''] The string to trim.
15022     * @param {string} [chars=whitespace] The characters to trim.
15023     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15024     * @returns {string} Returns the trimmed string.
15025     * @example
15026     *
15027     * _.trim('  abc  ');
15028     * // => 'abc'
15029     *
15030     * _.trim('-_-abc-_-', '_-');
15031     * // => 'abc'
15032     *
15033     * _.map(['  foo  ', '  bar  '], _.trim);
15034     * // => ['foo', 'bar']
15035     */
15036    function trim(string, chars, guard) {
15037      string = toString(string);
15038      if (string && (guard || chars === undefined)) {
15039        return baseTrim(string);
15040      }
15041      if (!string || !(chars = baseToString(chars))) {
15042        return string;
15043      }
15044      var strSymbols = stringToArray(string),
15045          chrSymbols = stringToArray(chars),
15046          start = charsStartIndex(strSymbols, chrSymbols),
15047          end = charsEndIndex(strSymbols, chrSymbols) + 1;
15048
15049      return castSlice(strSymbols, start, end).join('');
15050    }
15051
15052    /**
15053     * Removes trailing whitespace or specified characters from `string`.
15054     *
15055     * @static
15056     * @memberOf _
15057     * @since 4.0.0
15058     * @category String
15059     * @param {string} [string=''] The string to trim.
15060     * @param {string} [chars=whitespace] The characters to trim.
15061     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15062     * @returns {string} Returns the trimmed string.
15063     * @example
15064     *
15065     * _.trimEnd('  abc  ');
15066     * // => '  abc'
15067     *
15068     * _.trimEnd('-_-abc-_-', '_-');
15069     * // => '-_-abc'
15070     */
15071    function trimEnd(string, chars, guard) {
15072      string = toString(string);
15073      if (string && (guard || chars === undefined)) {
15074        return string.slice(0, trimmedEndIndex(string) + 1);
15075      }
15076      if (!string || !(chars = baseToString(chars))) {
15077        return string;
15078      }
15079      var strSymbols = stringToArray(string),
15080          end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
15081
15082      return castSlice(strSymbols, 0, end).join('');
15083    }
15084
15085    /**
15086     * Removes leading whitespace or specified characters from `string`.
15087     *
15088     * @static
15089     * @memberOf _
15090     * @since 4.0.0
15091     * @category String
15092     * @param {string} [string=''] The string to trim.
15093     * @param {string} [chars=whitespace] The characters to trim.
15094     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15095     * @returns {string} Returns the trimmed string.
15096     * @example
15097     *
15098     * _.trimStart('  abc  ');
15099     * // => 'abc  '
15100     *
15101     * _.trimStart('-_-abc-_-', '_-');
15102     * // => 'abc-_-'
15103     */
15104    function trimStart(string, chars, guard) {
15105      string = toString(string);
15106      if (string && (guard || chars === undefined)) {
15107        return string.replace(reTrimStart, '');
15108      }
15109      if (!string || !(chars = baseToString(chars))) {
15110        return string;
15111      }
15112      var strSymbols = stringToArray(string),
15113          start = charsStartIndex(strSymbols, stringToArray(chars));
15114
15115      return castSlice(strSymbols, start).join('');
15116    }
15117
15118    /**
15119     * Truncates `string` if it's longer than the given maximum string length.
15120     * The last characters of the truncated string are replaced with the omission
15121     * string which defaults to "...".
15122     *
15123     * @static
15124     * @memberOf _
15125     * @since 4.0.0
15126     * @category String
15127     * @param {string} [string=''] The string to truncate.
15128     * @param {Object} [options={}] The options object.
15129     * @param {number} [options.length=30] The maximum string length.
15130     * @param {string} [options.omission='...'] The string to indicate text is omitted.
15131     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
15132     * @returns {string} Returns the truncated string.
15133     * @example
15134     *
15135     * _.truncate('hi-diddly-ho there, neighborino');
15136     * // => 'hi-diddly-ho there, neighbo...'
15137     *
15138     * _.truncate('hi-diddly-ho there, neighborino', {
15139     *   'length': 24,
15140     *   'separator': ' '
15141     * });
15142     * // => 'hi-diddly-ho there,...'
15143     *
15144     * _.truncate('hi-diddly-ho there, neighborino', {
15145     *   'length': 24,
15146     *   'separator': /,? +/
15147     * });
15148     * // => 'hi-diddly-ho there...'
15149     *
15150     * _.truncate('hi-diddly-ho there, neighborino', {
15151     *   'omission': ' [...]'
15152     * });
15153     * // => 'hi-diddly-ho there, neig [...]'
15154     */
15155    function truncate(string, options) {
15156      var length = DEFAULT_TRUNC_LENGTH,
15157          omission = DEFAULT_TRUNC_OMISSION;
15158
15159      if (isObject(options)) {
15160        var separator = 'separator' in options ? options.separator : separator;
15161        length = 'length' in options ? toInteger(options.length) : length;
15162        omission = 'omission' in options ? baseToString(options.omission) : omission;
15163      }
15164      string = toString(string);
15165
15166      var strLength = string.length;
15167      if (hasUnicode(string)) {
15168        var strSymbols = stringToArray(string);
15169        strLength = strSymbols.length;
15170      }
15171      if (length >= strLength) {
15172        return string;
15173      }
15174      var end = length - stringSize(omission);
15175      if (end < 1) {
15176        return omission;
15177      }
15178      var result = strSymbols
15179        ? castSlice(strSymbols, 0, end).join('')
15180        : string.slice(0, end);
15181
15182      if (separator === undefined) {
15183        return result + omission;
15184      }
15185      if (strSymbols) {
15186        end += (result.length - end);
15187      }
15188      if (isRegExp(separator)) {
15189        if (string.slice(end).search(separator)) {
15190          var match,
15191              substring = result;
15192
15193          if (!separator.global) {
15194            separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
15195          }
15196          separator.lastIndex = 0;
15197          while ((match = separator.exec(substring))) {
15198            var newEnd = match.index;
15199          }
15200          result = result.slice(0, newEnd === undefined ? end : newEnd);
15201        }
15202      } else if (string.indexOf(baseToString(separator), end) != end) {
15203        var index = result.lastIndexOf(separator);
15204        if (index > -1) {
15205          result = result.slice(0, index);
15206        }
15207      }
15208      return result + omission;
15209    }
15210
15211    /**
15212     * The inverse of `_.escape`; this method converts the HTML entities
15213     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
15214     * their corresponding characters.
15215     *
15216     * **Note:** No other HTML entities are unescaped. To unescape additional
15217     * HTML entities use a third-party library like [_he_](https://mths.be/he).
15218     *
15219     * @static
15220     * @memberOf _
15221     * @since 0.6.0
15222     * @category String
15223     * @param {string} [string=''] The string to unescape.
15224     * @returns {string} Returns the unescaped string.
15225     * @example
15226     *
15227     * _.unescape('fred, barney, &amp; pebbles');
15228     * // => 'fred, barney, & pebbles'
15229     */
15230    function unescape(string) {
15231      string = toString(string);
15232      return (string && reHasEscapedHtml.test(string))
15233        ? string.replace(reEscapedHtml, unescapeHtmlChar)
15234        : string;
15235    }
15236
15237    /**
15238     * Converts `string`, as space separated words, to upper case.
15239     *
15240     * @static
15241     * @memberOf _
15242     * @since 4.0.0
15243     * @category String
15244     * @param {string} [string=''] The string to convert.
15245     * @returns {string} Returns the upper cased string.
15246     * @example
15247     *
15248     * _.upperCase('--foo-bar');
15249     * // => 'FOO BAR'
15250     *
15251     * _.upperCase('fooBar');
15252     * // => 'FOO BAR'
15253     *
15254     * _.upperCase('__foo_bar__');
15255     * // => 'FOO BAR'
15256     */
15257    var upperCase = createCompounder(function(result, word, index) {
15258      return result + (index ? ' ' : '') + word.toUpperCase();
15259    });
15260
15261    /**
15262     * Converts the first character of `string` to upper case.
15263     *
15264     * @static
15265     * @memberOf _
15266     * @since 4.0.0
15267     * @category String
15268     * @param {string} [string=''] The string to convert.
15269     * @returns {string} Returns the converted string.
15270     * @example
15271     *
15272     * _.upperFirst('fred');
15273     * // => 'Fred'
15274     *
15275     * _.upperFirst('FRED');
15276     * // => 'FRED'
15277     */
15278    var upperFirst = createCaseFirst('toUpperCase');
15279
15280    /**
15281     * Splits `string` into an array of its words.
15282     *
15283     * @static
15284     * @memberOf _
15285     * @since 3.0.0
15286     * @category String
15287     * @param {string} [string=''] The string to inspect.
15288     * @param {RegExp|string} [pattern] The pattern to match words.
15289     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15290     * @returns {Array} Returns the words of `string`.
15291     * @example
15292     *
15293     * _.words('fred, barney, & pebbles');
15294     * // => ['fred', 'barney', 'pebbles']
15295     *
15296     * _.words('fred, barney, & pebbles', /[^, ]+/g);
15297     * // => ['fred', 'barney', '&', 'pebbles']
15298     */
15299    function words(string, pattern, guard) {
15300      string = toString(string);
15301      pattern = guard ? undefined : pattern;
15302
15303      if (pattern === undefined) {
15304        return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
15305      }
15306      return string.match(pattern) || [];
15307    }
15308
15309    /*------------------------------------------------------------------------*/
15310
15311    /**
15312     * Attempts to invoke `func`, returning either the result or the caught error
15313     * object. Any additional arguments are provided to `func` when it's invoked.
15314     *
15315     * @static
15316     * @memberOf _
15317     * @since 3.0.0
15318     * @category Util
15319     * @param {Function} func The function to attempt.
15320     * @param {...*} [args] The arguments to invoke `func` with.
15321     * @returns {*} Returns the `func` result or error object.
15322     * @example
15323     *
15324     * // Avoid throwing errors for invalid selectors.
15325     * var elements = _.attempt(function(selector) {
15326     *   return document.querySelectorAll(selector);
15327     * }, '>_>');
15328     *
15329     * if (_.isError(elements)) {
15330     *   elements = [];
15331     * }
15332     */
15333    var attempt = baseRest(function(func, args) {
15334      try {
15335        return apply(func, undefined, args);
15336      } catch (e) {
15337        return isError(e) ? e : new Error(e);
15338      }
15339    });
15340
15341    /**
15342     * Binds methods of an object to the object itself, overwriting the existing
15343     * method.
15344     *
15345     * **Note:** This method doesn't set the "length" property of bound functions.
15346     *
15347     * @static
15348     * @since 0.1.0
15349     * @memberOf _
15350     * @category Util
15351     * @param {Object} object The object to bind and assign the bound methods to.
15352     * @param {...(string|string[])} methodNames The object method names to bind.
15353     * @returns {Object} Returns `object`.
15354     * @example
15355     *
15356     * var view = {
15357     *   'label': 'docs',
15358     *   'click': function() {
15359     *     console.log('clicked ' + this.label);
15360     *   }
15361     * };
15362     *
15363     * _.bindAll(view, ['click']);
15364     * jQuery(element).on('click', view.click);
15365     * // => Logs 'clicked docs' when clicked.
15366     */
15367    var bindAll = flatRest(function(object, methodNames) {
15368      arrayEach(methodNames, function(key) {
15369        key = toKey(key);
15370        baseAssignValue(object, key, bind(object[key], object));
15371      });
15372      return object;
15373    });
15374
15375    /**
15376     * Creates a function that iterates over `pairs` and invokes the corresponding
15377     * function of the first predicate to return truthy. The predicate-function
15378     * pairs are invoked with the `this` binding and arguments of the created
15379     * function.
15380     *
15381     * @static
15382     * @memberOf _
15383     * @since 4.0.0
15384     * @category Util
15385     * @param {Array} pairs The predicate-function pairs.
15386     * @returns {Function} Returns the new composite function.
15387     * @example
15388     *
15389     * var func = _.cond([
15390     *   [_.matches({ 'a': 1 }),           _.constant('matches A')],
15391     *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
15392     *   [_.stubTrue,                      _.constant('no match')]
15393     * ]);
15394     *
15395     * func({ 'a': 1, 'b': 2 });
15396     * // => 'matches A'
15397     *
15398     * func({ 'a': 0, 'b': 1 });
15399     * // => 'matches B'
15400     *
15401     * func({ 'a': '1', 'b': '2' });
15402     * // => 'no match'
15403     */
15404    function cond(pairs) {
15405      var length = pairs == null ? 0 : pairs.length,
15406          toIteratee = getIteratee();
15407
15408      pairs = !length ? [] : arrayMap(pairs, function(pair) {
15409        if (typeof pair[1] != 'function') {
15410          throw new TypeError(FUNC_ERROR_TEXT);
15411        }
15412        return [toIteratee(pair[0]), pair[1]];
15413      });
15414
15415      return baseRest(function(args) {
15416        var index = -1;
15417        while (++index < length) {
15418          var pair = pairs[index];
15419          if (apply(pair[0], this, args)) {
15420            return apply(pair[1], this, args);
15421          }
15422        }
15423      });
15424    }
15425
15426    /**
15427     * Creates a function that invokes the predicate properties of `source` with
15428     * the corresponding property values of a given object, returning `true` if
15429     * all predicates return truthy, else `false`.
15430     *
15431     * **Note:** The created function is equivalent to `_.conformsTo` with
15432     * `source` partially applied.
15433     *
15434     * @static
15435     * @memberOf _
15436     * @since 4.0.0
15437     * @category Util
15438     * @param {Object} source The object of property predicates to conform to.
15439     * @returns {Function} Returns the new spec function.
15440     * @example
15441     *
15442     * var objects = [
15443     *   { 'a': 2, 'b': 1 },
15444     *   { 'a': 1, 'b': 2 }
15445     * ];
15446     *
15447     * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
15448     * // => [{ 'a': 1, 'b': 2 }]
15449     */
15450    function conforms(source) {
15451      return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
15452    }
15453
15454    /**
15455     * Creates a function that returns `value`.
15456     *
15457     * @static
15458     * @memberOf _
15459     * @since 2.4.0
15460     * @category Util
15461     * @param {*} value The value to return from the new function.
15462     * @returns {Function} Returns the new constant function.
15463     * @example
15464     *
15465     * var objects = _.times(2, _.constant({ 'a': 1 }));
15466     *
15467     * console.log(objects);
15468     * // => [{ 'a': 1 }, { 'a': 1 }]
15469     *
15470     * console.log(objects[0] === objects[1]);
15471     * // => true
15472     */
15473    function constant(value) {
15474      return function() {
15475        return value;
15476      };
15477    }
15478
15479    /**
15480     * Checks `value` to determine whether a default value should be returned in
15481     * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
15482     * or `undefined`.
15483     *
15484     * @static
15485     * @memberOf _
15486     * @since 4.14.0
15487     * @category Util
15488     * @param {*} value The value to check.
15489     * @param {*} defaultValue The default value.
15490     * @returns {*} Returns the resolved value.
15491     * @example
15492     *
15493     * _.defaultTo(1, 10);
15494     * // => 1
15495     *
15496     * _.defaultTo(undefined, 10);
15497     * // => 10
15498     */
15499    function defaultTo(value, defaultValue) {
15500      return (value == null || value !== value) ? defaultValue : value;
15501    }
15502
15503    /**
15504     * Creates a function that returns the result of invoking the given functions
15505     * with the `this` binding of the created function, where each successive
15506     * invocation is supplied the return value of the previous.
15507     *
15508     * @static
15509     * @memberOf _
15510     * @since 3.0.0
15511     * @category Util
15512     * @param {...(Function|Function[])} [funcs] The functions to invoke.
15513     * @returns {Function} Returns the new composite function.
15514     * @see _.flowRight
15515     * @example
15516     *
15517     * function square(n) {
15518     *   return n * n;
15519     * }
15520     *
15521     * var addSquare = _.flow([_.add, square]);
15522     * addSquare(1, 2);
15523     * // => 9
15524     */
15525    var flow = createFlow();
15526
15527    /**
15528     * This method is like `_.flow` except that it creates a function that
15529     * invokes the given functions from right to left.
15530     *
15531     * @static
15532     * @since 3.0.0
15533     * @memberOf _
15534     * @category Util
15535     * @param {...(Function|Function[])} [funcs] The functions to invoke.
15536     * @returns {Function} Returns the new composite function.
15537     * @see _.flow
15538     * @example
15539     *
15540     * function square(n) {
15541     *   return n * n;
15542     * }
15543     *
15544     * var addSquare = _.flowRight([square, _.add]);
15545     * addSquare(1, 2);
15546     * // => 9
15547     */
15548    var flowRight = createFlow(true);
15549
15550    /**
15551     * This method returns the first argument it receives.
15552     *
15553     * @static
15554     * @since 0.1.0
15555     * @memberOf _
15556     * @category Util
15557     * @param {*} value Any value.
15558     * @returns {*} Returns `value`.
15559     * @example
15560     *
15561     * var object = { 'a': 1 };
15562     *
15563     * console.log(_.identity(object) === object);
15564     * // => true
15565     */
15566    function identity(value) {
15567      return value;
15568    }
15569
15570    /**
15571     * Creates a function that invokes `func` with the arguments of the created
15572     * function. If `func` is a property name, the created function returns the
15573     * property value for a given element. If `func` is an array or object, the
15574     * created function returns `true` for elements that contain the equivalent
15575     * source properties, otherwise it returns `false`.
15576     *
15577     * @static
15578     * @since 4.0.0
15579     * @memberOf _
15580     * @category Util
15581     * @param {*} [func=_.identity] The value to convert to a callback.
15582     * @returns {Function} Returns the callback.
15583     * @example
15584     *
15585     * var users = [
15586     *   { 'user': 'barney', 'age': 36, 'active': true },
15587     *   { 'user': 'fred',   'age': 40, 'active': false }
15588     * ];
15589     *
15590     * // The `_.matches` iteratee shorthand.
15591     * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
15592     * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
15593     *
15594     * // The `_.matchesProperty` iteratee shorthand.
15595     * _.filter(users, _.iteratee(['user', 'fred']));
15596     * // => [{ 'user': 'fred', 'age': 40 }]
15597     *
15598     * // The `_.property` iteratee shorthand.
15599     * _.map(users, _.iteratee('user'));
15600     * // => ['barney', 'fred']
15601     *
15602     * // Create custom iteratee shorthands.
15603     * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
15604     *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
15605     *     return func.test(string);
15606     *   };
15607     * });
15608     *
15609     * _.filter(['abc', 'def'], /ef/);
15610     * // => ['def']
15611     */
15612    function iteratee(func) {
15613      return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
15614    }
15615
15616    /**
15617     * Creates a function that performs a partial deep comparison between a given
15618     * object and `source`, returning `true` if the given object has equivalent
15619     * property values, else `false`.
15620     *
15621     * **Note:** The created function is equivalent to `_.isMatch` with `source`
15622     * partially applied.
15623     *
15624     * Partial comparisons will match empty array and empty object `source`
15625     * values against any array or object value, respectively. See `_.isEqual`
15626     * for a list of supported value comparisons.
15627     *
15628     * **Note:** Multiple values can be checked by combining several matchers
15629     * using `_.overSome`
15630     *
15631     * @static
15632     * @memberOf _
15633     * @since 3.0.0
15634     * @category Util
15635     * @param {Object} source The object of property values to match.
15636     * @returns {Function} Returns the new spec function.
15637     * @example
15638     *
15639     * var objects = [
15640     *   { 'a': 1, 'b': 2, 'c': 3 },
15641     *   { 'a': 4, 'b': 5, 'c': 6 }
15642     * ];
15643     *
15644     * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
15645     * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
15646     *
15647     * // Checking for several possible values
15648     * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
15649     * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
15650     */
15651    function matches(source) {
15652      return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
15653    }
15654
15655    /**
15656     * Creates a function that performs a partial deep comparison between the
15657     * value at `path` of a given object to `srcValue`, returning `true` if the
15658     * object value is equivalent, else `false`.
15659     *
15660     * **Note:** Partial comparisons will match empty array and empty object
15661     * `srcValue` values against any array or object value, respectively. See
15662     * `_.isEqual` for a list of supported value comparisons.
15663     *
15664     * **Note:** Multiple values can be checked by combining several matchers
15665     * using `_.overSome`
15666     *
15667     * @static
15668     * @memberOf _
15669     * @since 3.2.0
15670     * @category Util
15671     * @param {Array|string} path The path of the property to get.
15672     * @param {*} srcValue The value to match.
15673     * @returns {Function} Returns the new spec function.
15674     * @example
15675     *
15676     * var objects = [
15677     *   { 'a': 1, 'b': 2, 'c': 3 },
15678     *   { 'a': 4, 'b': 5, 'c': 6 }
15679     * ];
15680     *
15681     * _.find(objects, _.matchesProperty('a', 4));
15682     * // => { 'a': 4, 'b': 5, 'c': 6 }
15683     *
15684     * // Checking for several possible values
15685     * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
15686     * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
15687     */
15688    function matchesProperty(path, srcValue) {
15689      return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
15690    }
15691
15692    /**
15693     * Creates a function that invokes the method at `path` of a given object.
15694     * Any additional arguments are provided to the invoked method.
15695     *
15696     * @static
15697     * @memberOf _
15698     * @since 3.7.0
15699     * @category Util
15700     * @param {Array|string} path The path of the method to invoke.
15701     * @param {...*} [args] The arguments to invoke the method with.
15702     * @returns {Function} Returns the new invoker function.
15703     * @example
15704     *
15705     * var objects = [
15706     *   { 'a': { 'b': _.constant(2) } },
15707     *   { 'a': { 'b': _.constant(1) } }
15708     * ];
15709     *
15710     * _.map(objects, _.method('a.b'));
15711     * // => [2, 1]
15712     *
15713     * _.map(objects, _.method(['a', 'b']));
15714     * // => [2, 1]
15715     */
15716    var method = baseRest(function(path, args) {
15717      return function(object) {
15718        return baseInvoke(object, path, args);
15719      };
15720    });
15721
15722    /**
15723     * The opposite of `_.method`; this method creates a function that invokes
15724     * the method at a given path of `object`. Any additional arguments are
15725     * provided to the invoked method.
15726     *
15727     * @static
15728     * @memberOf _
15729     * @since 3.7.0
15730     * @category Util
15731     * @param {Object} object The object to query.
15732     * @param {...*} [args] The arguments to invoke the method with.
15733     * @returns {Function} Returns the new invoker function.
15734     * @example
15735     *
15736     * var array = _.times(3, _.constant),
15737     *     object = { 'a': array, 'b': array, 'c': array };
15738     *
15739     * _.map(['a[2]', 'c[0]'], _.methodOf(object));
15740     * // => [2, 0]
15741     *
15742     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
15743     * // => [2, 0]
15744     */
15745    var methodOf = baseRest(function(object, args) {
15746      return function(path) {
15747        return baseInvoke(object, path, args);
15748      };
15749    });
15750
15751    /**
15752     * Adds all own enumerable string keyed function properties of a source
15753     * object to the destination object. If `object` is a function, then methods
15754     * are added to its prototype as well.
15755     *
15756     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
15757     * avoid conflicts caused by modifying the original.
15758     *
15759     * @static
15760     * @since 0.1.0
15761     * @memberOf _
15762     * @category Util
15763     * @param {Function|Object} [object=lodash] The destination object.
15764     * @param {Object} source The object of functions to add.
15765     * @param {Object} [options={}] The options object.
15766     * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
15767     * @returns {Function|Object} Returns `object`.
15768     * @example
15769     *
15770     * function vowels(string) {
15771     *   return _.filter(string, function(v) {
15772     *     return /[aeiou]/i.test(v);
15773     *   });
15774     * }
15775     *
15776     * _.mixin({ 'vowels': vowels });
15777     * _.vowels('fred');
15778     * // => ['e']
15779     *
15780     * _('fred').vowels().value();
15781     * // => ['e']
15782     *
15783     * _.mixin({ 'vowels': vowels }, { 'chain': false });
15784     * _('fred').vowels();
15785     * // => ['e']
15786     */
15787    function mixin(object, source, options) {
15788      var props = keys(source),
15789          methodNames = baseFunctions(source, props);
15790
15791      if (options == null &&
15792          !(isObject(source) && (methodNames.length || !props.length))) {
15793        options = source;
15794        source = object;
15795        object = this;
15796        methodNames = baseFunctions(source, keys(source));
15797      }
15798      var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
15799          isFunc = isFunction(object);
15800
15801      arrayEach(methodNames, function(methodName) {
15802        var func = source[methodName];
15803        object[methodName] = func;
15804        if (isFunc) {
15805          object.prototype[methodName] = function() {
15806            var chainAll = this.__chain__;
15807            if (chain || chainAll) {
15808              var result = object(this.__wrapped__),
15809                  actions = result.__actions__ = copyArray(this.__actions__);
15810
15811              actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
15812              result.__chain__ = chainAll;
15813              return result;
15814            }
15815            return func.apply(object, arrayPush([this.value()], arguments));
15816          };
15817        }
15818      });
15819
15820      return object;
15821    }
15822
15823    /**
15824     * Reverts the `_` variable to its previous value and returns a reference to
15825     * the `lodash` function.
15826     *
15827     * @static
15828     * @since 0.1.0
15829     * @memberOf _
15830     * @category Util
15831     * @returns {Function} Returns the `lodash` function.
15832     * @example
15833     *
15834     * var lodash = _.noConflict();
15835     */
15836    function noConflict() {
15837      if (root._ === this) {
15838        root._ = oldDash;
15839      }
15840      return this;
15841    }
15842
15843    /**
15844     * This method returns `undefined`.
15845     *
15846     * @static
15847     * @memberOf _
15848     * @since 2.3.0
15849     * @category Util
15850     * @example
15851     *
15852     * _.times(2, _.noop);
15853     * // => [undefined, undefined]
15854     */
15855    function noop() {
15856      // No operation performed.
15857    }
15858
15859    /**
15860     * Creates a function that gets the argument at index `n`. If `n` is negative,
15861     * the nth argument from the end is returned.
15862     *
15863     * @static
15864     * @memberOf _
15865     * @since 4.0.0
15866     * @category Util
15867     * @param {number} [n=0] The index of the argument to return.
15868     * @returns {Function} Returns the new pass-thru function.
15869     * @example
15870     *
15871     * var func = _.nthArg(1);
15872     * func('a', 'b', 'c', 'd');
15873     * // => 'b'
15874     *
15875     * var func = _.nthArg(-2);
15876     * func('a', 'b', 'c', 'd');
15877     * // => 'c'
15878     */
15879    function nthArg(n) {
15880      n = toInteger(n);
15881      return baseRest(function(args) {
15882        return baseNth(args, n);
15883      });
15884    }
15885
15886    /**
15887     * Creates a function that invokes `iteratees` with the arguments it receives
15888     * and returns their results.
15889     *
15890     * @static
15891     * @memberOf _
15892     * @since 4.0.0
15893     * @category Util
15894     * @param {...(Function|Function[])} [iteratees=[_.identity]]
15895     *  The iteratees to invoke.
15896     * @returns {Function} Returns the new function.
15897     * @example
15898     *
15899     * var func = _.over([Math.max, Math.min]);
15900     *
15901     * func(1, 2, 3, 4);
15902     * // => [4, 1]
15903     */
15904    var over = createOver(arrayMap);
15905
15906    /**
15907     * Creates a function that checks if **all** of the `predicates` return
15908     * truthy when invoked with the arguments it receives.
15909     *
15910     * Following shorthands are possible for providing predicates.
15911     * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15912     * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15913     *
15914     * @static
15915     * @memberOf _
15916     * @since 4.0.0
15917     * @category Util
15918     * @param {...(Function|Function[])} [predicates=[_.identity]]
15919     *  The predicates to check.
15920     * @returns {Function} Returns the new function.
15921     * @example
15922     *
15923     * var func = _.overEvery([Boolean, isFinite]);
15924     *
15925     * func('1');
15926     * // => true
15927     *
15928     * func(null);
15929     * // => false
15930     *
15931     * func(NaN);
15932     * // => false
15933     */
15934    var overEvery = createOver(arrayEvery);
15935
15936    /**
15937     * Creates a function that checks if **any** of the `predicates` return
15938     * truthy when invoked with the arguments it receives.
15939     *
15940     * Following shorthands are possible for providing predicates.
15941     * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15942     * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15943     *
15944     * @static
15945     * @memberOf _
15946     * @since 4.0.0
15947     * @category Util
15948     * @param {...(Function|Function[])} [predicates=[_.identity]]
15949     *  The predicates to check.
15950     * @returns {Function} Returns the new function.
15951     * @example
15952     *
15953     * var func = _.overSome([Boolean, isFinite]);
15954     *
15955     * func('1');
15956     * // => true
15957     *
15958     * func(null);
15959     * // => true
15960     *
15961     * func(NaN);
15962     * // => false
15963     *
15964     * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
15965     * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
15966     */
15967    var overSome = createOver(arraySome);
15968
15969    /**
15970     * Creates a function that returns the value at `path` of a given object.
15971     *
15972     * @static
15973     * @memberOf _
15974     * @since 2.4.0
15975     * @category Util
15976     * @param {Array|string} path The path of the property to get.
15977     * @returns {Function} Returns the new accessor function.
15978     * @example
15979     *
15980     * var objects = [
15981     *   { 'a': { 'b': 2 } },
15982     *   { 'a': { 'b': 1 } }
15983     * ];
15984     *
15985     * _.map(objects, _.property('a.b'));
15986     * // => [2, 1]
15987     *
15988     * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
15989     * // => [1, 2]
15990     */
15991    function property(path) {
15992      return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
15993    }
15994
15995    /**
15996     * The opposite of `_.property`; this method creates a function that returns
15997     * the value at a given path of `object`.
15998     *
15999     * @static
16000     * @memberOf _
16001     * @since 3.0.0
16002     * @category Util
16003     * @param {Object} object The object to query.
16004     * @returns {Function} Returns the new accessor function.
16005     * @example
16006     *
16007     * var array = [0, 1, 2],
16008     *     object = { 'a': array, 'b': array, 'c': array };
16009     *
16010     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
16011     * // => [2, 0]
16012     *
16013     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
16014     * // => [2, 0]
16015     */
16016    function propertyOf(object) {
16017      return function(path) {
16018        return object == null ? undefined : baseGet(object, path);
16019      };
16020    }
16021
16022    /**
16023     * Creates an array of numbers (positive and/or negative) progressing from
16024     * `start` up to, but not including, `end`. A step of `-1` is used if a negative
16025     * `start` is specified without an `end` or `step`. If `end` is not specified,
16026     * it's set to `start` with `start` then set to `0`.
16027     *
16028     * **Note:** JavaScript follows the IEEE-754 standard for resolving
16029     * floating-point values which can produce unexpected results.
16030     *
16031     * @static
16032     * @since 0.1.0
16033     * @memberOf _
16034     * @category Util
16035     * @param {number} [start=0] The start of the range.
16036     * @param {number} end The end of the range.
16037     * @param {number} [step=1] The value to increment or decrement by.
16038     * @returns {Array} Returns the range of numbers.
16039     * @see _.inRange, _.rangeRight
16040     * @example
16041     *
16042     * _.range(4);
16043     * // => [0, 1, 2, 3]
16044     *
16045     * _.range(-4);
16046     * // => [0, -1, -2, -3]
16047     *
16048     * _.range(1, 5);
16049     * // => [1, 2, 3, 4]
16050     *
16051     * _.range(0, 20, 5);
16052     * // => [0, 5, 10, 15]
16053     *
16054     * _.range(0, -4, -1);
16055     * // => [0, -1, -2, -3]
16056     *
16057     * _.range(1, 4, 0);
16058     * // => [1, 1, 1]
16059     *
16060     * _.range(0);
16061     * // => []
16062     */
16063    var range = createRange();
16064
16065    /**
16066     * This method is like `_.range` except that it populates values in
16067     * descending order.
16068     *
16069     * @static
16070     * @memberOf _
16071     * @since 4.0.0
16072     * @category Util
16073     * @param {number} [start=0] The start of the range.
16074     * @param {number} end The end of the range.
16075     * @param {number} [step=1] The value to increment or decrement by.
16076     * @returns {Array} Returns the range of numbers.
16077     * @see _.inRange, _.range
16078     * @example
16079     *
16080     * _.rangeRight(4);
16081     * // => [3, 2, 1, 0]
16082     *
16083     * _.rangeRight(-4);
16084     * // => [-3, -2, -1, 0]
16085     *
16086     * _.rangeRight(1, 5);
16087     * // => [4, 3, 2, 1]
16088     *
16089     * _.rangeRight(0, 20, 5);
16090     * // => [15, 10, 5, 0]
16091     *
16092     * _.rangeRight(0, -4, -1);
16093     * // => [-3, -2, -1, 0]
16094     *
16095     * _.rangeRight(1, 4, 0);
16096     * // => [1, 1, 1]
16097     *
16098     * _.rangeRight(0);
16099     * // => []
16100     */
16101    var rangeRight = createRange(true);
16102
16103    /**
16104     * This method returns a new empty array.
16105     *
16106     * @static
16107     * @memberOf _
16108     * @since 4.13.0
16109     * @category Util
16110     * @returns {Array} Returns the new empty array.
16111     * @example
16112     *
16113     * var arrays = _.times(2, _.stubArray);
16114     *
16115     * console.log(arrays);
16116     * // => [[], []]
16117     *
16118     * console.log(arrays[0] === arrays[1]);
16119     * // => false
16120     */
16121    function stubArray() {
16122      return [];
16123    }
16124
16125    /**
16126     * This method returns `false`.
16127     *
16128     * @static
16129     * @memberOf _
16130     * @since 4.13.0
16131     * @category Util
16132     * @returns {boolean} Returns `false`.
16133     * @example
16134     *
16135     * _.times(2, _.stubFalse);
16136     * // => [false, false]
16137     */
16138    function stubFalse() {
16139      return false;
16140    }
16141
16142    /**
16143     * This method returns a new empty object.
16144     *
16145     * @static
16146     * @memberOf _
16147     * @since 4.13.0
16148     * @category Util
16149     * @returns {Object} Returns the new empty object.
16150     * @example
16151     *
16152     * var objects = _.times(2, _.stubObject);
16153     *
16154     * console.log(objects);
16155     * // => [{}, {}]
16156     *
16157     * console.log(objects[0] === objects[1]);
16158     * // => false
16159     */
16160    function stubObject() {
16161      return {};
16162    }
16163
16164    /**
16165     * This method returns an empty string.
16166     *
16167     * @static
16168     * @memberOf _
16169     * @since 4.13.0
16170     * @category Util
16171     * @returns {string} Returns the empty string.
16172     * @example
16173     *
16174     * _.times(2, _.stubString);
16175     * // => ['', '']
16176     */
16177    function stubString() {
16178      return '';
16179    }
16180
16181    /**
16182     * This method returns `true`.
16183     *
16184     * @static
16185     * @memberOf _
16186     * @since 4.13.0
16187     * @category Util
16188     * @returns {boolean} Returns `true`.
16189     * @example
16190     *
16191     * _.times(2, _.stubTrue);
16192     * // => [true, true]
16193     */
16194    function stubTrue() {
16195      return true;
16196    }
16197
16198    /**
16199     * Invokes the iteratee `n` times, returning an array of the results of
16200     * each invocation. The iteratee is invoked with one argument; (index).
16201     *
16202     * @static
16203     * @since 0.1.0
16204     * @memberOf _
16205     * @category Util
16206     * @param {number} n The number of times to invoke `iteratee`.
16207     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16208     * @returns {Array} Returns the array of results.
16209     * @example
16210     *
16211     * _.times(3, String);
16212     * // => ['0', '1', '2']
16213     *
16214     *  _.times(4, _.constant(0));
16215     * // => [0, 0, 0, 0]
16216     */
16217    function times(n, iteratee) {
16218      n = toInteger(n);
16219      if (n < 1 || n > MAX_SAFE_INTEGER) {
16220        return [];
16221      }
16222      var index = MAX_ARRAY_LENGTH,
16223          length = nativeMin(n, MAX_ARRAY_LENGTH);
16224
16225      iteratee = getIteratee(iteratee);
16226      n -= MAX_ARRAY_LENGTH;
16227
16228      var result = baseTimes(length, iteratee);
16229      while (++index < n) {
16230        iteratee(index);
16231      }
16232      return result;
16233    }
16234
16235    /**
16236     * Converts `value` to a property path array.
16237     *
16238     * @static
16239     * @memberOf _
16240     * @since 4.0.0
16241     * @category Util
16242     * @param {*} value The value to convert.
16243     * @returns {Array} Returns the new property path array.
16244     * @example
16245     *
16246     * _.toPath('a.b.c');
16247     * // => ['a', 'b', 'c']
16248     *
16249     * _.toPath('a[0].b.c');
16250     * // => ['a', '0', 'b', 'c']
16251     */
16252    function toPath(value) {
16253      if (isArray(value)) {
16254        return arrayMap(value, toKey);
16255      }
16256      return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
16257    }
16258
16259    /**
16260     * Generates a unique ID. If `prefix` is given, the ID is appended to it.
16261     *
16262     * @static
16263     * @since 0.1.0
16264     * @memberOf _
16265     * @category Util
16266     * @param {string} [prefix=''] The value to prefix the ID with.
16267     * @returns {string} Returns the unique ID.
16268     * @example
16269     *
16270     * _.uniqueId('contact_');
16271     * // => 'contact_104'
16272     *
16273     * _.uniqueId();
16274     * // => '105'
16275     */
16276    function uniqueId(prefix) {
16277      var id = ++idCounter;
16278      return toString(prefix) + id;
16279    }
16280
16281    /*------------------------------------------------------------------------*/
16282
16283    /**
16284     * Adds two numbers.
16285     *
16286     * @static
16287     * @memberOf _
16288     * @since 3.4.0
16289     * @category Math
16290     * @param {number} augend The first number in an addition.
16291     * @param {number} addend The second number in an addition.
16292     * @returns {number} Returns the total.
16293     * @example
16294     *
16295     * _.add(6, 4);
16296     * // => 10
16297     */
16298    var add = createMathOperation(function(augend, addend) {
16299      return augend + addend;
16300    }, 0);
16301
16302    /**
16303     * Computes `number` rounded up to `precision`.
16304     *
16305     * @static
16306     * @memberOf _
16307     * @since 3.10.0
16308     * @category Math
16309     * @param {number} number The number to round up.
16310     * @param {number} [precision=0] The precision to round up to.
16311     * @returns {number} Returns the rounded up number.
16312     * @example
16313     *
16314     * _.ceil(4.006);
16315     * // => 5
16316     *
16317     * _.ceil(6.004, 2);
16318     * // => 6.01
16319     *
16320     * _.ceil(6040, -2);
16321     * // => 6100
16322     */
16323    var ceil = createRound('ceil');
16324
16325    /**
16326     * Divide two numbers.
16327     *
16328     * @static
16329     * @memberOf _
16330     * @since 4.7.0
16331     * @category Math
16332     * @param {number} dividend The first number in a division.
16333     * @param {number} divisor The second number in a division.
16334     * @returns {number} Returns the quotient.
16335     * @example
16336     *
16337     * _.divide(6, 4);
16338     * // => 1.5
16339     */
16340    var divide = createMathOperation(function(dividend, divisor) {
16341      return dividend / divisor;
16342    }, 1);
16343
16344    /**
16345     * Computes `number` rounded down to `precision`.
16346     *
16347     * @static
16348     * @memberOf _
16349     * @since 3.10.0
16350     * @category Math
16351     * @param {number} number The number to round down.
16352     * @param {number} [precision=0] The precision to round down to.
16353     * @returns {number} Returns the rounded down number.
16354     * @example
16355     *
16356     * _.floor(4.006);
16357     * // => 4
16358     *
16359     * _.floor(0.046, 2);
16360     * // => 0.04
16361     *
16362     * _.floor(4060, -2);
16363     * // => 4000
16364     */
16365    var floor = createRound('floor');
16366
16367    /**
16368     * Computes the maximum value of `array`. If `array` is empty or falsey,
16369     * `undefined` is returned.
16370     *
16371     * @static
16372     * @since 0.1.0
16373     * @memberOf _
16374     * @category Math
16375     * @param {Array} array The array to iterate over.
16376     * @returns {*} Returns the maximum value.
16377     * @example
16378     *
16379     * _.max([4, 2, 8, 6]);
16380     * // => 8
16381     *
16382     * _.max([]);
16383     * // => undefined
16384     */
16385    function max(array) {
16386      return (array && array.length)
16387        ? baseExtremum(array, identity, baseGt)
16388        : undefined;
16389    }
16390
16391    /**
16392     * This method is like `_.max` except that it accepts `iteratee` which is
16393     * invoked for each element in `array` to generate the criterion by which
16394     * the value is ranked. The iteratee is invoked with one argument: (value).
16395     *
16396     * @static
16397     * @memberOf _
16398     * @since 4.0.0
16399     * @category Math
16400     * @param {Array} array The array to iterate over.
16401     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16402     * @returns {*} Returns the maximum value.
16403     * @example
16404     *
16405     * var objects = [{ 'n': 1 }, { 'n': 2 }];
16406     *
16407     * _.maxBy(objects, function(o) { return o.n; });
16408     * // => { 'n': 2 }
16409     *
16410     * // The `_.property` iteratee shorthand.
16411     * _.maxBy(objects, 'n');
16412     * // => { 'n': 2 }
16413     */
16414    function maxBy(array, iteratee) {
16415      return (array && array.length)
16416        ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
16417        : undefined;
16418    }
16419
16420    /**
16421     * Computes the mean of the values in `array`.
16422     *
16423     * @static
16424     * @memberOf _
16425     * @since 4.0.0
16426     * @category Math
16427     * @param {Array} array The array to iterate over.
16428     * @returns {number} Returns the mean.
16429     * @example
16430     *
16431     * _.mean([4, 2, 8, 6]);
16432     * // => 5
16433     */
16434    function mean(array) {
16435      return baseMean(array, identity);
16436    }
16437
16438    /**
16439     * This method is like `_.mean` except that it accepts `iteratee` which is
16440     * invoked for each element in `array` to generate the value to be averaged.
16441     * The iteratee is invoked with one argument: (value).
16442     *
16443     * @static
16444     * @memberOf _
16445     * @since 4.7.0
16446     * @category Math
16447     * @param {Array} array The array to iterate over.
16448     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16449     * @returns {number} Returns the mean.
16450     * @example
16451     *
16452     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16453     *
16454     * _.meanBy(objects, function(o) { return o.n; });
16455     * // => 5
16456     *
16457     * // The `_.property` iteratee shorthand.
16458     * _.meanBy(objects, 'n');
16459     * // => 5
16460     */
16461    function meanBy(array, iteratee) {
16462      return baseMean(array, getIteratee(iteratee, 2));
16463    }
16464
16465    /**
16466     * Computes the minimum value of `array`. If `array` is empty or falsey,
16467     * `undefined` is returned.
16468     *
16469     * @static
16470     * @since 0.1.0
16471     * @memberOf _
16472     * @category Math
16473     * @param {Array} array The array to iterate over.
16474     * @returns {*} Returns the minimum value.
16475     * @example
16476     *
16477     * _.min([4, 2, 8, 6]);
16478     * // => 2
16479     *
16480     * _.min([]);
16481     * // => undefined
16482     */
16483    function min(array) {
16484      return (array && array.length)
16485        ? baseExtremum(array, identity, baseLt)
16486        : undefined;
16487    }
16488
16489    /**
16490     * This method is like `_.min` except that it accepts `iteratee` which is
16491     * invoked for each element in `array` to generate the criterion by which
16492     * the value is ranked. The iteratee is invoked with one argument: (value).
16493     *
16494     * @static
16495     * @memberOf _
16496     * @since 4.0.0
16497     * @category Math
16498     * @param {Array} array The array to iterate over.
16499     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16500     * @returns {*} Returns the minimum value.
16501     * @example
16502     *
16503     * var objects = [{ 'n': 1 }, { 'n': 2 }];
16504     *
16505     * _.minBy(objects, function(o) { return o.n; });
16506     * // => { 'n': 1 }
16507     *
16508     * // The `_.property` iteratee shorthand.
16509     * _.minBy(objects, 'n');
16510     * // => { 'n': 1 }
16511     */
16512    function minBy(array, iteratee) {
16513      return (array && array.length)
16514        ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
16515        : undefined;
16516    }
16517
16518    /**
16519     * Multiply two numbers.
16520     *
16521     * @static
16522     * @memberOf _
16523     * @since 4.7.0
16524     * @category Math
16525     * @param {number} multiplier The first number in a multiplication.
16526     * @param {number} multiplicand The second number in a multiplication.
16527     * @returns {number} Returns the product.
16528     * @example
16529     *
16530     * _.multiply(6, 4);
16531     * // => 24
16532     */
16533    var multiply = createMathOperation(function(multiplier, multiplicand) {
16534      return multiplier * multiplicand;
16535    }, 1);
16536
16537    /**
16538     * Computes `number` rounded to `precision`.
16539     *
16540     * @static
16541     * @memberOf _
16542     * @since 3.10.0
16543     * @category Math
16544     * @param {number} number The number to round.
16545     * @param {number} [precision=0] The precision to round to.
16546     * @returns {number} Returns the rounded number.
16547     * @example
16548     *
16549     * _.round(4.006);
16550     * // => 4
16551     *
16552     * _.round(4.006, 2);
16553     * // => 4.01
16554     *
16555     * _.round(4060, -2);
16556     * // => 4100
16557     */
16558    var round = createRound('round');
16559
16560    /**
16561     * Subtract two numbers.
16562     *
16563     * @static
16564     * @memberOf _
16565     * @since 4.0.0
16566     * @category Math
16567     * @param {number} minuend The first number in a subtraction.
16568     * @param {number} subtrahend The second number in a subtraction.
16569     * @returns {number} Returns the difference.
16570     * @example
16571     *
16572     * _.subtract(6, 4);
16573     * // => 2
16574     */
16575    var subtract = createMathOperation(function(minuend, subtrahend) {
16576      return minuend - subtrahend;
16577    }, 0);
16578
16579    /**
16580     * Computes the sum of the values in `array`.
16581     *
16582     * @static
16583     * @memberOf _
16584     * @since 3.4.0
16585     * @category Math
16586     * @param {Array} array The array to iterate over.
16587     * @returns {number} Returns the sum.
16588     * @example
16589     *
16590     * _.sum([4, 2, 8, 6]);
16591     * // => 20
16592     */
16593    function sum(array) {
16594      return (array && array.length)
16595        ? baseSum(array, identity)
16596        : 0;
16597    }
16598
16599    /**
16600     * This method is like `_.sum` except that it accepts `iteratee` which is
16601     * invoked for each element in `array` to generate the value to be summed.
16602     * The iteratee is invoked with one argument: (value).
16603     *
16604     * @static
16605     * @memberOf _
16606     * @since 4.0.0
16607     * @category Math
16608     * @param {Array} array The array to iterate over.
16609     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16610     * @returns {number} Returns the sum.
16611     * @example
16612     *
16613     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16614     *
16615     * _.sumBy(objects, function(o) { return o.n; });
16616     * // => 20
16617     *
16618     * // The `_.property` iteratee shorthand.
16619     * _.sumBy(objects, 'n');
16620     * // => 20
16621     */
16622    function sumBy(array, iteratee) {
16623      return (array && array.length)
16624        ? baseSum(array, getIteratee(iteratee, 2))
16625        : 0;
16626    }
16627
16628    /*------------------------------------------------------------------------*/
16629
16630    // Add methods that return wrapped values in chain sequences.
16631    lodash.after = after;
16632    lodash.ary = ary;
16633    lodash.assign = assign;
16634    lodash.assignIn = assignIn;
16635    lodash.assignInWith = assignInWith;
16636    lodash.assignWith = assignWith;
16637    lodash.at = at;
16638    lodash.before = before;
16639    lodash.bind = bind;
16640    lodash.bindAll = bindAll;
16641    lodash.bindKey = bindKey;
16642    lodash.castArray = castArray;
16643    lodash.chain = chain;
16644    lodash.chunk = chunk;
16645    lodash.compact = compact;
16646    lodash.concat = concat;
16647    lodash.cond = cond;
16648    lodash.conforms = conforms;
16649    lodash.constant = constant;
16650    lodash.countBy = countBy;
16651    lodash.create = create;
16652    lodash.curry = curry;
16653    lodash.curryRight = curryRight;
16654    lodash.debounce = debounce;
16655    lodash.defaults = defaults;
16656    lodash.defaultsDeep = defaultsDeep;
16657    lodash.defer = defer;
16658    lodash.delay = delay;
16659    lodash.difference = difference;
16660    lodash.differenceBy = differenceBy;
16661    lodash.differenceWith = differenceWith;
16662    lodash.drop = drop;
16663    lodash.dropRight = dropRight;
16664    lodash.dropRightWhile = dropRightWhile;
16665    lodash.dropWhile = dropWhile;
16666    lodash.fill = fill;
16667    lodash.filter = filter;
16668    lodash.flatMap = flatMap;
16669    lodash.flatMapDeep = flatMapDeep;
16670    lodash.flatMapDepth = flatMapDepth;
16671    lodash.flatten = flatten;
16672    lodash.flattenDeep = flattenDeep;
16673    lodash.flattenDepth = flattenDepth;
16674    lodash.flip = flip;
16675    lodash.flow = flow;
16676    lodash.flowRight = flowRight;
16677    lodash.fromPairs = fromPairs;
16678    lodash.functions = functions;
16679    lodash.functionsIn = functionsIn;
16680    lodash.groupBy = groupBy;
16681    lodash.initial = initial;
16682    lodash.intersection = intersection;
16683    lodash.intersectionBy = intersectionBy;
16684    lodash.intersectionWith = intersectionWith;
16685    lodash.invert = invert;
16686    lodash.invertBy = invertBy;
16687    lodash.invokeMap = invokeMap;
16688    lodash.iteratee = iteratee;
16689    lodash.keyBy = keyBy;
16690    lodash.keys = keys;
16691    lodash.keysIn = keysIn;
16692    lodash.map = map;
16693    lodash.mapKeys = mapKeys;
16694    lodash.mapValues = mapValues;
16695    lodash.matches = matches;
16696    lodash.matchesProperty = matchesProperty;
16697    lodash.memoize = memoize;
16698    lodash.merge = merge;
16699    lodash.mergeWith = mergeWith;
16700    lodash.method = method;
16701    lodash.methodOf = methodOf;
16702    lodash.mixin = mixin;
16703    lodash.negate = negate;
16704    lodash.nthArg = nthArg;
16705    lodash.omit = omit;
16706    lodash.omitBy = omitBy;
16707    lodash.once = once;
16708    lodash.orderBy = orderBy;
16709    lodash.over = over;
16710    lodash.overArgs = overArgs;
16711    lodash.overEvery = overEvery;
16712    lodash.overSome = overSome;
16713    lodash.partial = partial;
16714    lodash.partialRight = partialRight;
16715    lodash.partition = partition;
16716    lodash.pick = pick;
16717    lodash.pickBy = pickBy;
16718    lodash.property = property;
16719    lodash.propertyOf = propertyOf;
16720    lodash.pull = pull;
16721    lodash.pullAll = pullAll;
16722    lodash.pullAllBy = pullAllBy;
16723    lodash.pullAllWith = pullAllWith;
16724    lodash.pullAt = pullAt;
16725    lodash.range = range;
16726    lodash.rangeRight = rangeRight;
16727    lodash.rearg = rearg;
16728    lodash.reject = reject;
16729    lodash.remove = remove;
16730    lodash.rest = rest;
16731    lodash.reverse = reverse;
16732    lodash.sampleSize = sampleSize;
16733    lodash.set = set;
16734    lodash.setWith = setWith;
16735    lodash.shuffle = shuffle;
16736    lodash.slice = slice;
16737    lodash.sortBy = sortBy;
16738    lodash.sortedUniq = sortedUniq;
16739    lodash.sortedUniqBy = sortedUniqBy;
16740    lodash.split = split;
16741    lodash.spread = spread;
16742    lodash.tail = tail;
16743    lodash.take = take;
16744    lodash.takeRight = takeRight;
16745    lodash.takeRightWhile = takeRightWhile;
16746    lodash.takeWhile = takeWhile;
16747    lodash.tap = tap;
16748    lodash.throttle = throttle;
16749    lodash.thru = thru;
16750    lodash.toArray = toArray;
16751    lodash.toPairs = toPairs;
16752    lodash.toPairsIn = toPairsIn;
16753    lodash.toPath = toPath;
16754    lodash.toPlainObject = toPlainObject;
16755    lodash.transform = transform;
16756    lodash.unary = unary;
16757    lodash.union = union;
16758    lodash.unionBy = unionBy;
16759    lodash.unionWith = unionWith;
16760    lodash.uniq = uniq;
16761    lodash.uniqBy = uniqBy;
16762    lodash.uniqWith = uniqWith;
16763    lodash.unset = unset;
16764    lodash.unzip = unzip;
16765    lodash.unzipWith = unzipWith;
16766    lodash.update = update;
16767    lodash.updateWith = updateWith;
16768    lodash.values = values;
16769    lodash.valuesIn = valuesIn;
16770    lodash.without = without;
16771    lodash.words = words;
16772    lodash.wrap = wrap;
16773    lodash.xor = xor;
16774    lodash.xorBy = xorBy;
16775    lodash.xorWith = xorWith;
16776    lodash.zip = zip;
16777    lodash.zipObject = zipObject;
16778    lodash.zipObjectDeep = zipObjectDeep;
16779    lodash.zipWith = zipWith;
16780
16781    // Add aliases.
16782    lodash.entries = toPairs;
16783    lodash.entriesIn = toPairsIn;
16784    lodash.extend = assignIn;
16785    lodash.extendWith = assignInWith;
16786
16787    // Add methods to `lodash.prototype`.
16788    mixin(lodash, lodash);
16789
16790    /*------------------------------------------------------------------------*/
16791
16792    // Add methods that return unwrapped values in chain sequences.
16793    lodash.add = add;
16794    lodash.attempt = attempt;
16795    lodash.camelCase = camelCase;
16796    lodash.capitalize = capitalize;
16797    lodash.ceil = ceil;
16798    lodash.clamp = clamp;
16799    lodash.clone = clone;
16800    lodash.cloneDeep = cloneDeep;
16801    lodash.cloneDeepWith = cloneDeepWith;
16802    lodash.cloneWith = cloneWith;
16803    lodash.conformsTo = conformsTo;
16804    lodash.deburr = deburr;
16805    lodash.defaultTo = defaultTo;
16806    lodash.divide = divide;
16807    lodash.endsWith = endsWith;
16808    lodash.eq = eq;
16809    lodash.escape = escape;
16810    lodash.escapeRegExp = escapeRegExp;
16811    lodash.every = every;
16812    lodash.find = find;
16813    lodash.findIndex = findIndex;
16814    lodash.findKey = findKey;
16815    lodash.findLast = findLast;
16816    lodash.findLastIndex = findLastIndex;
16817    lodash.findLastKey = findLastKey;
16818    lodash.floor = floor;
16819    lodash.forEach = forEach;
16820    lodash.forEachRight = forEachRight;
16821    lodash.forIn = forIn;
16822    lodash.forInRight = forInRight;
16823    lodash.forOwn = forOwn;
16824    lodash.forOwnRight = forOwnRight;
16825    lodash.get = get;
16826    lodash.gt = gt;
16827    lodash.gte = gte;
16828    lodash.has = has;
16829    lodash.hasIn = hasIn;
16830    lodash.head = head;
16831    lodash.identity = identity;
16832    lodash.includes = includes;
16833    lodash.indexOf = indexOf;
16834    lodash.inRange = inRange;
16835    lodash.invoke = invoke;
16836    lodash.isArguments = isArguments;
16837    lodash.isArray = isArray;
16838    lodash.isArrayBuffer = isArrayBuffer;
16839    lodash.isArrayLike = isArrayLike;
16840    lodash.isArrayLikeObject = isArrayLikeObject;
16841    lodash.isBoolean = isBoolean;
16842    lodash.isBuffer = isBuffer;
16843    lodash.isDate = isDate;
16844    lodash.isElement = isElement;
16845    lodash.isEmpty = isEmpty;
16846    lodash.isEqual = isEqual;
16847    lodash.isEqualWith = isEqualWith;
16848    lodash.isError = isError;
16849    lodash.isFinite = isFinite;
16850    lodash.isFunction = isFunction;
16851    lodash.isInteger = isInteger;
16852    lodash.isLength = isLength;
16853    lodash.isMap = isMap;
16854    lodash.isMatch = isMatch;
16855    lodash.isMatchWith = isMatchWith;
16856    lodash.isNaN = isNaN;
16857    lodash.isNative = isNative;
16858    lodash.isNil = isNil;
16859    lodash.isNull = isNull;
16860    lodash.isNumber = isNumber;
16861    lodash.isObject = isObject;
16862    lodash.isObjectLike = isObjectLike;
16863    lodash.isPlainObject = isPlainObject;
16864    lodash.isRegExp = isRegExp;
16865    lodash.isSafeInteger = isSafeInteger;
16866    lodash.isSet = isSet;
16867    lodash.isString = isString;
16868    lodash.isSymbol = isSymbol;
16869    lodash.isTypedArray = isTypedArray;
16870    lodash.isUndefined = isUndefined;
16871    lodash.isWeakMap = isWeakMap;
16872    lodash.isWeakSet = isWeakSet;
16873    lodash.join = join;
16874    lodash.kebabCase = kebabCase;
16875    lodash.last = last;
16876    lodash.lastIndexOf = lastIndexOf;
16877    lodash.lowerCase = lowerCase;
16878    lodash.lowerFirst = lowerFirst;
16879    lodash.lt = lt;
16880    lodash.lte = lte;
16881    lodash.max = max;
16882    lodash.maxBy = maxBy;
16883    lodash.mean = mean;
16884    lodash.meanBy = meanBy;
16885    lodash.min = min;
16886    lodash.minBy = minBy;
16887    lodash.stubArray = stubArray;
16888    lodash.stubFalse = stubFalse;
16889    lodash.stubObject = stubObject;
16890    lodash.stubString = stubString;
16891    lodash.stubTrue = stubTrue;
16892    lodash.multiply = multiply;
16893    lodash.nth = nth;
16894    lodash.noConflict = noConflict;
16895    lodash.noop = noop;
16896    lodash.now = now;
16897    lodash.pad = pad;
16898    lodash.padEnd = padEnd;
16899    lodash.padStart = padStart;
16900    lodash.parseInt = parseInt;
16901    lodash.random = random;
16902    lodash.reduce = reduce;
16903    lodash.reduceRight = reduceRight;
16904    lodash.repeat = repeat;
16905    lodash.replace = replace;
16906    lodash.result = result;
16907    lodash.round = round;
16908    lodash.runInContext = runInContext;
16909    lodash.sample = sample;
16910    lodash.size = size;
16911    lodash.snakeCase = snakeCase;
16912    lodash.some = some;
16913    lodash.sortedIndex = sortedIndex;
16914    lodash.sortedIndexBy = sortedIndexBy;
16915    lodash.sortedIndexOf = sortedIndexOf;
16916    lodash.sortedLastIndex = sortedLastIndex;
16917    lodash.sortedLastIndexBy = sortedLastIndexBy;
16918    lodash.sortedLastIndexOf = sortedLastIndexOf;
16919    lodash.startCase = startCase;
16920    lodash.startsWith = startsWith;
16921    lodash.subtract = subtract;
16922    lodash.sum = sum;
16923    lodash.sumBy = sumBy;
16924    lodash.template = template;
16925    lodash.times = times;
16926    lodash.toFinite = toFinite;
16927    lodash.toInteger = toInteger;
16928    lodash.toLength = toLength;
16929    lodash.toLower = toLower;
16930    lodash.toNumber = toNumber;
16931    lodash.toSafeInteger = toSafeInteger;
16932    lodash.toString = toString;
16933    lodash.toUpper = toUpper;
16934    lodash.trim = trim;
16935    lodash.trimEnd = trimEnd;
16936    lodash.trimStart = trimStart;
16937    lodash.truncate = truncate;
16938    lodash.unescape = unescape;
16939    lodash.uniqueId = uniqueId;
16940    lodash.upperCase = upperCase;
16941    lodash.upperFirst = upperFirst;
16942
16943    // Add aliases.
16944    lodash.each = forEach;
16945    lodash.eachRight = forEachRight;
16946    lodash.first = head;
16947
16948    mixin(lodash, (function() {
16949      var source = {};
16950      baseForOwn(lodash, function(func, methodName) {
16951        if (!hasOwnProperty.call(lodash.prototype, methodName)) {
16952          source[methodName] = func;
16953        }
16954      });
16955      return source;
16956    }()), { 'chain': false });
16957
16958    /*------------------------------------------------------------------------*/
16959
16960    /**
16961     * The semantic version number.
16962     *
16963     * @static
16964     * @memberOf _
16965     * @type {string}
16966     */
16967    lodash.VERSION = VERSION;
16968
16969    // Assign default placeholders.
16970    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
16971      lodash[methodName].placeholder = lodash;
16972    });
16973
16974    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
16975    arrayEach(['drop', 'take'], function(methodName, index) {
16976      LazyWrapper.prototype[methodName] = function(n) {
16977        n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
16978
16979        var result = (this.__filtered__ && !index)
16980          ? new LazyWrapper(this)
16981          : this.clone();
16982
16983        if (result.__filtered__) {
16984          result.__takeCount__ = nativeMin(n, result.__takeCount__);
16985        } else {
16986          result.__views__.push({
16987            'size': nativeMin(n, MAX_ARRAY_LENGTH),
16988            'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
16989          });
16990        }
16991        return result;
16992      };
16993
16994      LazyWrapper.prototype[methodName + 'Right'] = function(n) {
16995        return this.reverse()[methodName](n).reverse();
16996      };
16997    });
16998
16999    // Add `LazyWrapper` methods that accept an `iteratee` value.
17000    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
17001      var type = index + 1,
17002          isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
17003
17004      LazyWrapper.prototype[methodName] = function(iteratee) {
17005        var result = this.clone();
17006        result.__iteratees__.push({
17007          'iteratee': getIteratee(iteratee, 3),
17008          'type': type
17009        });
17010        result.__filtered__ = result.__filtered__ || isFilter;
17011        return result;
17012      };
17013    });
17014
17015    // Add `LazyWrapper` methods for `_.head` and `_.last`.
17016    arrayEach(['head', 'last'], function(methodName, index) {
17017      var takeName = 'take' + (index ? 'Right' : '');
17018
17019      LazyWrapper.prototype[methodName] = function() {
17020        return this[takeName](1).value()[0];
17021      };
17022    });
17023
17024    // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
17025    arrayEach(['initial', 'tail'], function(methodName, index) {
17026      var dropName = 'drop' + (index ? '' : 'Right');
17027
17028      LazyWrapper.prototype[methodName] = function() {
17029        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
17030      };
17031    });
17032
17033    LazyWrapper.prototype.compact = function() {
17034      return this.filter(identity);
17035    };
17036
17037    LazyWrapper.prototype.find = function(predicate) {
17038      return this.filter(predicate).head();
17039    };
17040
17041    LazyWrapper.prototype.findLast = function(predicate) {
17042      return this.reverse().find(predicate);
17043    };
17044
17045    LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
17046      if (typeof path == 'function') {
17047        return new LazyWrapper(this);
17048      }
17049      return this.map(function(value) {
17050        return baseInvoke(value, path, args);
17051      });
17052    });
17053
17054    LazyWrapper.prototype.reject = function(predicate) {
17055      return this.filter(negate(getIteratee(predicate)));
17056    };
17057
17058    LazyWrapper.prototype.slice = function(start, end) {
17059      start = toInteger(start);
17060
17061      var result = this;
17062      if (result.__filtered__ && (start > 0 || end < 0)) {
17063        return new LazyWrapper(result);
17064      }
17065      if (start < 0) {
17066        result = result.takeRight(-start);
17067      } else if (start) {
17068        result = result.drop(start);
17069      }
17070      if (end !== undefined) {
17071        end = toInteger(end);
17072        result = end < 0 ? result.dropRight(-end) : result.take(end - start);
17073      }
17074      return result;
17075    };
17076
17077    LazyWrapper.prototype.takeRightWhile = function(predicate) {
17078      return this.reverse().takeWhile(predicate).reverse();
17079    };
17080
17081    LazyWrapper.prototype.toArray = function() {
17082      return this.take(MAX_ARRAY_LENGTH);
17083    };
17084
17085    // Add `LazyWrapper` methods to `lodash.prototype`.
17086    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
17087      var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
17088          isTaker = /^(?:head|last)$/.test(methodName),
17089          lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
17090          retUnwrapped = isTaker || /^find/.test(methodName);
17091
17092      if (!lodashFunc) {
17093        return;
17094      }
17095      lodash.prototype[methodName] = function() {
17096        var value = this.__wrapped__,
17097            args = isTaker ? [1] : arguments,
17098            isLazy = value instanceof LazyWrapper,
17099            iteratee = args[0],
17100            useLazy = isLazy || isArray(value);
17101
17102        var interceptor = function(value) {
17103          var result = lodashFunc.apply(lodash, arrayPush([value], args));
17104          return (isTaker && chainAll) ? result[0] : result;
17105        };
17106
17107        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
17108          // Avoid lazy use if the iteratee has a "length" value other than `1`.
17109          isLazy = useLazy = false;
17110        }
17111        var chainAll = this.__chain__,
17112            isHybrid = !!this.__actions__.length,
17113            isUnwrapped = retUnwrapped && !chainAll,
17114            onlyLazy = isLazy && !isHybrid;
17115
17116        if (!retUnwrapped && useLazy) {
17117          value = onlyLazy ? value : new LazyWrapper(this);
17118          var result = func.apply(value, args);
17119          result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
17120          return new LodashWrapper(result, chainAll);
17121        }
17122        if (isUnwrapped && onlyLazy) {
17123          return func.apply(this, args);
17124        }
17125        result = this.thru(interceptor);
17126        return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
17127      };
17128    });
17129
17130    // Add `Array` methods to `lodash.prototype`.
17131    arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
17132      var func = arrayProto[methodName],
17133          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
17134          retUnwrapped = /^(?:pop|shift)$/.test(methodName);
17135
17136      lodash.prototype[methodName] = function() {
17137        var args = arguments;
17138        if (retUnwrapped && !this.__chain__) {
17139          var value = this.value();
17140          return func.apply(isArray(value) ? value : [], args);
17141        }
17142        return this[chainName](function(value) {
17143          return func.apply(isArray(value) ? value : [], args);
17144        });
17145      };
17146    });
17147
17148    // Map minified method names to their real names.
17149    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
17150      var lodashFunc = lodash[methodName];
17151      if (lodashFunc) {
17152        var key = lodashFunc.name + '';
17153        if (!hasOwnProperty.call(realNames, key)) {
17154          realNames[key] = [];
17155        }
17156        realNames[key].push({ 'name': methodName, 'func': lodashFunc });
17157      }
17158    });
17159
17160    realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
17161      'name': 'wrapper',
17162      'func': undefined
17163    }];
17164
17165    // Add methods to `LazyWrapper`.
17166    LazyWrapper.prototype.clone = lazyClone;
17167    LazyWrapper.prototype.reverse = lazyReverse;
17168    LazyWrapper.prototype.value = lazyValue;
17169
17170    // Add chain sequence methods to the `lodash` wrapper.
17171    lodash.prototype.at = wrapperAt;
17172    lodash.prototype.chain = wrapperChain;
17173    lodash.prototype.commit = wrapperCommit;
17174    lodash.prototype.next = wrapperNext;
17175    lodash.prototype.plant = wrapperPlant;
17176    lodash.prototype.reverse = wrapperReverse;
17177    lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
17178
17179    // Add lazy aliases.
17180    lodash.prototype.first = lodash.prototype.head;
17181
17182    if (symIterator) {
17183      lodash.prototype[symIterator] = wrapperToIterator;
17184    }
17185    return lodash;
17186  });
17187
17188  /*--------------------------------------------------------------------------*/
17189
17190  // Export lodash.
17191  var _ = runInContext();
17192
17193  // Some AMD build optimizers, like r.js, check for condition patterns like:
17194  if (true) {
17195    // Expose Lodash on the global object to prevent errors when Lodash is
17196    // loaded by a script tag in the presence of an AMD loader.
17197    // See http://requirejs.org/docs/errors.html#mismatch for more details.
17198    // Use `_.noConflict` to remove Lodash from the global object.
17199    root._ = _;
17200
17201    // Define as an anonymous module so, through path mapping, it can be
17202    // referenced as the "underscore" module.
17203    !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
17204      return _;
17205    }).call(exports, __webpack_require__, exports, module),
17206		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
17207  }
17208  // Check for `exports` after `define` in case a build optimizer adds it.
17209  else {}
17210}.call(this));
17211
17212
17213/***/ })
17213
17214
17215}]);
17216//# sourceMappingURL=vendors-_yarn_cache_lodash-npm-4_17_21-6382451519-c08619c038_zip_node_modules_lodash_lodash_js.js.map?_t=0b045822d29665d4728e

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.