[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/js/dist/vendor/ -> lodash.js (source)

   1  /**
   2   * @license
   3   * Lodash <https://lodash.com/>
   4   * Copyright JS Foundation and other contributors <https://js.foundation/>
   5   * Released under MIT license <https://lodash.com/license>
   6   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   7   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   8   */
   9  ;(function() {
  10  
  11    /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  12    var undefined;
  13  
  14    /** Used as the semantic version number. */
  15    var VERSION = '4.17.11';
  16  
  17    /** Used as the size to enable large array optimizations. */
  18    var LARGE_ARRAY_SIZE = 200;
  19  
  20    /** Error message constants. */
  21    var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  22        FUNC_ERROR_TEXT = 'Expected a function';
  23  
  24    /** Used to stand-in for `undefined` hash values. */
  25    var HASH_UNDEFINED = '__lodash_hash_undefined__';
  26  
  27    /** Used as the maximum memoize cache size. */
  28    var MAX_MEMOIZE_SIZE = 500;
  29  
  30    /** Used as the internal argument placeholder. */
  31    var PLACEHOLDER = '__lodash_placeholder__';
  32  
  33    /** Used to compose bitmasks for cloning. */
  34    var CLONE_DEEP_FLAG = 1,
  35        CLONE_FLAT_FLAG = 2,
  36        CLONE_SYMBOLS_FLAG = 4;
  37  
  38    /** Used to compose bitmasks for value comparisons. */
  39    var COMPARE_PARTIAL_FLAG = 1,
  40        COMPARE_UNORDERED_FLAG = 2;
  41  
  42    /** Used to compose bitmasks for function metadata. */
  43    var WRAP_BIND_FLAG = 1,
  44        WRAP_BIND_KEY_FLAG = 2,
  45        WRAP_CURRY_BOUND_FLAG = 4,
  46        WRAP_CURRY_FLAG = 8,
  47        WRAP_CURRY_RIGHT_FLAG = 16,
  48        WRAP_PARTIAL_FLAG = 32,
  49        WRAP_PARTIAL_RIGHT_FLAG = 64,
  50        WRAP_ARY_FLAG = 128,
  51        WRAP_REARG_FLAG = 256,
  52        WRAP_FLIP_FLAG = 512;
  53  
  54    /** Used as default options for `_.truncate`. */
  55    var DEFAULT_TRUNC_LENGTH = 30,
  56        DEFAULT_TRUNC_OMISSION = '...';
  57  
  58    /** Used to detect hot functions by number of calls within a span of milliseconds. */
  59    var HOT_COUNT = 800,
  60        HOT_SPAN = 16;
  61  
  62    /** Used to indicate the type of lazy iteratees. */
  63    var LAZY_FILTER_FLAG = 1,
  64        LAZY_MAP_FLAG = 2,
  65        LAZY_WHILE_FLAG = 3;
  66  
  67    /** Used as references for various `Number` constants. */
  68    var INFINITY = 1 / 0,
  69        MAX_SAFE_INTEGER = 9007199254740991,
  70        MAX_INTEGER = 1.7976931348623157e+308,
  71        NAN = 0 / 0;
  72  
  73    /** Used as references for the maximum length and index of an array. */
  74    var MAX_ARRAY_LENGTH = 4294967295,
  75        MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  76        HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  77  
  78    /** Used to associate wrap methods with their bit flags. */
  79    var wrapFlags = [
  80      ['ary', WRAP_ARY_FLAG],
  81      ['bind', WRAP_BIND_FLAG],
  82      ['bindKey', WRAP_BIND_KEY_FLAG],
  83      ['curry', WRAP_CURRY_FLAG],
  84      ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  85      ['flip', WRAP_FLIP_FLAG],
  86      ['partial', WRAP_PARTIAL_FLAG],
  87      ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  88      ['rearg', WRAP_REARG_FLAG]
  89    ];
  90  
  91    /** `Object#toString` result references. */
  92    var argsTag = '[object Arguments]',
  93        arrayTag = '[object Array]',
  94        asyncTag = '[object AsyncFunction]',
  95        boolTag = '[object Boolean]',
  96        dateTag = '[object Date]',
  97        domExcTag = '[object DOMException]',
  98        errorTag = '[object Error]',
  99        funcTag = '[object Function]',
 100        genTag = '[object GeneratorFunction]',
 101        mapTag = '[object Map]',
 102        numberTag = '[object Number]',
 103        nullTag = '[object Null]',
 104        objectTag = '[object Object]',
 105        promiseTag = '[object Promise]',
 106        proxyTag = '[object Proxy]',
 107        regexpTag = '[object RegExp]',
 108        setTag = '[object Set]',
 109        stringTag = '[object String]',
 110        symbolTag = '[object Symbol]',
 111        undefinedTag = '[object Undefined]',
 112        weakMapTag = '[object WeakMap]',
 113        weakSetTag = '[object WeakSet]';
 114  
 115    var arrayBufferTag = '[object ArrayBuffer]',
 116        dataViewTag = '[object DataView]',
 117        float32Tag = '[object Float32Array]',
 118        float64Tag = '[object Float64Array]',
 119        int8Tag = '[object Int8Array]',
 120        int16Tag = '[object Int16Array]',
 121        int32Tag = '[object Int32Array]',
 122        uint8Tag = '[object Uint8Array]',
 123        uint8ClampedTag = '[object Uint8ClampedArray]',
 124        uint16Tag = '[object Uint16Array]',
 125        uint32Tag = '[object Uint32Array]';
 126  
 127    /** Used to match empty string literals in compiled template source. */
 128    var reEmptyStringLeading = /\b__p \+= '';/g,
 129        reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
 130        reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
 131  
 132    /** Used to match HTML entities and HTML characters. */
 133    var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
 134        reUnescapedHtml = /[&<>"']/g,
 135        reHasEscapedHtml = RegExp(reEscapedHtml.source),
 136        reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
 137  
 138    /** Used to match template delimiters. */
 139    var reEscape = /<%-([\s\S]+?)%>/g,
 140        reEvaluate = /<%([\s\S]+?)%>/g,
 141        reInterpolate = /<%=([\s\S]+?)%>/g;
 142  
 143    /** Used to match property names within property paths. */
 144    var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
 145        reIsPlainProp = /^\w*$/,
 146        rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
 147  
 148    /**
 149     * Used to match `RegExp`
 150     * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
 151     */
 152    var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
 153        reHasRegExpChar = RegExp(reRegExpChar.source);
 154  
 155    /** Used to match leading and trailing whitespace. */
 156    var reTrim = /^\s+|\s+$/g,
 157        reTrimStart = /^\s+/,
 158        reTrimEnd = /\s+$/;
 159  
 160    /** Used to match wrap detail comments. */
 161    var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
 162        reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
 163        reSplitDetails = /,? & /;
 164  
 165    /** Used to match words composed of alphanumeric characters. */
 166    var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
 167  
 168    /** Used to match backslashes in property paths. */
 169    var reEscapeChar = /\\(\\)?/g;
 170  
 171    /**
 172     * Used to match
 173     * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
 174     */
 175    var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
 176  
 177    /** Used to match `RegExp` flags from their coerced string values. */
 178    var reFlags = /\w*$/;
 179  
 180    /** Used to detect bad signed hexadecimal string values. */
 181    var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
 182  
 183    /** Used to detect binary string values. */
 184    var reIsBinary = /^0b[01]+$/i;
 185  
 186    /** Used to detect host constructors (Safari). */
 187    var reIsHostCtor = /^\[object .+?Constructor\]$/;
 188  
 189    /** Used to detect octal string values. */
 190    var reIsOctal = /^0o[0-7]+$/i;
 191  
 192    /** Used to detect unsigned integer values. */
 193    var reIsUint = /^(?:0|[1-9]\d*)$/;
 194  
 195    /** Used to match Latin Unicode letters (excluding mathematical operators). */
 196    var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
 197  
 198    /** Used to ensure capturing order of template delimiters. */
 199    var reNoMatch = /($^)/;
 200  
 201    /** Used to match unescaped characters in compiled string literals. */
 202    var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
 203  
 204    /** Used to compose unicode character classes. */
 205    var rsAstralRange = '\\ud800-\\udfff',
 206        rsComboMarksRange = '\\u0300-\\u036f',
 207        reComboHalfMarksRange = '\\ufe20-\\ufe2f',
 208        rsComboSymbolsRange = '\\u20d0-\\u20ff',
 209        rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
 210        rsDingbatRange = '\\u2700-\\u27bf',
 211        rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
 212        rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
 213        rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
 214        rsPunctuationRange = '\\u2000-\\u206f',
 215        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',
 216        rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
 217        rsVarRange = '\\ufe0e\\ufe0f',
 218        rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
 219  
 220    /** Used to compose unicode capture groups. */
 221    var rsApos = "['\u2019]",
 222        rsAstral = '[' + rsAstralRange + ']',
 223        rsBreak = '[' + rsBreakRange + ']',
 224        rsCombo = '[' + rsComboRange + ']',
 225        rsDigits = '\\d+',
 226        rsDingbat = '[' + rsDingbatRange + ']',
 227        rsLower = '[' + rsLowerRange + ']',
 228        rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
 229        rsFitz = '\\ud83c[\\udffb-\\udfff]',
 230        rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
 231        rsNonAstral = '[^' + rsAstralRange + ']',
 232        rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
 233        rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
 234        rsUpper = '[' + rsUpperRange + ']',
 235        rsZWJ = '\\u200d';
 236  
 237    /** Used to compose unicode regexes. */
 238    var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
 239        rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
 240        rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
 241        rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
 242        reOptMod = rsModifier + '?',
 243        rsOptVar = '[' + rsVarRange + ']?',
 244        rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
 245        rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
 246        rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
 247        rsSeq = rsOptVar + reOptMod + rsOptJoin,
 248        rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
 249        rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
 250  
 251    /** Used to match apostrophes. */
 252    var reApos = RegExp(rsApos, 'g');
 253  
 254    /**
 255     * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
 256     * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
 257     */
 258    var reComboMark = RegExp(rsCombo, 'g');
 259  
 260    /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
 261    var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
 262  
 263    /** Used to match complex or compound words. */
 264    var reUnicodeWord = RegExp([
 265      rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
 266      rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
 267      rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
 268      rsUpper + '+' + rsOptContrUpper,
 269      rsOrdUpper,
 270      rsOrdLower,
 271      rsDigits,
 272      rsEmoji
 273    ].join('|'), 'g');
 274  
 275    /** 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/). */
 276    var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange  + rsComboRange + rsVarRange + ']');
 277  
 278    /** Used to detect strings that need a more robust regexp to match words. */
 279    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 ]/;
 280  
 281    /** Used to assign default `context` object properties. */
 282    var contextProps = [
 283      'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
 284      'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
 285      'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
 286      'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
 287      '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
 288    ];
 289  
 290    /** Used to make template sourceURLs easier to identify. */
 291    var templateCounter = -1;
 292  
 293    /** Used to identify `toStringTag` values of typed arrays. */
 294    var typedArrayTags = {};
 295    typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
 296    typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
 297    typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
 298    typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
 299    typedArrayTags[uint32Tag] = true;
 300    typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
 301    typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
 302    typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
 303    typedArrayTags[errorTag] = typedArrayTags[funcTag] =
 304    typedArrayTags[mapTag] = typedArrayTags[numberTag] =
 305    typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
 306    typedArrayTags[setTag] = typedArrayTags[stringTag] =
 307    typedArrayTags[weakMapTag] = false;
 308  
 309    /** Used to identify `toStringTag` values supported by `_.clone`. */
 310    var cloneableTags = {};
 311    cloneableTags[argsTag] = cloneableTags[arrayTag] =
 312    cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
 313    cloneableTags[boolTag] = cloneableTags[dateTag] =
 314    cloneableTags[float32Tag] = cloneableTags[float64Tag] =
 315    cloneableTags[int8Tag] = cloneableTags[int16Tag] =
 316    cloneableTags[int32Tag] = cloneableTags[mapTag] =
 317    cloneableTags[numberTag] = cloneableTags[objectTag] =
 318    cloneableTags[regexpTag] = cloneableTags[setTag] =
 319    cloneableTags[stringTag] = cloneableTags[symbolTag] =
 320    cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
 321    cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
 322    cloneableTags[errorTag] = cloneableTags[funcTag] =
 323    cloneableTags[weakMapTag] = false;
 324  
 325    /** Used to map Latin Unicode letters to basic Latin letters. */
 326    var deburredLetters = {
 327      // Latin-1 Supplement block.
 328      '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
 329      '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
 330      '\xc7': 'C',  '\xe7': 'c',
 331      '\xd0': 'D',  '\xf0': 'd',
 332      '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
 333      '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
 334      '\xcc': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
 335      '\xec': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
 336      '\xd1': 'N',  '\xf1': 'n',
 337      '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
 338      '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
 339      '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
 340      '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
 341      '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
 342      '\xc6': 'Ae', '\xe6': 'ae',
 343      '\xde': 'Th', '\xfe': 'th',
 344      '\xdf': 'ss',
 345      // Latin Extended-A block.
 346      '\u0100': 'A',  '\u0102': 'A', '\u0104': 'A',
 347      '\u0101': 'a',  '\u0103': 'a', '\u0105': 'a',
 348      '\u0106': 'C',  '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
 349      '\u0107': 'c',  '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
 350      '\u010e': 'D',  '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
 351      '\u0112': 'E',  '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
 352      '\u0113': 'e',  '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
 353      '\u011c': 'G',  '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
 354      '\u011d': 'g',  '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
 355      '\u0124': 'H',  '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
 356      '\u0128': 'I',  '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
 357      '\u0129': 'i',  '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
 358      '\u0134': 'J',  '\u0135': 'j',
 359      '\u0136': 'K',  '\u0137': 'k', '\u0138': 'k',
 360      '\u0139': 'L',  '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
 361      '\u013a': 'l',  '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
 362      '\u0143': 'N',  '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
 363      '\u0144': 'n',  '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
 364      '\u014c': 'O',  '\u014e': 'O', '\u0150': 'O',
 365      '\u014d': 'o',  '\u014f': 'o', '\u0151': 'o',
 366      '\u0154': 'R',  '\u0156': 'R', '\u0158': 'R',
 367      '\u0155': 'r',  '\u0157': 'r', '\u0159': 'r',
 368      '\u015a': 'S',  '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
 369      '\u015b': 's',  '\u015d': 's', '\u015f': 's', '\u0161': 's',
 370      '\u0162': 'T',  '\u0164': 'T', '\u0166': 'T',
 371      '\u0163': 't',  '\u0165': 't', '\u0167': 't',
 372      '\u0168': 'U',  '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
 373      '\u0169': 'u',  '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
 374      '\u0174': 'W',  '\u0175': 'w',
 375      '\u0176': 'Y',  '\u0177': 'y', '\u0178': 'Y',
 376      '\u0179': 'Z',  '\u017b': 'Z', '\u017d': 'Z',
 377      '\u017a': 'z',  '\u017c': 'z', '\u017e': 'z',
 378      '\u0132': 'IJ', '\u0133': 'ij',
 379      '\u0152': 'Oe', '\u0153': 'oe',
 380      '\u0149': "'n", '\u017f': 's'
 381    };
 382  
 383    /** Used to map characters to HTML entities. */
 384    var htmlEscapes = {
 385      '&': '&amp;',
 386      '<': '&lt;',
 387      '>': '&gt;',
 388      '"': '&quot;',
 389      "'": '&#39;'
 390    };
 391  
 392    /** Used to map HTML entities to characters. */
 393    var htmlUnescapes = {
 394      '&amp;': '&',
 395      '&lt;': '<',
 396      '&gt;': '>',
 397      '&quot;': '"',
 398      '&#39;': "'"
 399    };
 400  
 401    /** Used to escape characters for inclusion in compiled string literals. */
 402    var stringEscapes = {
 403      '\\': '\\',
 404      "'": "'",
 405      '\n': 'n',
 406      '\r': 'r',
 407      '\u2028': 'u2028',
 408      '\u2029': 'u2029'
 409    };
 410  
 411    /** Built-in method references without a dependency on `root`. */
 412    var freeParseFloat = parseFloat,
 413        freeParseInt = parseInt;
 414  
 415    /** Detect free variable `global` from Node.js. */
 416    var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
 417  
 418    /** Detect free variable `self`. */
 419    var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
 420  
 421    /** Used as a reference to the global object. */
 422    var root = freeGlobal || freeSelf || Function('return this')();
 423  
 424    /** Detect free variable `exports`. */
 425    var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
 426  
 427    /** Detect free variable `module`. */
 428    var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
 429  
 430    /** Detect the popular CommonJS extension `module.exports`. */
 431    var moduleExports = freeModule && freeModule.exports === freeExports;
 432  
 433    /** Detect free variable `process` from Node.js. */
 434    var freeProcess = moduleExports && freeGlobal.process;
 435  
 436    /** Used to access faster Node.js helpers. */
 437    var nodeUtil = (function() {
 438      try {
 439        // Use `util.types` for Node.js 10+.
 440        var types = freeModule && freeModule.require && freeModule.require('util').types;
 441  
 442        if (types) {
 443          return types;
 444        }
 445  
 446        // Legacy `process.binding('util')` for Node.js < 10.
 447        return freeProcess && freeProcess.binding && freeProcess.binding('util');
 448      } catch (e) {}
 449    }());
 450  
 451    /* Node.js helper references. */
 452    var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
 453        nodeIsDate = nodeUtil && nodeUtil.isDate,
 454        nodeIsMap = nodeUtil && nodeUtil.isMap,
 455        nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
 456        nodeIsSet = nodeUtil && nodeUtil.isSet,
 457        nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
 458  
 459    /*--------------------------------------------------------------------------*/
 460  
 461    /**
 462     * A faster alternative to `Function#apply`, this function invokes `func`
 463     * with the `this` binding of `thisArg` and the arguments of `args`.
 464     *
 465     * @private
 466     * @param {Function} func The function to invoke.
 467     * @param {*} thisArg The `this` binding of `func`.
 468     * @param {Array} args The arguments to invoke `func` with.
 469     * @returns {*} Returns the result of `func`.
 470     */
 471    function apply(func, thisArg, args) {
 472      switch (args.length) {
 473        case 0: return func.call(thisArg);
 474        case 1: return func.call(thisArg, args[0]);
 475        case 2: return func.call(thisArg, args[0], args[1]);
 476        case 3: return func.call(thisArg, args[0], args[1], args[2]);
 477      }
 478      return func.apply(thisArg, args);
 479    }
 480  
 481    /**
 482     * A specialized version of `baseAggregator` for arrays.
 483     *
 484     * @private
 485     * @param {Array} [array] The array to iterate over.
 486     * @param {Function} setter The function to set `accumulator` values.
 487     * @param {Function} iteratee The iteratee to transform keys.
 488     * @param {Object} accumulator The initial aggregated object.
 489     * @returns {Function} Returns `accumulator`.
 490     */
 491    function arrayAggregator(array, setter, iteratee, accumulator) {
 492      var index = -1,
 493          length = array == null ? 0 : array.length;
 494  
 495      while (++index < length) {
 496        var value = array[index];
 497        setter(accumulator, value, iteratee(value), array);
 498      }
 499      return accumulator;
 500    }
 501  
 502    /**
 503     * A specialized version of `_.forEach` for arrays without support for
 504     * iteratee shorthands.
 505     *
 506     * @private
 507     * @param {Array} [array] The array to iterate over.
 508     * @param {Function} iteratee The function invoked per iteration.
 509     * @returns {Array} Returns `array`.
 510     */
 511    function arrayEach(array, iteratee) {
 512      var index = -1,
 513          length = array == null ? 0 : array.length;
 514  
 515      while (++index < length) {
 516        if (iteratee(array[index], index, array) === false) {
 517          break;
 518        }
 519      }
 520      return array;
 521    }
 522  
 523    /**
 524     * A specialized version of `_.forEachRight` for arrays without support for
 525     * iteratee shorthands.
 526     *
 527     * @private
 528     * @param {Array} [array] The array to iterate over.
 529     * @param {Function} iteratee The function invoked per iteration.
 530     * @returns {Array} Returns `array`.
 531     */
 532    function arrayEachRight(array, iteratee) {
 533      var length = array == null ? 0 : array.length;
 534  
 535      while (length--) {
 536        if (iteratee(array[length], length, array) === false) {
 537          break;
 538        }
 539      }
 540      return array;
 541    }
 542  
 543    /**
 544     * A specialized version of `_.every` for arrays without support for
 545     * iteratee shorthands.
 546     *
 547     * @private
 548     * @param {Array} [array] The array to iterate over.
 549     * @param {Function} predicate The function invoked per iteration.
 550     * @returns {boolean} Returns `true` if all elements pass the predicate check,
 551     *  else `false`.
 552     */
 553    function arrayEvery(array, predicate) {
 554      var index = -1,
 555          length = array == null ? 0 : array.length;
 556  
 557      while (++index < length) {
 558        if (!predicate(array[index], index, array)) {
 559          return false;
 560        }
 561      }
 562      return true;
 563    }
 564  
 565    /**
 566     * A specialized version of `_.filter` for arrays without support for
 567     * iteratee shorthands.
 568     *
 569     * @private
 570     * @param {Array} [array] The array to iterate over.
 571     * @param {Function} predicate The function invoked per iteration.
 572     * @returns {Array} Returns the new filtered array.
 573     */
 574    function arrayFilter(array, predicate) {
 575      var index = -1,
 576          length = array == null ? 0 : array.length,
 577          resIndex = 0,
 578          result = [];
 579  
 580      while (++index < length) {
 581        var value = array[index];
 582        if (predicate(value, index, array)) {
 583          result[resIndex++] = value;
 584        }
 585      }
 586      return result;
 587    }
 588  
 589    /**
 590     * A specialized version of `_.includes` for arrays without support for
 591     * specifying an index to search from.
 592     *
 593     * @private
 594     * @param {Array} [array] The array to inspect.
 595     * @param {*} target The value to search for.
 596     * @returns {boolean} Returns `true` if `target` is found, else `false`.
 597     */
 598    function arrayIncludes(array, value) {
 599      var length = array == null ? 0 : array.length;
 600      return !!length && baseIndexOf(array, value, 0) > -1;
 601    }
 602  
 603    /**
 604     * This function is like `arrayIncludes` except that it accepts a comparator.
 605     *
 606     * @private
 607     * @param {Array} [array] The array to inspect.
 608     * @param {*} target The value to search for.
 609     * @param {Function} comparator The comparator invoked per element.
 610     * @returns {boolean} Returns `true` if `target` is found, else `false`.
 611     */
 612    function arrayIncludesWith(array, value, comparator) {
 613      var index = -1,
 614          length = array == null ? 0 : array.length;
 615  
 616      while (++index < length) {
 617        if (comparator(value, array[index])) {
 618          return true;
 619        }
 620      }
 621      return false;
 622    }
 623  
 624    /**
 625     * A specialized version of `_.map` for arrays without support for iteratee
 626     * shorthands.
 627     *
 628     * @private
 629     * @param {Array} [array] The array to iterate over.
 630     * @param {Function} iteratee The function invoked per iteration.
 631     * @returns {Array} Returns the new mapped array.
 632     */
 633    function arrayMap(array, iteratee) {
 634      var index = -1,
 635          length = array == null ? 0 : array.length,
 636          result = Array(length);
 637  
 638      while (++index < length) {
 639        result[index] = iteratee(array[index], index, array);
 640      }
 641      return result;
 642    }
 643  
 644    /**
 645     * Appends the elements of `values` to `array`.
 646     *
 647     * @private
 648     * @param {Array} array The array to modify.
 649     * @param {Array} values The values to append.
 650     * @returns {Array} Returns `array`.
 651     */
 652    function arrayPush(array, values) {
 653      var index = -1,
 654          length = values.length,
 655          offset = array.length;
 656  
 657      while (++index < length) {
 658        array[offset + index] = values[index];
 659      }
 660      return array;
 661    }
 662  
 663    /**
 664     * A specialized version of `_.reduce` for arrays without support for
 665     * iteratee shorthands.
 666     *
 667     * @private
 668     * @param {Array} [array] The array to iterate over.
 669     * @param {Function} iteratee The function invoked per iteration.
 670     * @param {*} [accumulator] The initial value.
 671     * @param {boolean} [initAccum] Specify using the first element of `array` as
 672     *  the initial value.
 673     * @returns {*} Returns the accumulated value.
 674     */
 675    function arrayReduce(array, iteratee, accumulator, initAccum) {
 676      var index = -1,
 677          length = array == null ? 0 : array.length;
 678  
 679      if (initAccum && length) {
 680        accumulator = array[++index];
 681      }
 682      while (++index < length) {
 683        accumulator = iteratee(accumulator, array[index], index, array);
 684      }
 685      return accumulator;
 686    }
 687  
 688    /**
 689     * A specialized version of `_.reduceRight` for arrays without support for
 690     * iteratee shorthands.
 691     *
 692     * @private
 693     * @param {Array} [array] The array to iterate over.
 694     * @param {Function} iteratee The function invoked per iteration.
 695     * @param {*} [accumulator] The initial value.
 696     * @param {boolean} [initAccum] Specify using the last element of `array` as
 697     *  the initial value.
 698     * @returns {*} Returns the accumulated value.
 699     */
 700    function arrayReduceRight(array, iteratee, accumulator, initAccum) {
 701      var length = array == null ? 0 : array.length;
 702      if (initAccum && length) {
 703        accumulator = array[--length];
 704      }
 705      while (length--) {
 706        accumulator = iteratee(accumulator, array[length], length, array);
 707      }
 708      return accumulator;
 709    }
 710  
 711    /**
 712     * A specialized version of `_.some` for arrays without support for iteratee
 713     * shorthands.
 714     *
 715     * @private
 716     * @param {Array} [array] The array to iterate over.
 717     * @param {Function} predicate The function invoked per iteration.
 718     * @returns {boolean} Returns `true` if any element passes the predicate check,
 719     *  else `false`.
 720     */
 721    function arraySome(array, predicate) {
 722      var index = -1,
 723          length = array == null ? 0 : array.length;
 724  
 725      while (++index < length) {
 726        if (predicate(array[index], index, array)) {
 727          return true;
 728        }
 729      }
 730      return false;
 731    }
 732  
 733    /**
 734     * Gets the size of an ASCII `string`.
 735     *
 736     * @private
 737     * @param {string} string The string inspect.
 738     * @returns {number} Returns the string size.
 739     */
 740    var asciiSize = baseProperty('length');
 741  
 742    /**
 743     * Converts an ASCII `string` to an array.
 744     *
 745     * @private
 746     * @param {string} string The string to convert.
 747     * @returns {Array} Returns the converted array.
 748     */
 749    function asciiToArray(string) {
 750      return string.split('');
 751    }
 752  
 753    /**
 754     * Splits an ASCII `string` into an array of its words.
 755     *
 756     * @private
 757     * @param {string} The string to inspect.
 758     * @returns {Array} Returns the words of `string`.
 759     */
 760    function asciiWords(string) {
 761      return string.match(reAsciiWord) || [];
 762    }
 763  
 764    /**
 765     * The base implementation of methods like `_.findKey` and `_.findLastKey`,
 766     * without support for iteratee shorthands, which iterates over `collection`
 767     * using `eachFunc`.
 768     *
 769     * @private
 770     * @param {Array|Object} collection The collection to inspect.
 771     * @param {Function} predicate The function invoked per iteration.
 772     * @param {Function} eachFunc The function to iterate over `collection`.
 773     * @returns {*} Returns the found element or its key, else `undefined`.
 774     */
 775    function baseFindKey(collection, predicate, eachFunc) {
 776      var result;
 777      eachFunc(collection, function(value, key, collection) {
 778        if (predicate(value, key, collection)) {
 779          result = key;
 780          return false;
 781        }
 782      });
 783      return result;
 784    }
 785  
 786    /**
 787     * The base implementation of `_.findIndex` and `_.findLastIndex` without
 788     * support for iteratee shorthands.
 789     *
 790     * @private
 791     * @param {Array} array The array to inspect.
 792     * @param {Function} predicate The function invoked per iteration.
 793     * @param {number} fromIndex The index to search from.
 794     * @param {boolean} [fromRight] Specify iterating from right to left.
 795     * @returns {number} Returns the index of the matched value, else `-1`.
 796     */
 797    function baseFindIndex(array, predicate, fromIndex, fromRight) {
 798      var length = array.length,
 799          index = fromIndex + (fromRight ? 1 : -1);
 800  
 801      while ((fromRight ? index-- : ++index < length)) {
 802        if (predicate(array[index], index, array)) {
 803          return index;
 804        }
 805      }
 806      return -1;
 807    }
 808  
 809    /**
 810     * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
 811     *
 812     * @private
 813     * @param {Array} array The array to inspect.
 814     * @param {*} value The value to search for.
 815     * @param {number} fromIndex The index to search from.
 816     * @returns {number} Returns the index of the matched value, else `-1`.
 817     */
 818    function baseIndexOf(array, value, fromIndex) {
 819      return value === value
 820        ? strictIndexOf(array, value, fromIndex)
 821        : baseFindIndex(array, baseIsNaN, fromIndex);
 822    }
 823  
 824    /**
 825     * This function is like `baseIndexOf` except that it accepts a comparator.
 826     *
 827     * @private
 828     * @param {Array} array The array to inspect.
 829     * @param {*} value The value to search for.
 830     * @param {number} fromIndex The index to search from.
 831     * @param {Function} comparator The comparator invoked per element.
 832     * @returns {number} Returns the index of the matched value, else `-1`.
 833     */
 834    function baseIndexOfWith(array, value, fromIndex, comparator) {
 835      var index = fromIndex - 1,
 836          length = array.length;
 837  
 838      while (++index < length) {
 839        if (comparator(array[index], value)) {
 840          return index;
 841        }
 842      }
 843      return -1;
 844    }
 845  
 846    /**
 847     * The base implementation of `_.isNaN` without support for number objects.
 848     *
 849     * @private
 850     * @param {*} value The value to check.
 851     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
 852     */
 853    function baseIsNaN(value) {
 854      return value !== value;
 855    }
 856  
 857    /**
 858     * The base implementation of `_.mean` and `_.meanBy` without support for
 859     * iteratee shorthands.
 860     *
 861     * @private
 862     * @param {Array} array The array to iterate over.
 863     * @param {Function} iteratee The function invoked per iteration.
 864     * @returns {number} Returns the mean.
 865     */
 866    function baseMean(array, iteratee) {
 867      var length = array == null ? 0 : array.length;
 868      return length ? (baseSum(array, iteratee) / length) : NAN;
 869    }
 870  
 871    /**
 872     * The base implementation of `_.property` without support for deep paths.
 873     *
 874     * @private
 875     * @param {string} key The key of the property to get.
 876     * @returns {Function} Returns the new accessor function.
 877     */
 878    function baseProperty(key) {
 879      return function(object) {
 880        return object == null ? undefined : object[key];
 881      };
 882    }
 883  
 884    /**
 885     * The base implementation of `_.propertyOf` without support for deep paths.
 886     *
 887     * @private
 888     * @param {Object} object The object to query.
 889     * @returns {Function} Returns the new accessor function.
 890     */
 891    function basePropertyOf(object) {
 892      return function(key) {
 893        return object == null ? undefined : object[key];
 894      };
 895    }
 896  
 897    /**
 898     * The base implementation of `_.reduce` and `_.reduceRight`, without support
 899     * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
 900     *
 901     * @private
 902     * @param {Array|Object} collection The collection to iterate over.
 903     * @param {Function} iteratee The function invoked per iteration.
 904     * @param {*} accumulator The initial value.
 905     * @param {boolean} initAccum Specify using the first or last element of
 906     *  `collection` as the initial value.
 907     * @param {Function} eachFunc The function to iterate over `collection`.
 908     * @returns {*} Returns the accumulated value.
 909     */
 910    function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
 911      eachFunc(collection, function(value, index, collection) {
 912        accumulator = initAccum
 913          ? (initAccum = false, value)
 914          : iteratee(accumulator, value, index, collection);
 915      });
 916      return accumulator;
 917    }
 918  
 919    /**
 920     * The base implementation of `_.sortBy` which uses `comparer` to define the
 921     * sort order of `array` and replaces criteria objects with their corresponding
 922     * values.
 923     *
 924     * @private
 925     * @param {Array} array The array to sort.
 926     * @param {Function} comparer The function to define sort order.
 927     * @returns {Array} Returns `array`.
 928     */
 929    function baseSortBy(array, comparer) {
 930      var length = array.length;
 931  
 932      array.sort(comparer);
 933      while (length--) {
 934        array[length] = array[length].value;
 935      }
 936      return array;
 937    }
 938  
 939    /**
 940     * The base implementation of `_.sum` and `_.sumBy` without support for
 941     * iteratee shorthands.
 942     *
 943     * @private
 944     * @param {Array} array The array to iterate over.
 945     * @param {Function} iteratee The function invoked per iteration.
 946     * @returns {number} Returns the sum.
 947     */
 948    function baseSum(array, iteratee) {
 949      var result,
 950          index = -1,
 951          length = array.length;
 952  
 953      while (++index < length) {
 954        var current = iteratee(array[index]);
 955        if (current !== undefined) {
 956          result = result === undefined ? current : (result + current);
 957        }
 958      }
 959      return result;
 960    }
 961  
 962    /**
 963     * The base implementation of `_.times` without support for iteratee shorthands
 964     * or max array length checks.
 965     *
 966     * @private
 967     * @param {number} n The number of times to invoke `iteratee`.
 968     * @param {Function} iteratee The function invoked per iteration.
 969     * @returns {Array} Returns the array of results.
 970     */
 971    function baseTimes(n, iteratee) {
 972      var index = -1,
 973          result = Array(n);
 974  
 975      while (++index < n) {
 976        result[index] = iteratee(index);
 977      }
 978      return result;
 979    }
 980  
 981    /**
 982     * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
 983     * of key-value pairs for `object` corresponding to the property names of `props`.
 984     *
 985     * @private
 986     * @param {Object} object The object to query.
 987     * @param {Array} props The property names to get values for.
 988     * @returns {Object} Returns the key-value pairs.
 989     */
 990    function baseToPairs(object, props) {
 991      return arrayMap(props, function(key) {
 992        return [key, object[key]];
 993      });
 994    }
 995  
 996    /**
 997     * The base implementation of `_.unary` without support for storing metadata.
 998     *
 999     * @private
1000     * @param {Function} func The function to cap arguments for.
1001     * @returns {Function} Returns the new capped function.
1002     */
1003    function baseUnary(func) {
1004      return function(value) {
1005        return func(value);
1006      };
1007    }
1008  
1009    /**
1010     * The base implementation of `_.values` and `_.valuesIn` which creates an
1011     * array of `object` property values corresponding to the property names
1012     * of `props`.
1013     *
1014     * @private
1015     * @param {Object} object The object to query.
1016     * @param {Array} props The property names to get values for.
1017     * @returns {Object} Returns the array of property values.
1018     */
1019    function baseValues(object, props) {
1020      return arrayMap(props, function(key) {
1021        return object[key];
1022      });
1023    }
1024  
1025    /**
1026     * Checks if a `cache` value for `key` exists.
1027     *
1028     * @private
1029     * @param {Object} cache The cache to query.
1030     * @param {string} key The key of the entry to check.
1031     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1032     */
1033    function cacheHas(cache, key) {
1034      return cache.has(key);
1035    }
1036  
1037    /**
1038     * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
1039     * that is not found in the character symbols.
1040     *
1041     * @private
1042     * @param {Array} strSymbols The string symbols to inspect.
1043     * @param {Array} chrSymbols The character symbols to find.
1044     * @returns {number} Returns the index of the first unmatched string symbol.
1045     */
1046    function charsStartIndex(strSymbols, chrSymbols) {
1047      var index = -1,
1048          length = strSymbols.length;
1049  
1050      while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
1051      return index;
1052    }
1053  
1054    /**
1055     * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
1056     * that is not found in the character symbols.
1057     *
1058     * @private
1059     * @param {Array} strSymbols The string symbols to inspect.
1060     * @param {Array} chrSymbols The character symbols to find.
1061     * @returns {number} Returns the index of the last unmatched string symbol.
1062     */
1063    function charsEndIndex(strSymbols, chrSymbols) {
1064      var index = strSymbols.length;
1065  
1066      while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
1067      return index;
1068    }
1069  
1070    /**
1071     * Gets the number of `placeholder` occurrences in `array`.
1072     *
1073     * @private
1074     * @param {Array} array The array to inspect.
1075     * @param {*} placeholder The placeholder to search for.
1076     * @returns {number} Returns the placeholder count.
1077     */
1078    function countHolders(array, placeholder) {
1079      var length = array.length,
1080          result = 0;
1081  
1082      while (length--) {
1083        if (array[length] === placeholder) {
1084          ++result;
1085        }
1086      }
1087      return result;
1088    }
1089  
1090    /**
1091     * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
1092     * letters to basic Latin letters.
1093     *
1094     * @private
1095     * @param {string} letter The matched letter to deburr.
1096     * @returns {string} Returns the deburred letter.
1097     */
1098    var deburrLetter = basePropertyOf(deburredLetters);
1099  
1100    /**
1101     * Used by `_.escape` to convert characters to HTML entities.
1102     *
1103     * @private
1104     * @param {string} chr The matched character to escape.
1105     * @returns {string} Returns the escaped character.
1106     */
1107    var escapeHtmlChar = basePropertyOf(htmlEscapes);
1108  
1109    /**
1110     * Used by `_.template` to escape characters for inclusion in compiled string literals.
1111     *
1112     * @private
1113     * @param {string} chr The matched character to escape.
1114     * @returns {string} Returns the escaped character.
1115     */
1116    function escapeStringChar(chr) {
1117      return '\\' + stringEscapes[chr];
1118    }
1119  
1120    /**
1121     * Gets the value at `key` of `object`.
1122     *
1123     * @private
1124     * @param {Object} [object] The object to query.
1125     * @param {string} key The key of the property to get.
1126     * @returns {*} Returns the property value.
1127     */
1128    function getValue(object, key) {
1129      return object == null ? undefined : object[key];
1130    }
1131  
1132    /**
1133     * Checks if `string` contains Unicode symbols.
1134     *
1135     * @private
1136     * @param {string} string The string to inspect.
1137     * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1138     */
1139    function hasUnicode(string) {
1140      return reHasUnicode.test(string);
1141    }
1142  
1143    /**
1144     * Checks if `string` contains a word composed of Unicode symbols.
1145     *
1146     * @private
1147     * @param {string} string The string to inspect.
1148     * @returns {boolean} Returns `true` if a word is found, else `false`.
1149     */
1150    function hasUnicodeWord(string) {
1151      return reHasUnicodeWord.test(string);
1152    }
1153  
1154    /**
1155     * Converts `iterator` to an array.
1156     *
1157     * @private
1158     * @param {Object} iterator The iterator to convert.
1159     * @returns {Array} Returns the converted array.
1160     */
1161    function iteratorToArray(iterator) {
1162      var data,
1163          result = [];
1164  
1165      while (!(data = iterator.next()).done) {
1166        result.push(data.value);
1167      }
1168      return result;
1169    }
1170  
1171    /**
1172     * Converts `map` to its key-value pairs.
1173     *
1174     * @private
1175     * @param {Object} map The map to convert.
1176     * @returns {Array} Returns the key-value pairs.
1177     */
1178    function mapToArray(map) {
1179      var index = -1,
1180          result = Array(map.size);
1181  
1182      map.forEach(function(value, key) {
1183        result[++index] = [key, value];
1184      });
1185      return result;
1186    }
1187  
1188    /**
1189     * Creates a unary function that invokes `func` with its argument transformed.
1190     *
1191     * @private
1192     * @param {Function} func The function to wrap.
1193     * @param {Function} transform The argument transform.
1194     * @returns {Function} Returns the new function.
1195     */
1196    function overArg(func, transform) {
1197      return function(arg) {
1198        return func(transform(arg));
1199      };
1200    }
1201  
1202    /**
1203     * Replaces all `placeholder` elements in `array` with an internal placeholder
1204     * and returns an array of their indexes.
1205     *
1206     * @private
1207     * @param {Array} array The array to modify.
1208     * @param {*} placeholder The placeholder to replace.
1209     * @returns {Array} Returns the new array of placeholder indexes.
1210     */
1211    function replaceHolders(array, placeholder) {
1212      var index = -1,
1213          length = array.length,
1214          resIndex = 0,
1215          result = [];
1216  
1217      while (++index < length) {
1218        var value = array[index];
1219        if (value === placeholder || value === PLACEHOLDER) {
1220          array[index] = PLACEHOLDER;
1221          result[resIndex++] = index;
1222        }
1223      }
1224      return result;
1225    }
1226  
1227    /**
1228     * Converts `set` to an array of its values.
1229     *
1230     * @private
1231     * @param {Object} set The set to convert.
1232     * @returns {Array} Returns the values.
1233     */
1234    function setToArray(set) {
1235      var index = -1,
1236          result = Array(set.size);
1237  
1238      set.forEach(function(value) {
1239        result[++index] = value;
1240      });
1241      return result;
1242    }
1243  
1244    /**
1245     * Converts `set` to its value-value pairs.
1246     *
1247     * @private
1248     * @param {Object} set The set to convert.
1249     * @returns {Array} Returns the value-value pairs.
1250     */
1251    function setToPairs(set) {
1252      var index = -1,
1253          result = Array(set.size);
1254  
1255      set.forEach(function(value) {
1256        result[++index] = [value, value];
1257      });
1258      return result;
1259    }
1260  
1261    /**
1262     * A specialized version of `_.indexOf` which performs strict equality
1263     * comparisons of values, i.e. `===`.
1264     *
1265     * @private
1266     * @param {Array} array The array to inspect.
1267     * @param {*} value The value to search for.
1268     * @param {number} fromIndex The index to search from.
1269     * @returns {number} Returns the index of the matched value, else `-1`.
1270     */
1271    function strictIndexOf(array, value, fromIndex) {
1272      var index = fromIndex - 1,
1273          length = array.length;
1274  
1275      while (++index < length) {
1276        if (array[index] === value) {
1277          return index;
1278        }
1279      }
1280      return -1;
1281    }
1282  
1283    /**
1284     * A specialized version of `_.lastIndexOf` which performs strict equality
1285     * comparisons of values, i.e. `===`.
1286     *
1287     * @private
1288     * @param {Array} array The array to inspect.
1289     * @param {*} value The value to search for.
1290     * @param {number} fromIndex The index to search from.
1291     * @returns {number} Returns the index of the matched value, else `-1`.
1292     */
1293    function strictLastIndexOf(array, value, fromIndex) {
1294      var index = fromIndex + 1;
1295      while (index--) {
1296        if (array[index] === value) {
1297          return index;
1298        }
1299      }
1300      return index;
1301    }
1302  
1303    /**
1304     * Gets the number of symbols in `string`.
1305     *
1306     * @private
1307     * @param {string} string The string to inspect.
1308     * @returns {number} Returns the string size.
1309     */
1310    function stringSize(string) {
1311      return hasUnicode(string)
1312        ? unicodeSize(string)
1313        : asciiSize(string);
1314    }
1315  
1316    /**
1317     * Converts `string` to an array.
1318     *
1319     * @private
1320     * @param {string} string The string to convert.
1321     * @returns {Array} Returns the converted array.
1322     */
1323    function stringToArray(string) {
1324      return hasUnicode(string)
1325        ? unicodeToArray(string)
1326        : asciiToArray(string);
1327    }
1328  
1329    /**
1330     * Used by `_.unescape` to convert HTML entities to characters.
1331     *
1332     * @private
1333     * @param {string} chr The matched character to unescape.
1334     * @returns {string} Returns the unescaped character.
1335     */
1336    var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
1337  
1338    /**
1339     * Gets the size of a Unicode `string`.
1340     *
1341     * @private
1342     * @param {string} string The string inspect.
1343     * @returns {number} Returns the string size.
1344     */
1345    function unicodeSize(string) {
1346      var result = reUnicode.lastIndex = 0;
1347      while (reUnicode.test(string)) {
1348        ++result;
1349      }
1350      return result;
1351    }
1352  
1353    /**
1354     * Converts a Unicode `string` to an array.
1355     *
1356     * @private
1357     * @param {string} string The string to convert.
1358     * @returns {Array} Returns the converted array.
1359     */
1360    function unicodeToArray(string) {
1361      return string.match(reUnicode) || [];
1362    }
1363  
1364    /**
1365     * Splits a Unicode `string` into an array of its words.
1366     *
1367     * @private
1368     * @param {string} The string to inspect.
1369     * @returns {Array} Returns the words of `string`.
1370     */
1371    function unicodeWords(string) {
1372      return string.match(reUnicodeWord) || [];
1373    }
1374  
1375    /*--------------------------------------------------------------------------*/
1376  
1377    /**
1378     * Create a new pristine `lodash` function using the `context` object.
1379     *
1380     * @static
1381     * @memberOf _
1382     * @since 1.1.0
1383     * @category Util
1384     * @param {Object} [context=root] The context object.
1385     * @returns {Function} Returns a new `lodash` function.
1386     * @example
1387     *
1388     * _.mixin({ 'foo': _.constant('foo') });
1389     *
1390     * var lodash = _.runInContext();
1391     * lodash.mixin({ 'bar': lodash.constant('bar') });
1392     *
1393     * _.isFunction(_.foo);
1394     * // => true
1395     * _.isFunction(_.bar);
1396     * // => false
1397     *
1398     * lodash.isFunction(lodash.foo);
1399     * // => false
1400     * lodash.isFunction(lodash.bar);
1401     * // => true
1402     *
1403     * // Create a suped-up `defer` in Node.js.
1404     * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
1405     */
1406    var runInContext = (function runInContext(context) {
1407      context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
1408  
1409      /** Built-in constructor references. */
1410      var Array = context.Array,
1411          Date = context.Date,
1412          Error = context.Error,
1413          Function = context.Function,
1414          Math = context.Math,
1415          Object = context.Object,
1416          RegExp = context.RegExp,
1417          String = context.String,
1418          TypeError = context.TypeError;
1419  
1420      /** Used for built-in method references. */
1421      var arrayProto = Array.prototype,
1422          funcProto = Function.prototype,
1423          objectProto = Object.prototype;
1424  
1425      /** Used to detect overreaching core-js shims. */
1426      var coreJsData = context['__core-js_shared__'];
1427  
1428      /** Used to resolve the decompiled source of functions. */
1429      var funcToString = funcProto.toString;
1430  
1431      /** Used to check objects for own properties. */
1432      var hasOwnProperty = objectProto.hasOwnProperty;
1433  
1434      /** Used to generate unique IDs. */
1435      var idCounter = 0;
1436  
1437      /** Used to detect methods masquerading as native. */
1438      var maskSrcKey = (function() {
1439        var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1440        return uid ? ('Symbol(src)_1.' + uid) : '';
1441      }());
1442  
1443      /**
1444       * Used to resolve the
1445       * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1446       * of values.
1447       */
1448      var nativeObjectToString = objectProto.toString;
1449  
1450      /** Used to infer the `Object` constructor. */
1451      var objectCtorString = funcToString.call(Object);
1452  
1453      /** Used to restore the original `_` reference in `_.noConflict`. */
1454      var oldDash = root._;
1455  
1456      /** Used to detect if a method is native. */
1457      var reIsNative = RegExp('^' +
1458        funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
1459        .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1460      );
1461  
1462      /** Built-in value references. */
1463      var Buffer = moduleExports ? context.Buffer : undefined,
1464          Symbol = context.Symbol,
1465          Uint8Array = context.Uint8Array,
1466          allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
1467          getPrototype = overArg(Object.getPrototypeOf, Object),
1468          objectCreate = Object.create,
1469          propertyIsEnumerable = objectProto.propertyIsEnumerable,
1470          splice = arrayProto.splice,
1471          spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
1472          symIterator = Symbol ? Symbol.iterator : undefined,
1473          symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1474  
1475      var defineProperty = (function() {
1476        try {
1477          var func = getNative(Object, 'defineProperty');
1478          func({}, '', {});
1479          return func;
1480        } catch (e) {}
1481      }());
1482  
1483      /** Mocked built-ins. */
1484      var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
1485          ctxNow = Date && Date.now !== root.Date.now && Date.now,
1486          ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1487  
1488      /* Built-in method references for those with the same name as other `lodash` methods. */
1489      var nativeCeil = Math.ceil,
1490          nativeFloor = Math.floor,
1491          nativeGetSymbols = Object.getOwnPropertySymbols,
1492          nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
1493          nativeIsFinite = context.isFinite,
1494          nativeJoin = arrayProto.join,
1495          nativeKeys = overArg(Object.keys, Object),
1496          nativeMax = Math.max,
1497          nativeMin = Math.min,
1498          nativeNow = Date.now,
1499          nativeParseInt = context.parseInt,
1500          nativeRandom = Math.random,
1501          nativeReverse = arrayProto.reverse;
1502  
1503      /* Built-in method references that are verified to be native. */
1504      var DataView = getNative(context, 'DataView'),
1505          Map = getNative(context, 'Map'),
1506          Promise = getNative(context, 'Promise'),
1507          Set = getNative(context, 'Set'),
1508          WeakMap = getNative(context, 'WeakMap'),
1509          nativeCreate = getNative(Object, 'create');
1510  
1511      /** Used to store function metadata. */
1512      var metaMap = WeakMap && new WeakMap;
1513  
1514      /** Used to lookup unminified function names. */
1515      var realNames = {};
1516  
1517      /** Used to detect maps, sets, and weakmaps. */
1518      var dataViewCtorString = toSource(DataView),
1519          mapCtorString = toSource(Map),
1520          promiseCtorString = toSource(Promise),
1521          setCtorString = toSource(Set),
1522          weakMapCtorString = toSource(WeakMap);
1523  
1524      /** Used to convert symbols to primitives and strings. */
1525      var symbolProto = Symbol ? Symbol.prototype : undefined,
1526          symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
1527          symbolToString = symbolProto ? symbolProto.toString : undefined;
1528  
1529      /*------------------------------------------------------------------------*/
1530  
1531      /**
1532       * Creates a `lodash` object which wraps `value` to enable implicit method
1533       * chain sequences. Methods that operate on and return arrays, collections,
1534       * and functions can be chained together. Methods that retrieve a single value
1535       * or may return a primitive value will automatically end the chain sequence
1536       * and return the unwrapped value. Otherwise, the value must be unwrapped
1537       * with `_#value`.
1538       *
1539       * Explicit chain sequences, which must be unwrapped with `_#value`, may be
1540       * enabled using `_.chain`.
1541       *
1542       * The execution of chained methods is lazy, that is, it's deferred until
1543       * `_#value` is implicitly or explicitly called.
1544       *
1545       * Lazy evaluation allows several methods to support shortcut fusion.
1546       * Shortcut fusion is an optimization to merge iteratee calls; this avoids
1547       * the creation of intermediate arrays and can greatly reduce the number of
1548       * iteratee executions. Sections of a chain sequence qualify for shortcut
1549       * fusion if the section is applied to an array and iteratees accept only
1550       * one argument. The heuristic for whether a section qualifies for shortcut
1551       * fusion is subject to change.
1552       *
1553       * Chaining is supported in custom builds as long as the `_#value` method is
1554       * directly or indirectly included in the build.
1555       *
1556       * In addition to lodash methods, wrappers have `Array` and `String` methods.
1557       *
1558       * The wrapper `Array` methods are:
1559       * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
1560       *
1561       * The wrapper `String` methods are:
1562       * `replace` and `split`
1563       *
1564       * The wrapper methods that support shortcut fusion are:
1565       * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
1566       * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
1567       * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
1568       *
1569       * The chainable wrapper methods are:
1570       * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
1571       * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
1572       * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
1573       * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
1574       * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
1575       * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
1576       * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
1577       * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
1578       * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
1579       * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
1580       * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
1581       * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
1582       * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
1583       * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
1584       * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
1585       * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
1586       * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
1587       * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
1588       * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
1589       * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
1590       * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
1591       * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
1592       * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
1593       * `zipObject`, `zipObjectDeep`, and `zipWith`
1594       *
1595       * The wrapper methods that are **not** chainable by default are:
1596       * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
1597       * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
1598       * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
1599       * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
1600       * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
1601       * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
1602       * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
1603       * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
1604       * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
1605       * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
1606       * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
1607       * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
1608       * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
1609       * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
1610       * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
1611       * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
1612       * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
1613       * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
1614       * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
1615       * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
1616       * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
1617       * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
1618       * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
1619       * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
1620       * `upperFirst`, `value`, and `words`
1621       *
1622       * @name _
1623       * @constructor
1624       * @category Seq
1625       * @param {*} value The value to wrap in a `lodash` instance.
1626       * @returns {Object} Returns the new `lodash` wrapper instance.
1627       * @example
1628       *
1629       * function square(n) {
1630       *   return n * n;
1631       * }
1632       *
1633       * var wrapped = _([1, 2, 3]);
1634       *
1635       * // Returns an unwrapped value.
1636       * wrapped.reduce(_.add);
1637       * // => 6
1638       *
1639       * // Returns a wrapped value.
1640       * var squares = wrapped.map(square);
1641       *
1642       * _.isArray(squares);
1643       * // => false
1644       *
1645       * _.isArray(squares.value());
1646       * // => true
1647       */
1648      function lodash(value) {
1649        if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
1650          if (value instanceof LodashWrapper) {
1651            return value;
1652          }
1653          if (hasOwnProperty.call(value, '__wrapped__')) {
1654            return wrapperClone(value);
1655          }
1656        }
1657        return new LodashWrapper(value);
1658      }
1659  
1660      /**
1661       * The base implementation of `_.create` without support for assigning
1662       * properties to the created object.
1663       *
1664       * @private
1665       * @param {Object} proto The object to inherit from.
1666       * @returns {Object} Returns the new object.
1667       */
1668      var baseCreate = (function() {
1669        function object() {}
1670        return function(proto) {
1671          if (!isObject(proto)) {
1672            return {};
1673          }
1674          if (objectCreate) {
1675            return objectCreate(proto);
1676          }
1677          object.prototype = proto;
1678          var result = new object;
1679          object.prototype = undefined;
1680          return result;
1681        };
1682      }());
1683  
1684      /**
1685       * The function whose prototype chain sequence wrappers inherit from.
1686       *
1687       * @private
1688       */
1689      function baseLodash() {
1690        // No operation performed.
1691      }
1692  
1693      /**
1694       * The base constructor for creating `lodash` wrapper objects.
1695       *
1696       * @private
1697       * @param {*} value The value to wrap.
1698       * @param {boolean} [chainAll] Enable explicit method chain sequences.
1699       */
1700      function LodashWrapper(value, chainAll) {
1701        this.__wrapped__ = value;
1702        this.__actions__ = [];
1703        this.__chain__ = !!chainAll;
1704        this.__index__ = 0;
1705        this.__values__ = undefined;
1706      }
1707  
1708      /**
1709       * By default, the template delimiters used by lodash are like those in
1710       * embedded Ruby (ERB) as well as ES2015 template strings. Change the
1711       * following template settings to use alternative delimiters.
1712       *
1713       * @static
1714       * @memberOf _
1715       * @type {Object}
1716       */
1717      lodash.templateSettings = {
1718  
1719        /**
1720         * Used to detect `data` property values to be HTML-escaped.
1721         *
1722         * @memberOf _.templateSettings
1723         * @type {RegExp}
1724         */
1725        'escape': reEscape,
1726  
1727        /**
1728         * Used to detect code to be evaluated.
1729         *
1730         * @memberOf _.templateSettings
1731         * @type {RegExp}
1732         */
1733        'evaluate': reEvaluate,
1734  
1735        /**
1736         * Used to detect `data` property values to inject.
1737         *
1738         * @memberOf _.templateSettings
1739         * @type {RegExp}
1740         */
1741        'interpolate': reInterpolate,
1742  
1743        /**
1744         * Used to reference the data object in the template text.
1745         *
1746         * @memberOf _.templateSettings
1747         * @type {string}
1748         */
1749        'variable': '',
1750  
1751        /**
1752         * Used to import variables into the compiled template.
1753         *
1754         * @memberOf _.templateSettings
1755         * @type {Object}
1756         */
1757        'imports': {
1758  
1759          /**
1760           * A reference to the `lodash` function.
1761           *
1762           * @memberOf _.templateSettings.imports
1763           * @type {Function}
1764           */
1765          '_': lodash
1766        }
1767      };
1768  
1769      // Ensure wrappers are instances of `baseLodash`.
1770      lodash.prototype = baseLodash.prototype;
1771      lodash.prototype.constructor = lodash;
1772  
1773      LodashWrapper.prototype = baseCreate(baseLodash.prototype);
1774      LodashWrapper.prototype.constructor = LodashWrapper;
1775  
1776      /*------------------------------------------------------------------------*/
1777  
1778      /**
1779       * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
1780       *
1781       * @private
1782       * @constructor
1783       * @param {*} value The value to wrap.
1784       */
1785      function LazyWrapper(value) {
1786        this.__wrapped__ = value;
1787        this.__actions__ = [];
1788        this.__dir__ = 1;
1789        this.__filtered__ = false;
1790        this.__iteratees__ = [];
1791        this.__takeCount__ = MAX_ARRAY_LENGTH;
1792        this.__views__ = [];
1793      }
1794  
1795      /**
1796       * Creates a clone of the lazy wrapper object.
1797       *
1798       * @private
1799       * @name clone
1800       * @memberOf LazyWrapper
1801       * @returns {Object} Returns the cloned `LazyWrapper` object.
1802       */
1803      function lazyClone() {
1804        var result = new LazyWrapper(this.__wrapped__);
1805        result.__actions__ = copyArray(this.__actions__);
1806        result.__dir__ = this.__dir__;
1807        result.__filtered__ = this.__filtered__;
1808        result.__iteratees__ = copyArray(this.__iteratees__);
1809        result.__takeCount__ = this.__takeCount__;
1810        result.__views__ = copyArray(this.__views__);
1811        return result;
1812      }
1813  
1814      /**
1815       * Reverses the direction of lazy iteration.
1816       *
1817       * @private
1818       * @name reverse
1819       * @memberOf LazyWrapper
1820       * @returns {Object} Returns the new reversed `LazyWrapper` object.
1821       */
1822      function lazyReverse() {
1823        if (this.__filtered__) {
1824          var result = new LazyWrapper(this);
1825          result.__dir__ = -1;
1826          result.__filtered__ = true;
1827        } else {
1828          result = this.clone();
1829          result.__dir__ *= -1;
1830        }
1831        return result;
1832      }
1833  
1834      /**
1835       * Extracts the unwrapped value from its lazy wrapper.
1836       *
1837       * @private
1838       * @name value
1839       * @memberOf LazyWrapper
1840       * @returns {*} Returns the unwrapped value.
1841       */
1842      function lazyValue() {
1843        var array = this.__wrapped__.value(),
1844            dir = this.__dir__,
1845            isArr = isArray(array),
1846            isRight = dir < 0,
1847            arrLength = isArr ? array.length : 0,
1848            view = getView(0, arrLength, this.__views__),
1849            start = view.start,
1850            end = view.end,
1851            length = end - start,
1852            index = isRight ? end : (start - 1),
1853            iteratees = this.__iteratees__,
1854            iterLength = iteratees.length,
1855            resIndex = 0,
1856            takeCount = nativeMin(length, this.__takeCount__);
1857  
1858        if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
1859          return baseWrapperValue(array, this.__actions__);
1860        }
1861        var result = [];
1862  
1863        outer:
1864        while (length-- && resIndex < takeCount) {
1865          index += dir;
1866  
1867          var iterIndex = -1,
1868              value = array[index];
1869  
1870          while (++iterIndex < iterLength) {
1871            var data = iteratees[iterIndex],
1872                iteratee = data.iteratee,
1873                type = data.type,
1874                computed = iteratee(value);
1875  
1876            if (type == LAZY_MAP_FLAG) {
1877              value = computed;
1878            } else if (!computed) {
1879              if (type == LAZY_FILTER_FLAG) {
1880                continue outer;
1881              } else {
1882                break outer;
1883              }
1884            }
1885          }
1886          result[resIndex++] = value;
1887        }
1888        return result;
1889      }
1890  
1891      // Ensure `LazyWrapper` is an instance of `baseLodash`.
1892      LazyWrapper.prototype = baseCreate(baseLodash.prototype);
1893      LazyWrapper.prototype.constructor = LazyWrapper;
1894  
1895      /*------------------------------------------------------------------------*/
1896  
1897      /**
1898       * Creates a hash object.
1899       *
1900       * @private
1901       * @constructor
1902       * @param {Array} [entries] The key-value pairs to cache.
1903       */
1904      function Hash(entries) {
1905        var index = -1,
1906            length = entries == null ? 0 : entries.length;
1907  
1908        this.clear();
1909        while (++index < length) {
1910          var entry = entries[index];
1911          this.set(entry[0], entry[1]);
1912        }
1913      }
1914  
1915      /**
1916       * Removes all key-value entries from the hash.
1917       *
1918       * @private
1919       * @name clear
1920       * @memberOf Hash
1921       */
1922      function hashClear() {
1923        this.__data__ = nativeCreate ? nativeCreate(null) : {};
1924        this.size = 0;
1925      }
1926  
1927      /**
1928       * Removes `key` and its value from the hash.
1929       *
1930       * @private
1931       * @name delete
1932       * @memberOf Hash
1933       * @param {Object} hash The hash to modify.
1934       * @param {string} key The key of the value to remove.
1935       * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1936       */
1937      function hashDelete(key) {
1938        var result = this.has(key) && delete this.__data__[key];
1939        this.size -= result ? 1 : 0;
1940        return result;
1941      }
1942  
1943      /**
1944       * Gets the hash value for `key`.
1945       *
1946       * @private
1947       * @name get
1948       * @memberOf Hash
1949       * @param {string} key The key of the value to get.
1950       * @returns {*} Returns the entry value.
1951       */
1952      function hashGet(key) {
1953        var data = this.__data__;
1954        if (nativeCreate) {
1955          var result = data[key];
1956          return result === HASH_UNDEFINED ? undefined : result;
1957        }
1958        return hasOwnProperty.call(data, key) ? data[key] : undefined;
1959      }
1960  
1961      /**
1962       * Checks if a hash value for `key` exists.
1963       *
1964       * @private
1965       * @name has
1966       * @memberOf Hash
1967       * @param {string} key The key of the entry to check.
1968       * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1969       */
1970      function hashHas(key) {
1971        var data = this.__data__;
1972        return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
1973      }
1974  
1975      /**
1976       * Sets the hash `key` to `value`.
1977       *
1978       * @private
1979       * @name set
1980       * @memberOf Hash
1981       * @param {string} key The key of the value to set.
1982       * @param {*} value The value to set.
1983       * @returns {Object} Returns the hash instance.
1984       */
1985      function hashSet(key, value) {
1986        var data = this.__data__;
1987        this.size += this.has(key) ? 0 : 1;
1988        data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
1989        return this;
1990      }
1991  
1992      // Add methods to `Hash`.
1993      Hash.prototype.clear = hashClear;
1994      Hash.prototype['delete'] = hashDelete;
1995      Hash.prototype.get = hashGet;
1996      Hash.prototype.has = hashHas;
1997      Hash.prototype.set = hashSet;
1998  
1999      /*------------------------------------------------------------------------*/
2000  
2001      /**
2002       * Creates an list cache object.
2003       *
2004       * @private
2005       * @constructor
2006       * @param {Array} [entries] The key-value pairs to cache.
2007       */
2008      function ListCache(entries) {
2009        var index = -1,
2010            length = entries == null ? 0 : entries.length;
2011  
2012        this.clear();
2013        while (++index < length) {
2014          var entry = entries[index];
2015          this.set(entry[0], entry[1]);
2016        }
2017      }
2018  
2019      /**
2020       * Removes all key-value entries from the list cache.
2021       *
2022       * @private
2023       * @name clear
2024       * @memberOf ListCache
2025       */
2026      function listCacheClear() {
2027        this.__data__ = [];
2028        this.size = 0;
2029      }
2030  
2031      /**
2032       * Removes `key` and its value from the list cache.
2033       *
2034       * @private
2035       * @name delete
2036       * @memberOf ListCache
2037       * @param {string} key The key of the value to remove.
2038       * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2039       */
2040      function listCacheDelete(key) {
2041        var data = this.__data__,
2042            index = assocIndexOf(data, key);
2043  
2044        if (index < 0) {
2045          return false;
2046        }
2047        var lastIndex = data.length - 1;
2048        if (index == lastIndex) {
2049          data.pop();
2050        } else {
2051          splice.call(data, index, 1);
2052        }
2053        --this.size;
2054        return true;
2055      }
2056  
2057      /**
2058       * Gets the list cache value for `key`.
2059       *
2060       * @private
2061       * @name get
2062       * @memberOf ListCache
2063       * @param {string} key The key of the value to get.
2064       * @returns {*} Returns the entry value.
2065       */
2066      function listCacheGet(key) {
2067        var data = this.__data__,
2068            index = assocIndexOf(data, key);
2069  
2070        return index < 0 ? undefined : data[index][1];
2071      }
2072  
2073      /**
2074       * Checks if a list cache value for `key` exists.
2075       *
2076       * @private
2077       * @name has
2078       * @memberOf ListCache
2079       * @param {string} key The key of the entry to check.
2080       * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2081       */
2082      function listCacheHas(key) {
2083        return assocIndexOf(this.__data__, key) > -1;
2084      }
2085  
2086      /**
2087       * Sets the list cache `key` to `value`.
2088       *
2089       * @private
2090       * @name set
2091       * @memberOf ListCache
2092       * @param {string} key The key of the value to set.
2093       * @param {*} value The value to set.
2094       * @returns {Object} Returns the list cache instance.
2095       */
2096      function listCacheSet(key, value) {
2097        var data = this.__data__,
2098            index = assocIndexOf(data, key);
2099  
2100        if (index < 0) {
2101          ++this.size;
2102          data.push([key, value]);
2103        } else {
2104          data[index][1] = value;
2105        }
2106        return this;
2107      }
2108  
2109      // Add methods to `ListCache`.
2110      ListCache.prototype.clear = listCacheClear;
2111      ListCache.prototype['delete'] = listCacheDelete;
2112      ListCache.prototype.get = listCacheGet;
2113      ListCache.prototype.has = listCacheHas;
2114      ListCache.prototype.set = listCacheSet;
2115  
2116      /*------------------------------------------------------------------------*/
2117  
2118      /**
2119       * Creates a map cache object to store key-value pairs.
2120       *
2121       * @private
2122       * @constructor
2123       * @param {Array} [entries] The key-value pairs to cache.
2124       */
2125      function MapCache(entries) {
2126        var index = -1,
2127            length = entries == null ? 0 : entries.length;
2128  
2129        this.clear();
2130        while (++index < length) {
2131          var entry = entries[index];
2132          this.set(entry[0], entry[1]);
2133        }
2134      }
2135  
2136      /**
2137       * Removes all key-value entries from the map.
2138       *
2139       * @private
2140       * @name clear
2141       * @memberOf MapCache
2142       */
2143      function mapCacheClear() {
2144        this.size = 0;
2145        this.__data__ = {
2146          'hash': new Hash,
2147          'map': new (Map || ListCache),
2148          'string': new Hash
2149        };
2150      }
2151  
2152      /**
2153       * Removes `key` and its value from the map.
2154       *
2155       * @private
2156       * @name delete
2157       * @memberOf MapCache
2158       * @param {string} key The key of the value to remove.
2159       * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2160       */
2161      function mapCacheDelete(key) {
2162        var result = getMapData(this, key)['delete'](key);
2163        this.size -= result ? 1 : 0;
2164        return result;
2165      }
2166  
2167      /**
2168       * Gets the map value for `key`.
2169       *
2170       * @private
2171       * @name get
2172       * @memberOf MapCache
2173       * @param {string} key The key of the value to get.
2174       * @returns {*} Returns the entry value.
2175       */
2176      function mapCacheGet(key) {
2177        return getMapData(this, key).get(key);
2178      }
2179  
2180      /**
2181       * Checks if a map value for `key` exists.
2182       *
2183       * @private
2184       * @name has
2185       * @memberOf MapCache
2186       * @param {string} key The key of the entry to check.
2187       * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2188       */
2189      function mapCacheHas(key) {
2190        return getMapData(this, key).has(key);
2191      }
2192  
2193      /**
2194       * Sets the map `key` to `value`.
2195       *
2196       * @private
2197       * @name set
2198       * @memberOf MapCache
2199       * @param {string} key The key of the value to set.
2200       * @param {*} value The value to set.
2201       * @returns {Object} Returns the map cache instance.
2202       */
2203      function mapCacheSet(key, value) {
2204        var data = getMapData(this, key),
2205            size = data.size;
2206  
2207        data.set(key, value);
2208        this.size += data.size == size ? 0 : 1;
2209        return this;
2210      }
2211  
2212      // Add methods to `MapCache`.
2213      MapCache.prototype.clear = mapCacheClear;
2214      MapCache.prototype['delete'] = mapCacheDelete;
2215      MapCache.prototype.get = mapCacheGet;
2216      MapCache.prototype.has = mapCacheHas;
2217      MapCache.prototype.set = mapCacheSet;
2218  
2219      /*------------------------------------------------------------------------*/
2220  
2221      /**
2222       *
2223       * Creates an array cache object to store unique values.
2224       *
2225       * @private
2226       * @constructor
2227       * @param {Array} [values] The values to cache.
2228       */
2229      function SetCache(values) {
2230        var index = -1,
2231            length = values == null ? 0 : values.length;
2232  
2233        this.__data__ = new MapCache;
2234        while (++index < length) {
2235          this.add(values[index]);
2236        }
2237      }
2238  
2239      /**
2240       * Adds `value` to the array cache.
2241       *
2242       * @private
2243       * @name add
2244       * @memberOf SetCache
2245       * @alias push
2246       * @param {*} value The value to cache.
2247       * @returns {Object} Returns the cache instance.
2248       */
2249      function setCacheAdd(value) {
2250        this.__data__.set(value, HASH_UNDEFINED);
2251        return this;
2252      }
2253  
2254      /**
2255       * Checks if `value` is in the array cache.
2256       *
2257       * @private
2258       * @name has
2259       * @memberOf SetCache
2260       * @param {*} value The value to search for.
2261       * @returns {number} Returns `true` if `value` is found, else `false`.
2262       */
2263      function setCacheHas(value) {
2264        return this.__data__.has(value);
2265      }
2266  
2267      // Add methods to `SetCache`.
2268      SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
2269      SetCache.prototype.has = setCacheHas;
2270  
2271      /*------------------------------------------------------------------------*/
2272  
2273      /**
2274       * Creates a stack cache object to store key-value pairs.
2275       *
2276       * @private
2277       * @constructor
2278       * @param {Array} [entries] The key-value pairs to cache.
2279       */
2280      function Stack(entries) {
2281        var data = this.__data__ = new ListCache(entries);
2282        this.size = data.size;
2283      }
2284  
2285      /**
2286       * Removes all key-value entries from the stack.
2287       *
2288       * @private
2289       * @name clear
2290       * @memberOf Stack
2291       */
2292      function stackClear() {
2293        this.__data__ = new ListCache;
2294        this.size = 0;
2295      }
2296  
2297      /**
2298       * Removes `key` and its value from the stack.
2299       *
2300       * @private
2301       * @name delete
2302       * @memberOf Stack
2303       * @param {string} key The key of the value to remove.
2304       * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2305       */
2306      function stackDelete(key) {
2307        var data = this.__data__,
2308            result = data['delete'](key);
2309  
2310        this.size = data.size;
2311        return result;
2312      }
2313  
2314      /**
2315       * Gets the stack value for `key`.
2316       *
2317       * @private
2318       * @name get
2319       * @memberOf Stack
2320       * @param {string} key The key of the value to get.
2321       * @returns {*} Returns the entry value.
2322       */
2323      function stackGet(key) {
2324        return this.__data__.get(key);
2325      }
2326  
2327      /**
2328       * Checks if a stack value for `key` exists.
2329       *
2330       * @private
2331       * @name has
2332       * @memberOf Stack
2333       * @param {string} key The key of the entry to check.
2334       * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2335       */
2336      function stackHas(key) {
2337        return this.__data__.has(key);
2338      }
2339  
2340      /**
2341       * Sets the stack `key` to `value`.
2342       *
2343       * @private
2344       * @name set
2345       * @memberOf Stack
2346       * @param {string} key The key of the value to set.
2347       * @param {*} value The value to set.
2348       * @returns {Object} Returns the stack cache instance.
2349       */
2350      function stackSet(key, value) {
2351        var data = this.__data__;
2352        if (data instanceof ListCache) {
2353          var pairs = data.__data__;
2354          if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2355            pairs.push([key, value]);
2356            this.size = ++data.size;
2357            return this;
2358          }
2359          data = this.__data__ = new MapCache(pairs);
2360        }
2361        data.set(key, value);
2362        this.size = data.size;
2363        return this;
2364      }
2365  
2366      // Add methods to `Stack`.
2367      Stack.prototype.clear = stackClear;
2368      Stack.prototype['delete'] = stackDelete;
2369      Stack.prototype.get = stackGet;
2370      Stack.prototype.has = stackHas;
2371      Stack.prototype.set = stackSet;
2372  
2373      /*------------------------------------------------------------------------*/
2374  
2375      /**
2376       * Creates an array of the enumerable property names of the array-like `value`.
2377       *
2378       * @private
2379       * @param {*} value The value to query.
2380       * @param {boolean} inherited Specify returning inherited property names.
2381       * @returns {Array} Returns the array of property names.
2382       */
2383      function arrayLikeKeys(value, inherited) {
2384        var isArr = isArray(value),
2385            isArg = !isArr && isArguments(value),
2386            isBuff = !isArr && !isArg && isBuffer(value),
2387            isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2388            skipIndexes = isArr || isArg || isBuff || isType,
2389            result = skipIndexes ? baseTimes(value.length, String) : [],
2390            length = result.length;
2391  
2392        for (var key in value) {
2393          if ((inherited || hasOwnProperty.call(value, key)) &&
2394              !(skipIndexes && (
2395                 // Safari 9 has enumerable `arguments.length` in strict mode.
2396                 key == 'length' ||
2397                 // Node.js 0.10 has enumerable non-index properties on buffers.
2398                 (isBuff && (key == 'offset' || key == 'parent')) ||
2399                 // PhantomJS 2 has enumerable non-index properties on typed arrays.
2400                 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2401                 // Skip index properties.
2402                 isIndex(key, length)
2403              ))) {
2404            result.push(key);
2405          }
2406        }
2407        return result;
2408      }
2409  
2410      /**
2411       * A specialized version of `_.sample` for arrays.
2412       *
2413       * @private
2414       * @param {Array} array The array to sample.
2415       * @returns {*} Returns the random element.
2416       */
2417      function arraySample(array) {
2418        var length = array.length;
2419        return length ? array[baseRandom(0, length - 1)] : undefined;
2420      }
2421  
2422      /**
2423       * A specialized version of `_.sampleSize` for arrays.
2424       *
2425       * @private
2426       * @param {Array} array The array to sample.
2427       * @param {number} n The number of elements to sample.
2428       * @returns {Array} Returns the random elements.
2429       */
2430      function arraySampleSize(array, n) {
2431        return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
2432      }
2433  
2434      /**
2435       * A specialized version of `_.shuffle` for arrays.
2436       *
2437       * @private
2438       * @param {Array} array The array to shuffle.
2439       * @returns {Array} Returns the new shuffled array.
2440       */
2441      function arrayShuffle(array) {
2442        return shuffleSelf(copyArray(array));
2443      }
2444  
2445      /**
2446       * This function is like `assignValue` except that it doesn't assign
2447       * `undefined` values.
2448       *
2449       * @private
2450       * @param {Object} object The object to modify.
2451       * @param {string} key The key of the property to assign.
2452       * @param {*} value The value to assign.
2453       */
2454      function assignMergeValue(object, key, value) {
2455        if ((value !== undefined && !eq(object[key], value)) ||
2456            (value === undefined && !(key in object))) {
2457          baseAssignValue(object, key, value);
2458        }
2459      }
2460  
2461      /**
2462       * Assigns `value` to `key` of `object` if the existing value is not equivalent
2463       * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2464       * for equality comparisons.
2465       *
2466       * @private
2467       * @param {Object} object The object to modify.
2468       * @param {string} key The key of the property to assign.
2469       * @param {*} value The value to assign.
2470       */
2471      function assignValue(object, key, value) {
2472        var objValue = object[key];
2473        if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
2474            (value === undefined && !(key in object))) {
2475          baseAssignValue(object, key, value);
2476        }
2477      }
2478  
2479      /**
2480       * Gets the index at which the `key` is found in `array` of key-value pairs.
2481       *
2482       * @private
2483       * @param {Array} array The array to inspect.
2484       * @param {*} key The key to search for.
2485       * @returns {number} Returns the index of the matched value, else `-1`.
2486       */
2487      function assocIndexOf(array, key) {
2488        var length = array.length;
2489        while (length--) {
2490          if (eq(array[length][0], key)) {
2491            return length;
2492          }
2493        }
2494        return -1;
2495      }
2496  
2497      /**
2498       * Aggregates elements of `collection` on `accumulator` with keys transformed
2499       * by `iteratee` and values set by `setter`.
2500       *
2501       * @private
2502       * @param {Array|Object} collection The collection to iterate over.
2503       * @param {Function} setter The function to set `accumulator` values.
2504       * @param {Function} iteratee The iteratee to transform keys.
2505       * @param {Object} accumulator The initial aggregated object.
2506       * @returns {Function} Returns `accumulator`.
2507       */
2508      function baseAggregator(collection, setter, iteratee, accumulator) {
2509        baseEach(collection, function(value, key, collection) {
2510          setter(accumulator, value, iteratee(value), collection);
2511        });
2512        return accumulator;
2513      }
2514  
2515      /**
2516       * The base implementation of `_.assign` without support for multiple sources
2517       * or `customizer` functions.
2518       *
2519       * @private
2520       * @param {Object} object The destination object.
2521       * @param {Object} source The source object.
2522       * @returns {Object} Returns `object`.
2523       */
2524      function baseAssign(object, source) {
2525        return object && copyObject(source, keys(source), object);
2526      }
2527  
2528      /**
2529       * The base implementation of `_.assignIn` without support for multiple sources
2530       * or `customizer` functions.
2531       *
2532       * @private
2533       * @param {Object} object The destination object.
2534       * @param {Object} source The source object.
2535       * @returns {Object} Returns `object`.
2536       */
2537      function baseAssignIn(object, source) {
2538        return object && copyObject(source, keysIn(source), object);
2539      }
2540  
2541      /**
2542       * The base implementation of `assignValue` and `assignMergeValue` without
2543       * value checks.
2544       *
2545       * @private
2546       * @param {Object} object The object to modify.
2547       * @param {string} key The key of the property to assign.
2548       * @param {*} value The value to assign.
2549       */
2550      function baseAssignValue(object, key, value) {
2551        if (key == '__proto__' && defineProperty) {
2552          defineProperty(object, key, {
2553            'configurable': true,
2554            'enumerable': true,
2555            'value': value,
2556            'writable': true
2557          });
2558        } else {
2559          object[key] = value;
2560        }
2561      }
2562  
2563      /**
2564       * The base implementation of `_.at` without support for individual paths.
2565       *
2566       * @private
2567       * @param {Object} object The object to iterate over.
2568       * @param {string[]} paths The property paths to pick.
2569       * @returns {Array} Returns the picked elements.
2570       */
2571      function baseAt(object, paths) {
2572        var index = -1,
2573            length = paths.length,
2574            result = Array(length),
2575            skip = object == null;
2576  
2577        while (++index < length) {
2578          result[index] = skip ? undefined : get(object, paths[index]);
2579        }
2580        return result;
2581      }
2582  
2583      /**
2584       * The base implementation of `_.clamp` which doesn't coerce arguments.
2585       *
2586       * @private
2587       * @param {number} number The number to clamp.
2588       * @param {number} [lower] The lower bound.
2589       * @param {number} upper The upper bound.
2590       * @returns {number} Returns the clamped number.
2591       */
2592      function baseClamp(number, lower, upper) {
2593        if (number === number) {
2594          if (upper !== undefined) {
2595            number = number <= upper ? number : upper;
2596          }
2597          if (lower !== undefined) {
2598            number = number >= lower ? number : lower;
2599          }
2600        }
2601        return number;
2602      }
2603  
2604      /**
2605       * The base implementation of `_.clone` and `_.cloneDeep` which tracks
2606       * traversed objects.
2607       *
2608       * @private
2609       * @param {*} value The value to clone.
2610       * @param {boolean} bitmask The bitmask flags.
2611       *  1 - Deep clone
2612       *  2 - Flatten inherited properties
2613       *  4 - Clone symbols
2614       * @param {Function} [customizer] The function to customize cloning.
2615       * @param {string} [key] The key of `value`.
2616       * @param {Object} [object] The parent object of `value`.
2617       * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
2618       * @returns {*} Returns the cloned value.
2619       */
2620      function baseClone(value, bitmask, customizer, key, object, stack) {
2621        var result,
2622            isDeep = bitmask & CLONE_DEEP_FLAG,
2623            isFlat = bitmask & CLONE_FLAT_FLAG,
2624            isFull = bitmask & CLONE_SYMBOLS_FLAG;
2625  
2626        if (customizer) {
2627          result = object ? customizer(value, key, object, stack) : customizer(value);
2628        }
2629        if (result !== undefined) {
2630          return result;
2631        }
2632        if (!isObject(value)) {
2633          return value;
2634        }
2635        var isArr = isArray(value);
2636        if (isArr) {
2637          result = initCloneArray(value);
2638          if (!isDeep) {
2639            return copyArray(value, result);
2640          }
2641        } else {
2642          var tag = getTag(value),
2643              isFunc = tag == funcTag || tag == genTag;
2644  
2645          if (isBuffer(value)) {
2646            return cloneBuffer(value, isDeep);
2647          }
2648          if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
2649            result = (isFlat || isFunc) ? {} : initCloneObject(value);
2650            if (!isDeep) {
2651              return isFlat
2652                ? copySymbolsIn(value, baseAssignIn(result, value))
2653                : copySymbols(value, baseAssign(result, value));
2654            }
2655          } else {
2656            if (!cloneableTags[tag]) {
2657              return object ? value : {};
2658            }
2659            result = initCloneByTag(value, tag, isDeep);
2660          }
2661        }
2662        // Check for circular references and return its corresponding clone.
2663        stack || (stack = new Stack);
2664        var stacked = stack.get(value);
2665        if (stacked) {
2666          return stacked;
2667        }
2668        stack.set(value, result);
2669  
2670        if (isSet(value)) {
2671          value.forEach(function(subValue) {
2672            result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
2673          });
2674  
2675          return result;
2676        }
2677  
2678        if (isMap(value)) {
2679          value.forEach(function(subValue, key) {
2680            result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
2681          });
2682  
2683          return result;
2684        }
2685  
2686        var keysFunc = isFull
2687          ? (isFlat ? getAllKeysIn : getAllKeys)
2688          : (isFlat ? keysIn : keys);
2689  
2690        var props = isArr ? undefined : keysFunc(value);
2691        arrayEach(props || value, function(subValue, key) {
2692          if (props) {
2693            key = subValue;
2694            subValue = value[key];
2695          }
2696          // Recursively populate clone (susceptible to call stack limits).
2697          assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
2698        });
2699        return result;
2700      }
2701  
2702      /**
2703       * The base implementation of `_.conforms` which doesn't clone `source`.
2704       *
2705       * @private
2706       * @param {Object} source The object of property predicates to conform to.
2707       * @returns {Function} Returns the new spec function.
2708       */
2709      function baseConforms(source) {
2710        var props = keys(source);
2711        return function(object) {
2712          return baseConformsTo(object, source, props);
2713        };
2714      }
2715  
2716      /**
2717       * The base implementation of `_.conformsTo` which accepts `props` to check.
2718       *
2719       * @private
2720       * @param {Object} object The object to inspect.
2721       * @param {Object} source The object of property predicates to conform to.
2722       * @returns {boolean} Returns `true` if `object` conforms, else `false`.
2723       */
2724      function baseConformsTo(object, source, props) {
2725        var length = props.length;
2726        if (object == null) {
2727          return !length;
2728        }
2729        object = Object(object);
2730        while (length--) {
2731          var key = props[length],
2732              predicate = source[key],
2733              value = object[key];
2734  
2735          if ((value === undefined && !(key in object)) || !predicate(value)) {
2736            return false;
2737          }
2738        }
2739        return true;
2740      }
2741  
2742      /**
2743       * The base implementation of `_.delay` and `_.defer` which accepts `args`
2744       * to provide to `func`.
2745       *
2746       * @private
2747       * @param {Function} func The function to delay.
2748       * @param {number} wait The number of milliseconds to delay invocation.
2749       * @param {Array} args The arguments to provide to `func`.
2750       * @returns {number|Object} Returns the timer id or timeout object.
2751       */
2752      function baseDelay(func, wait, args) {
2753        if (typeof func != 'function') {
2754          throw new TypeError(FUNC_ERROR_TEXT);
2755        }
2756        return setTimeout(function() { func.apply(undefined, args); }, wait);
2757      }
2758  
2759      /**
2760       * The base implementation of methods like `_.difference` without support
2761       * for excluding multiple arrays or iteratee shorthands.
2762       *
2763       * @private
2764       * @param {Array} array The array to inspect.
2765       * @param {Array} values The values to exclude.
2766       * @param {Function} [iteratee] The iteratee invoked per element.
2767       * @param {Function} [comparator] The comparator invoked per element.
2768       * @returns {Array} Returns the new array of filtered values.
2769       */
2770      function baseDifference(array, values, iteratee, comparator) {
2771        var index = -1,
2772            includes = arrayIncludes,
2773            isCommon = true,
2774            length = array.length,
2775            result = [],
2776            valuesLength = values.length;
2777  
2778        if (!length) {
2779          return result;
2780        }
2781        if (iteratee) {
2782          values = arrayMap(values, baseUnary(iteratee));
2783        }
2784        if (comparator) {
2785          includes = arrayIncludesWith;
2786          isCommon = false;
2787        }
2788        else if (values.length >= LARGE_ARRAY_SIZE) {
2789          includes = cacheHas;
2790          isCommon = false;
2791          values = new SetCache(values);
2792        }
2793        outer:
2794        while (++index < length) {
2795          var value = array[index],
2796              computed = iteratee == null ? value : iteratee(value);
2797  
2798          value = (comparator || value !== 0) ? value : 0;
2799          if (isCommon && computed === computed) {
2800            var valuesIndex = valuesLength;
2801            while (valuesIndex--) {
2802              if (values[valuesIndex] === computed) {
2803                continue outer;
2804              }
2805            }
2806            result.push(value);
2807          }
2808          else if (!includes(values, computed, comparator)) {
2809            result.push(value);
2810          }
2811        }
2812        return result;
2813      }
2814  
2815      /**
2816       * The base implementation of `_.forEach` without support for iteratee shorthands.
2817       *
2818       * @private
2819       * @param {Array|Object} collection The collection to iterate over.
2820       * @param {Function} iteratee The function invoked per iteration.
2821       * @returns {Array|Object} Returns `collection`.
2822       */
2823      var baseEach = createBaseEach(baseForOwn);
2824  
2825      /**
2826       * The base implementation of `_.forEachRight` without support for iteratee shorthands.
2827       *
2828       * @private
2829       * @param {Array|Object} collection The collection to iterate over.
2830       * @param {Function} iteratee The function invoked per iteration.
2831       * @returns {Array|Object} Returns `collection`.
2832       */
2833      var baseEachRight = createBaseEach(baseForOwnRight, true);
2834  
2835      /**
2836       * The base implementation of `_.every` without support for iteratee shorthands.
2837       *
2838       * @private
2839       * @param {Array|Object} collection The collection to iterate over.
2840       * @param {Function} predicate The function invoked per iteration.
2841       * @returns {boolean} Returns `true` if all elements pass the predicate check,
2842       *  else `false`
2843       */
2844      function baseEvery(collection, predicate) {
2845        var result = true;
2846        baseEach(collection, function(value, index, collection) {
2847          result = !!predicate(value, index, collection);
2848          return result;
2849        });
2850        return result;
2851      }
2852  
2853      /**
2854       * The base implementation of methods like `_.max` and `_.min` which accepts a
2855       * `comparator` to determine the extremum value.
2856       *
2857       * @private
2858       * @param {Array} array The array to iterate over.
2859       * @param {Function} iteratee The iteratee invoked per iteration.
2860       * @param {Function} comparator The comparator used to compare values.
2861       * @returns {*} Returns the extremum value.
2862       */
2863      function baseExtremum(array, iteratee, comparator) {
2864        var index = -1,
2865            length = array.length;
2866  
2867        while (++index < length) {
2868          var value = array[index],
2869              current = iteratee(value);
2870  
2871          if (current != null && (computed === undefined
2872                ? (current === current && !isSymbol(current))
2873                : comparator(current, computed)
2874              )) {
2875            var computed = current,
2876                result = value;
2877          }
2878        }
2879        return result;
2880      }
2881  
2882      /**
2883       * The base implementation of `_.fill` without an iteratee call guard.
2884       *
2885       * @private
2886       * @param {Array} array The array to fill.
2887       * @param {*} value The value to fill `array` with.
2888       * @param {number} [start=0] The start position.
2889       * @param {number} [end=array.length] The end position.
2890       * @returns {Array} Returns `array`.
2891       */
2892      function baseFill(array, value, start, end) {
2893        var length = array.length;
2894  
2895        start = toInteger(start);
2896        if (start < 0) {
2897          start = -start > length ? 0 : (length + start);
2898        }
2899        end = (end === undefined || end > length) ? length : toInteger(end);
2900        if (end < 0) {
2901          end += length;
2902        }
2903        end = start > end ? 0 : toLength(end);
2904        while (start < end) {
2905          array[start++] = value;
2906        }
2907        return array;
2908      }
2909  
2910      /**
2911       * The base implementation of `_.filter` without support for iteratee shorthands.
2912       *
2913       * @private
2914       * @param {Array|Object} collection The collection to iterate over.
2915       * @param {Function} predicate The function invoked per iteration.
2916       * @returns {Array} Returns the new filtered array.
2917       */
2918      function baseFilter(collection, predicate) {
2919        var result = [];
2920        baseEach(collection, function(value, index, collection) {
2921          if (predicate(value, index, collection)) {
2922            result.push(value);
2923          }
2924        });
2925        return result;
2926      }
2927  
2928      /**
2929       * The base implementation of `_.flatten` with support for restricting flattening.
2930       *
2931       * @private
2932       * @param {Array} array The array to flatten.
2933       * @param {number} depth The maximum recursion depth.
2934       * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2935       * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2936       * @param {Array} [result=[]] The initial result value.
2937       * @returns {Array} Returns the new flattened array.
2938       */
2939      function baseFlatten(array, depth, predicate, isStrict, result) {
2940        var index = -1,
2941            length = array.length;
2942  
2943        predicate || (predicate = isFlattenable);
2944        result || (result = []);
2945  
2946        while (++index < length) {
2947          var value = array[index];
2948          if (depth > 0 && predicate(value)) {
2949            if (depth > 1) {
2950              // Recursively flatten arrays (susceptible to call stack limits).
2951              baseFlatten(value, depth - 1, predicate, isStrict, result);
2952            } else {
2953              arrayPush(result, value);
2954            }
2955          } else if (!isStrict) {
2956            result[result.length] = value;
2957          }
2958        }
2959        return result;
2960      }
2961  
2962      /**
2963       * The base implementation of `baseForOwn` which iterates over `object`
2964       * properties returned by `keysFunc` and invokes `iteratee` for each property.
2965       * Iteratee functions may exit iteration early by explicitly returning `false`.
2966       *
2967       * @private
2968       * @param {Object} object The object to iterate over.
2969       * @param {Function} iteratee The function invoked per iteration.
2970       * @param {Function} keysFunc The function to get the keys of `object`.
2971       * @returns {Object} Returns `object`.
2972       */
2973      var baseFor = createBaseFor();
2974  
2975      /**
2976       * This function is like `baseFor` except that it iterates over properties
2977       * in the opposite order.
2978       *
2979       * @private
2980       * @param {Object} object The object to iterate over.
2981       * @param {Function} iteratee The function invoked per iteration.
2982       * @param {Function} keysFunc The function to get the keys of `object`.
2983       * @returns {Object} Returns `object`.
2984       */
2985      var baseForRight = createBaseFor(true);
2986  
2987      /**
2988       * The base implementation of `_.forOwn` without support for iteratee shorthands.
2989       *
2990       * @private
2991       * @param {Object} object The object to iterate over.
2992       * @param {Function} iteratee The function invoked per iteration.
2993       * @returns {Object} Returns `object`.
2994       */
2995      function baseForOwn(object, iteratee) {
2996        return object && baseFor(object, iteratee, keys);
2997      }
2998  
2999      /**
3000       * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
3001       *
3002       * @private
3003       * @param {Object} object The object to iterate over.
3004       * @param {Function} iteratee The function invoked per iteration.
3005       * @returns {Object} Returns `object`.
3006       */
3007      function baseForOwnRight(object, iteratee) {
3008        return object && baseForRight(object, iteratee, keys);
3009      }
3010  
3011      /**
3012       * The base implementation of `_.functions` which creates an array of
3013       * `object` function property names filtered from `props`.
3014       *
3015       * @private
3016       * @param {Object} object The object to inspect.
3017       * @param {Array} props The property names to filter.
3018       * @returns {Array} Returns the function names.
3019       */
3020      function baseFunctions(object, props) {
3021        return arrayFilter(props, function(key) {
3022          return isFunction(object[key]);
3023        });
3024      }
3025  
3026      /**
3027       * The base implementation of `_.get` without support for default values.
3028       *
3029       * @private
3030       * @param {Object} object The object to query.
3031       * @param {Array|string} path The path of the property to get.
3032       * @returns {*} Returns the resolved value.
3033       */
3034      function baseGet(object, path) {
3035        path = castPath(path, object);
3036  
3037        var index = 0,
3038            length = path.length;
3039  
3040        while (object != null && index < length) {
3041          object = object[toKey(path[index++])];
3042        }
3043        return (index && index == length) ? object : undefined;
3044      }
3045  
3046      /**
3047       * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
3048       * `keysFunc` and `symbolsFunc` to get the enumerable property names and
3049       * symbols of `object`.
3050       *
3051       * @private
3052       * @param {Object} object The object to query.
3053       * @param {Function} keysFunc The function to get the keys of `object`.
3054       * @param {Function} symbolsFunc The function to get the symbols of `object`.
3055       * @returns {Array} Returns the array of property names and symbols.
3056       */
3057      function baseGetAllKeys(object, keysFunc, symbolsFunc) {
3058        var result = keysFunc(object);
3059        return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
3060      }
3061  
3062      /**
3063       * The base implementation of `getTag` without fallbacks for buggy environments.
3064       *
3065       * @private
3066       * @param {*} value The value to query.
3067       * @returns {string} Returns the `toStringTag`.
3068       */
3069      function baseGetTag(value) {
3070        if (value == null) {
3071          return value === undefined ? undefinedTag : nullTag;
3072        }
3073        return (symToStringTag && symToStringTag in Object(value))
3074          ? getRawTag(value)
3075          : objectToString(value);
3076      }
3077  
3078      /**
3079       * The base implementation of `_.gt` which doesn't coerce arguments.
3080       *
3081       * @private
3082       * @param {*} value The value to compare.
3083       * @param {*} other The other value to compare.
3084       * @returns {boolean} Returns `true` if `value` is greater than `other`,
3085       *  else `false`.
3086       */
3087      function baseGt(value, other) {
3088        return value > other;
3089      }
3090  
3091      /**
3092       * The base implementation of `_.has` without support for deep paths.
3093       *
3094       * @private
3095       * @param {Object} [object] The object to query.
3096       * @param {Array|string} key The key to check.
3097       * @returns {boolean} Returns `true` if `key` exists, else `false`.
3098       */
3099      function baseHas(object, key) {
3100        return object != null && hasOwnProperty.call(object, key);
3101      }
3102  
3103      /**
3104       * The base implementation of `_.hasIn` without support for deep paths.
3105       *
3106       * @private
3107       * @param {Object} [object] The object to query.
3108       * @param {Array|string} key The key to check.
3109       * @returns {boolean} Returns `true` if `key` exists, else `false`.
3110       */
3111      function baseHasIn(object, key) {
3112        return object != null && key in Object(object);
3113      }
3114  
3115      /**
3116       * The base implementation of `_.inRange` which doesn't coerce arguments.
3117       *
3118       * @private
3119       * @param {number} number The number to check.
3120       * @param {number} start The start of the range.
3121       * @param {number} end The end of the range.
3122       * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
3123       */
3124      function baseInRange(number, start, end) {
3125        return number >= nativeMin(start, end) && number < nativeMax(start, end);
3126      }
3127  
3128      /**
3129       * The base implementation of methods like `_.intersection`, without support
3130       * for iteratee shorthands, that accepts an array of arrays to inspect.
3131       *
3132       * @private
3133       * @param {Array} arrays The arrays to inspect.
3134       * @param {Function} [iteratee] The iteratee invoked per element.
3135       * @param {Function} [comparator] The comparator invoked per element.
3136       * @returns {Array} Returns the new array of shared values.
3137       */
3138      function baseIntersection(arrays, iteratee, comparator) {
3139        var includes = comparator ? arrayIncludesWith : arrayIncludes,
3140            length = arrays[0].length,
3141            othLength = arrays.length,
3142            othIndex = othLength,
3143            caches = Array(othLength),
3144            maxLength = Infinity,
3145            result = [];
3146  
3147        while (othIndex--) {
3148          var array = arrays[othIndex];
3149          if (othIndex && iteratee) {
3150            array = arrayMap(array, baseUnary(iteratee));
3151          }
3152          maxLength = nativeMin(array.length, maxLength);
3153          caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
3154            ? new SetCache(othIndex && array)
3155            : undefined;
3156        }
3157        array = arrays[0];
3158  
3159        var index = -1,
3160            seen = caches[0];
3161  
3162        outer:
3163        while (++index < length && result.length < maxLength) {
3164          var value = array[index],
3165              computed = iteratee ? iteratee(value) : value;
3166  
3167          value = (comparator || value !== 0) ? value : 0;
3168          if (!(seen
3169                ? cacheHas(seen, computed)
3170                : includes(result, computed, comparator)
3171              )) {
3172            othIndex = othLength;
3173            while (--othIndex) {
3174              var cache = caches[othIndex];
3175              if (!(cache
3176                    ? cacheHas(cache, computed)
3177                    : includes(arrays[othIndex], computed, comparator))
3178                  ) {
3179                continue outer;
3180              }
3181            }
3182            if (seen) {
3183              seen.push(computed);
3184            }
3185            result.push(value);
3186          }
3187        }
3188        return result;
3189      }
3190  
3191      /**
3192       * The base implementation of `_.invert` and `_.invertBy` which inverts
3193       * `object` with values transformed by `iteratee` and set by `setter`.
3194       *
3195       * @private
3196       * @param {Object} object The object to iterate over.
3197       * @param {Function} setter The function to set `accumulator` values.
3198       * @param {Function} iteratee The iteratee to transform values.
3199       * @param {Object} accumulator The initial inverted object.
3200       * @returns {Function} Returns `accumulator`.
3201       */
3202      function baseInverter(object, setter, iteratee, accumulator) {
3203        baseForOwn(object, function(value, key, object) {
3204          setter(accumulator, iteratee(value), key, object);
3205        });
3206        return accumulator;
3207      }
3208  
3209      /**
3210       * The base implementation of `_.invoke` without support for individual
3211       * method arguments.
3212       *
3213       * @private
3214       * @param {Object} object The object to query.
3215       * @param {Array|string} path The path of the method to invoke.
3216       * @param {Array} args The arguments to invoke the method with.
3217       * @returns {*} Returns the result of the invoked method.
3218       */
3219      function baseInvoke(object, path, args) {
3220        path = castPath(path, object);
3221        object = parent(object, path);
3222        var func = object == null ? object : object[toKey(last(path))];
3223        return func == null ? undefined : apply(func, object, args);
3224      }
3225  
3226      /**
3227       * The base implementation of `_.isArguments`.
3228       *
3229       * @private
3230       * @param {*} value The value to check.
3231       * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3232       */
3233      function baseIsArguments(value) {
3234        return isObjectLike(value) && baseGetTag(value) == argsTag;
3235      }
3236  
3237      /**
3238       * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
3239       *
3240       * @private
3241       * @param {*} value The value to check.
3242       * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
3243       */
3244      function baseIsArrayBuffer(value) {
3245        return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
3246      }
3247  
3248      /**
3249       * The base implementation of `_.isDate` without Node.js optimizations.
3250       *
3251       * @private
3252       * @param {*} value The value to check.
3253       * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
3254       */
3255      function baseIsDate(value) {
3256        return isObjectLike(value) && baseGetTag(value) == dateTag;
3257      }
3258  
3259      /**
3260       * The base implementation of `_.isEqual` which supports partial comparisons
3261       * and tracks traversed objects.
3262       *
3263       * @private
3264       * @param {*} value The value to compare.
3265       * @param {*} other The other value to compare.
3266       * @param {boolean} bitmask The bitmask flags.
3267       *  1 - Unordered comparison
3268       *  2 - Partial comparison
3269       * @param {Function} [customizer] The function to customize comparisons.
3270       * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3271       * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3272       */
3273      function baseIsEqual(value, other, bitmask, customizer, stack) {
3274        if (value === other) {
3275          return true;
3276        }
3277        if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
3278          return value !== value && other !== other;
3279        }
3280        return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
3281      }
3282  
3283      /**
3284       * A specialized version of `baseIsEqual` for arrays and objects which performs
3285       * deep comparisons and tracks traversed objects enabling objects with circular
3286       * references to be compared.
3287       *
3288       * @private
3289       * @param {Object} object The object to compare.
3290       * @param {Object} other The other object to compare.
3291       * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3292       * @param {Function} customizer The function to customize comparisons.
3293       * @param {Function} equalFunc The function to determine equivalents of values.
3294       * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3295       * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3296       */
3297      function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3298        var objIsArr = isArray(object),
3299            othIsArr = isArray(other),
3300            objTag = objIsArr ? arrayTag : getTag(object),
3301            othTag = othIsArr ? arrayTag : getTag(other);
3302  
3303        objTag = objTag == argsTag ? objectTag : objTag;
3304        othTag = othTag == argsTag ? objectTag : othTag;
3305  
3306        var objIsObj = objTag == objectTag,
3307            othIsObj = othTag == objectTag,
3308            isSameTag = objTag == othTag;
3309  
3310        if (isSameTag && isBuffer(object)) {
3311          if (!isBuffer(other)) {
3312            return false;
3313          }
3314          objIsArr = true;
3315          objIsObj = false;
3316        }
3317        if (isSameTag && !objIsObj) {
3318          stack || (stack = new Stack);
3319          return (objIsArr || isTypedArray(object))
3320            ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3321            : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3322        }
3323        if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
3324          var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
3325              othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3326  
3327          if (objIsWrapped || othIsWrapped) {
3328            var objUnwrapped = objIsWrapped ? object.value() : object,
3329                othUnwrapped = othIsWrapped ? other.value() : other;
3330  
3331            stack || (stack = new Stack);
3332            return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3333          }
3334        }
3335        if (!isSameTag) {
3336          return false;
3337        }
3338        stack || (stack = new Stack);
3339        return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3340      }
3341  
3342      /**
3343       * The base implementation of `_.isMap` without Node.js optimizations.
3344       *
3345       * @private
3346       * @param {*} value The value to check.
3347       * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3348       */
3349      function baseIsMap(value) {
3350        return isObjectLike(value) && getTag(value) == mapTag;
3351      }
3352  
3353      /**
3354       * The base implementation of `_.isMatch` without support for iteratee shorthands.
3355       *
3356       * @private
3357       * @param {Object} object The object to inspect.
3358       * @param {Object} source The object of property values to match.
3359       * @param {Array} matchData The property names, values, and compare flags to match.
3360       * @param {Function} [customizer] The function to customize comparisons.
3361       * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3362       */
3363      function baseIsMatch(object, source, matchData, customizer) {
3364        var index = matchData.length,
3365            length = index,
3366            noCustomizer = !customizer;
3367  
3368        if (object == null) {
3369          return !length;
3370        }
3371        object = Object(object);
3372        while (index--) {
3373          var data = matchData[index];
3374          if ((noCustomizer && data[2])
3375                ? data[1] !== object[data[0]]
3376                : !(data[0] in object)
3377              ) {
3378            return false;
3379          }
3380        }
3381        while (++index < length) {
3382          data = matchData[index];
3383          var key = data[0],
3384              objValue = object[key],
3385              srcValue = data[1];
3386  
3387          if (noCustomizer && data[2]) {
3388            if (objValue === undefined && !(key in object)) {
3389              return false;
3390            }
3391          } else {
3392            var stack = new Stack;
3393            if (customizer) {
3394              var result = customizer(objValue, srcValue, key, object, source, stack);
3395            }
3396            if (!(result === undefined
3397                  ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
3398                  : result
3399                )) {
3400              return false;
3401            }
3402          }
3403        }
3404        return true;
3405      }
3406  
3407      /**
3408       * The base implementation of `_.isNative` without bad shim checks.
3409       *
3410       * @private
3411       * @param {*} value The value to check.
3412       * @returns {boolean} Returns `true` if `value` is a native function,
3413       *  else `false`.
3414       */
3415      function baseIsNative(value) {
3416        if (!isObject(value) || isMasked(value)) {
3417          return false;
3418        }
3419        var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
3420        return pattern.test(toSource(value));
3421      }
3422  
3423      /**
3424       * The base implementation of `_.isRegExp` without Node.js optimizations.
3425       *
3426       * @private
3427       * @param {*} value The value to check.
3428       * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
3429       */
3430      function baseIsRegExp(value) {
3431        return isObjectLike(value) && baseGetTag(value) == regexpTag;
3432      }
3433  
3434      /**
3435       * The base implementation of `_.isSet` without Node.js optimizations.
3436       *
3437       * @private
3438       * @param {*} value The value to check.
3439       * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3440       */
3441      function baseIsSet(value) {
3442        return isObjectLike(value) && getTag(value) == setTag;
3443      }
3444  
3445      /**
3446       * The base implementation of `_.isTypedArray` without Node.js optimizations.
3447       *
3448       * @private
3449       * @param {*} value The value to check.
3450       * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
3451       */
3452      function baseIsTypedArray(value) {
3453        return isObjectLike(value) &&
3454          isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
3455      }
3456  
3457      /**
3458       * The base implementation of `_.iteratee`.
3459       *
3460       * @private
3461       * @param {*} [value=_.identity] The value to convert to an iteratee.
3462       * @returns {Function} Returns the iteratee.
3463       */
3464      function baseIteratee(value) {
3465        // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3466        // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3467        if (typeof value == 'function') {
3468          return value;
3469        }
3470        if (value == null) {
3471          return identity;
3472        }
3473        if (typeof value == 'object') {
3474          return isArray(value)
3475            ? baseMatchesProperty(value[0], value[1])
3476            : baseMatches(value);
3477        }
3478        return property(value);
3479      }
3480  
3481      /**
3482       * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
3483       *
3484       * @private
3485       * @param {Object} object The object to query.
3486       * @returns {Array} Returns the array of property names.
3487       */
3488      function baseKeys(object) {
3489        if (!isPrototype(object)) {
3490          return nativeKeys(object);
3491        }
3492        var result = [];
3493        for (var key in Object(object)) {
3494          if (hasOwnProperty.call(object, key) && key != 'constructor') {
3495            result.push(key);
3496          }
3497        }
3498        return result;
3499      }
3500  
3501      /**
3502       * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
3503       *
3504       * @private
3505       * @param {Object} object The object to query.
3506       * @returns {Array} Returns the array of property names.
3507       */
3508      function baseKeysIn(object) {
3509        if (!isObject(object)) {
3510          return nativeKeysIn(object);
3511        }
3512        var isProto = isPrototype(object),
3513            result = [];
3514  
3515        for (var key in object) {
3516          if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
3517            result.push(key);
3518          }
3519        }
3520        return result;
3521      }
3522  
3523      /**
3524       * The base implementation of `_.lt` which doesn't coerce arguments.
3525       *
3526       * @private
3527       * @param {*} value The value to compare.
3528       * @param {*} other The other value to compare.
3529       * @returns {boolean} Returns `true` if `value` is less than `other`,
3530       *  else `false`.
3531       */
3532      function baseLt(value, other) {
3533        return value < other;
3534      }
3535  
3536      /**
3537       * The base implementation of `_.map` without support for iteratee shorthands.
3538       *
3539       * @private
3540       * @param {Array|Object} collection The collection to iterate over.
3541       * @param {Function} iteratee The function invoked per iteration.
3542       * @returns {Array} Returns the new mapped array.
3543       */
3544      function baseMap(collection, iteratee) {
3545        var index = -1,
3546            result = isArrayLike(collection) ? Array(collection.length) : [];
3547  
3548        baseEach(collection, function(value, key, collection) {
3549          result[++index] = iteratee(value, key, collection);
3550        });
3551        return result;
3552      }
3553  
3554      /**
3555       * The base implementation of `_.matches` which doesn't clone `source`.
3556       *
3557       * @private
3558       * @param {Object} source The object of property values to match.
3559       * @returns {Function} Returns the new spec function.
3560       */
3561      function baseMatches(source) {
3562        var matchData = getMatchData(source);
3563        if (matchData.length == 1 && matchData[0][2]) {
3564          return matchesStrictComparable(matchData[0][0], matchData[0][1]);
3565        }
3566        return function(object) {
3567          return object === source || baseIsMatch(object, source, matchData);
3568        };
3569      }
3570  
3571      /**
3572       * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
3573       *
3574       * @private
3575       * @param {string} path The path of the property to get.
3576       * @param {*} srcValue The value to match.
3577       * @returns {Function} Returns the new spec function.
3578       */
3579      function baseMatchesProperty(path, srcValue) {
3580        if (isKey(path) && isStrictComparable(srcValue)) {
3581          return matchesStrictComparable(toKey(path), srcValue);
3582        }
3583        return function(object) {
3584          var objValue = get(object, path);
3585          return (objValue === undefined && objValue === srcValue)
3586            ? hasIn(object, path)
3587            : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
3588        };
3589      }
3590  
3591      /**
3592       * The base implementation of `_.merge` without support for multiple sources.
3593       *
3594       * @private
3595       * @param {Object} object The destination object.
3596       * @param {Object} source The source object.
3597       * @param {number} srcIndex The index of `source`.
3598       * @param {Function} [customizer] The function to customize merged values.
3599       * @param {Object} [stack] Tracks traversed source values and their merged
3600       *  counterparts.
3601       */
3602      function baseMerge(object, source, srcIndex, customizer, stack) {
3603        if (object === source) {
3604          return;
3605        }
3606        baseFor(source, function(srcValue, key) {
3607          if (isObject(srcValue)) {
3608            stack || (stack = new Stack);
3609            baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3610          }
3611          else {
3612            var newValue = customizer
3613              ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
3614              : undefined;
3615  
3616            if (newValue === undefined) {
3617              newValue = srcValue;
3618            }
3619            assignMergeValue(object, key, newValue);
3620          }
3621        }, keysIn);
3622      }
3623  
3624      /**
3625       * A specialized version of `baseMerge` for arrays and objects which performs
3626       * deep merges and tracks traversed objects enabling objects with circular
3627       * references to be merged.
3628       *
3629       * @private
3630       * @param {Object} object The destination object.
3631       * @param {Object} source The source object.
3632       * @param {string} key The key of the value to merge.
3633       * @param {number} srcIndex The index of `source`.
3634       * @param {Function} mergeFunc The function to merge values.
3635       * @param {Function} [customizer] The function to customize assigned values.
3636       * @param {Object} [stack] Tracks traversed source values and their merged
3637       *  counterparts.
3638       */
3639      function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
3640        var objValue = safeGet(object, key),
3641            srcValue = safeGet(source, key),
3642            stacked = stack.get(srcValue);
3643  
3644        if (stacked) {
3645          assignMergeValue(object, key, stacked);
3646          return;
3647        }
3648        var newValue = customizer
3649          ? customizer(objValue, srcValue, (key + ''), object, source, stack)
3650          : undefined;
3651  
3652        var isCommon = newValue === undefined;
3653  
3654        if (isCommon) {
3655          var isArr = isArray(srcValue),
3656              isBuff = !isArr && isBuffer(srcValue),
3657              isTyped = !isArr && !isBuff && isTypedArray(srcValue);
3658  
3659          newValue = srcValue;
3660          if (isArr || isBuff || isTyped) {
3661            if (isArray(objValue)) {
3662              newValue = objValue;
3663            }
3664            else if (isArrayLikeObject(objValue)) {
3665              newValue = copyArray(objValue);
3666            }
3667            else if (isBuff) {
3668              isCommon = false;
3669              newValue = cloneBuffer(srcValue, true);
3670            }
3671            else if (isTyped) {
3672              isCommon = false;
3673              newValue = cloneTypedArray(srcValue, true);
3674            }
3675            else {
3676              newValue = [];
3677            }
3678          }
3679          else if (isPlainObject(srcValue) || isArguments(srcValue)) {
3680            newValue = objValue;
3681            if (isArguments(objValue)) {
3682              newValue = toPlainObject(objValue);
3683            }
3684            else if (!isObject(objValue) || isFunction(objValue)) {
3685              newValue = initCloneObject(srcValue);
3686            }
3687          }
3688          else {
3689            isCommon = false;
3690          }
3691        }
3692        if (isCommon) {
3693          // Recursively merge objects and arrays (susceptible to call stack limits).
3694          stack.set(srcValue, newValue);
3695          mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
3696          stack['delete'](srcValue);
3697        }
3698        assignMergeValue(object, key, newValue);
3699      }
3700  
3701      /**
3702       * The base implementation of `_.nth` which doesn't coerce arguments.
3703       *
3704       * @private
3705       * @param {Array} array The array to query.
3706       * @param {number} n The index of the element to return.
3707       * @returns {*} Returns the nth element of `array`.
3708       */
3709      function baseNth(array, n) {
3710        var length = array.length;
3711        if (!length) {
3712          return;
3713        }
3714        n += n < 0 ? length : 0;
3715        return isIndex(n, length) ? array[n] : undefined;
3716      }
3717  
3718      /**
3719       * The base implementation of `_.orderBy` without param guards.
3720       *
3721       * @private
3722       * @param {Array|Object} collection The collection to iterate over.
3723       * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
3724       * @param {string[]} orders The sort orders of `iteratees`.
3725       * @returns {Array} Returns the new sorted array.
3726       */
3727      function baseOrderBy(collection, iteratees, orders) {
3728        var index = -1;
3729        iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
3730  
3731        var result = baseMap(collection, function(value, key, collection) {
3732          var criteria = arrayMap(iteratees, function(iteratee) {
3733            return iteratee(value);
3734          });
3735          return { 'criteria': criteria, 'index': ++index, 'value': value };
3736        });
3737  
3738        return baseSortBy(result, function(object, other) {
3739          return compareMultiple(object, other, orders);
3740        });
3741      }
3742  
3743      /**
3744       * The base implementation of `_.pick` without support for individual
3745       * property identifiers.
3746       *
3747       * @private
3748       * @param {Object} object The source object.
3749       * @param {string[]} paths The property paths to pick.
3750       * @returns {Object} Returns the new object.
3751       */
3752      function basePick(object, paths) {
3753        return basePickBy(object, paths, function(value, path) {
3754          return hasIn(object, path);
3755        });
3756      }
3757  
3758      /**
3759       * The base implementation of  `_.pickBy` without support for iteratee shorthands.
3760       *
3761       * @private
3762       * @param {Object} object The source object.
3763       * @param {string[]} paths The property paths to pick.
3764       * @param {Function} predicate The function invoked per property.
3765       * @returns {Object} Returns the new object.
3766       */
3767      function basePickBy(object, paths, predicate) {
3768        var index = -1,
3769            length = paths.length,
3770            result = {};
3771  
3772        while (++index < length) {
3773          var path = paths[index],
3774              value = baseGet(object, path);
3775  
3776          if (predicate(value, path)) {
3777            baseSet(result, castPath(path, object), value);
3778          }
3779        }
3780        return result;
3781      }
3782  
3783      /**
3784       * A specialized version of `baseProperty` which supports deep paths.
3785       *
3786       * @private
3787       * @param {Array|string} path The path of the property to get.
3788       * @returns {Function} Returns the new accessor function.
3789       */
3790      function basePropertyDeep(path) {
3791        return function(object) {
3792          return baseGet(object, path);
3793        };
3794      }
3795  
3796      /**
3797       * The base implementation of `_.pullAllBy` without support for iteratee
3798       * shorthands.
3799       *
3800       * @private
3801       * @param {Array} array The array to modify.
3802       * @param {Array} values The values to remove.
3803       * @param {Function} [iteratee] The iteratee invoked per element.
3804       * @param {Function} [comparator] The comparator invoked per element.
3805       * @returns {Array} Returns `array`.
3806       */
3807      function basePullAll(array, values, iteratee, comparator) {
3808        var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
3809            index = -1,
3810            length = values.length,
3811            seen = array;
3812  
3813        if (array === values) {
3814          values = copyArray(values);
3815        }
3816        if (iteratee) {
3817          seen = arrayMap(array, baseUnary(iteratee));
3818        }
3819        while (++index < length) {
3820          var fromIndex = 0,
3821              value = values[index],
3822              computed = iteratee ? iteratee(value) : value;
3823  
3824          while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
3825            if (seen !== array) {
3826              splice.call(seen, fromIndex, 1);
3827            }
3828            splice.call(array, fromIndex, 1);
3829          }
3830        }
3831        return array;
3832      }
3833  
3834      /**
3835       * The base implementation of `_.pullAt` without support for individual
3836       * indexes or capturing the removed elements.
3837       *
3838       * @private
3839       * @param {Array} array The array to modify.
3840       * @param {number[]} indexes The indexes of elements to remove.
3841       * @returns {Array} Returns `array`.
3842       */
3843      function basePullAt(array, indexes) {
3844        var length = array ? indexes.length : 0,
3845            lastIndex = length - 1;
3846  
3847        while (length--) {
3848          var index = indexes[length];
3849          if (length == lastIndex || index !== previous) {
3850            var previous = index;
3851            if (isIndex(index)) {
3852              splice.call(array, index, 1);
3853            } else {
3854              baseUnset(array, index);
3855            }
3856          }
3857        }
3858        return array;
3859      }
3860  
3861      /**
3862       * The base implementation of `_.random` without support for returning
3863       * floating-point numbers.
3864       *
3865       * @private
3866       * @param {number} lower The lower bound.
3867       * @param {number} upper The upper bound.
3868       * @returns {number} Returns the random number.
3869       */
3870      function baseRandom(lower, upper) {
3871        return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
3872      }
3873  
3874      /**
3875       * The base implementation of `_.range` and `_.rangeRight` which doesn't
3876       * coerce arguments.
3877       *
3878       * @private
3879       * @param {number} start The start of the range.
3880       * @param {number} end The end of the range.
3881       * @param {number} step The value to increment or decrement by.
3882       * @param {boolean} [fromRight] Specify iterating from right to left.
3883       * @returns {Array} Returns the range of numbers.
3884       */
3885      function baseRange(start, end, step, fromRight) {
3886        var index = -1,
3887            length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
3888            result = Array(length);
3889  
3890        while (length--) {
3891          result[fromRight ? length : ++index] = start;
3892          start += step;
3893        }
3894        return result;
3895      }
3896  
3897      /**
3898       * The base implementation of `_.repeat` which doesn't coerce arguments.
3899       *
3900       * @private
3901       * @param {string} string The string to repeat.
3902       * @param {number} n The number of times to repeat the string.
3903       * @returns {string} Returns the repeated string.
3904       */
3905      function baseRepeat(string, n) {
3906        var result = '';
3907        if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
3908          return result;
3909        }
3910        // Leverage the exponentiation by squaring algorithm for a faster repeat.
3911        // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
3912        do {
3913          if (n % 2) {
3914            result += string;
3915          }
3916          n = nativeFloor(n / 2);
3917          if (n) {
3918            string += string;
3919          }
3920        } while (n);
3921  
3922        return result;
3923      }
3924  
3925      /**
3926       * The base implementation of `_.rest` which doesn't validate or coerce arguments.
3927       *
3928       * @private
3929       * @param {Function} func The function to apply a rest parameter to.
3930       * @param {number} [start=func.length-1] The start position of the rest parameter.
3931       * @returns {Function} Returns the new function.
3932       */
3933      function baseRest(func, start) {
3934        return setToString(overRest(func, start, identity), func + '');
3935      }
3936  
3937      /**
3938       * The base implementation of `_.sample`.
3939       *
3940       * @private
3941       * @param {Array|Object} collection The collection to sample.
3942       * @returns {*} Returns the random element.
3943       */
3944      function baseSample(collection) {
3945        return arraySample(values(collection));
3946      }
3947  
3948      /**
3949       * The base implementation of `_.sampleSize` without param guards.
3950       *
3951       * @private
3952       * @param {Array|Object} collection The collection to sample.
3953       * @param {number} n The number of elements to sample.
3954       * @returns {Array} Returns the random elements.
3955       */
3956      function baseSampleSize(collection, n) {
3957        var array = values(collection);
3958        return shuffleSelf(array, baseClamp(n, 0, array.length));
3959      }
3960  
3961      /**
3962       * The base implementation of `_.set`.
3963       *
3964       * @private
3965       * @param {Object} object The object to modify.
3966       * @param {Array|string} path The path of the property to set.
3967       * @param {*} value The value to set.
3968       * @param {Function} [customizer] The function to customize path creation.
3969       * @returns {Object} Returns `object`.
3970       */
3971      function baseSet(object, path, value, customizer) {
3972        if (!isObject(object)) {
3973          return object;
3974        }
3975        path = castPath(path, object);
3976  
3977        var index = -1,
3978            length = path.length,
3979            lastIndex = length - 1,
3980            nested = object;
3981  
3982        while (nested != null && ++index < length) {
3983          var key = toKey(path[index]),
3984              newValue = value;
3985  
3986          if (index != lastIndex) {
3987            var objValue = nested[key];
3988            newValue = customizer ? customizer(objValue, key, nested) : undefined;
3989            if (newValue === undefined) {
3990              newValue = isObject(objValue)
3991                ? objValue
3992                : (isIndex(path[index + 1]) ? [] : {});
3993            }
3994          }
3995          assignValue(nested, key, newValue);
3996          nested = nested[key];
3997        }
3998        return object;
3999      }
4000  
4001      /**
4002       * The base implementation of `setData` without support for hot loop shorting.
4003       *
4004       * @private
4005       * @param {Function} func The function to associate metadata with.
4006       * @param {*} data The metadata.
4007       * @returns {Function} Returns `func`.
4008       */
4009      var baseSetData = !metaMap ? identity : function(func, data) {
4010        metaMap.set(func, data);
4011        return func;
4012      };
4013  
4014      /**
4015       * The base implementation of `setToString` without support for hot loop shorting.
4016       *
4017       * @private
4018       * @param {Function} func The function to modify.
4019       * @param {Function} string The `toString` result.
4020       * @returns {Function} Returns `func`.
4021       */
4022      var baseSetToString = !defineProperty ? identity : function(func, string) {
4023        return defineProperty(func, 'toString', {
4024          'configurable': true,
4025          'enumerable': false,
4026          'value': constant(string),
4027          'writable': true
4028        });
4029      };
4030  
4031      /**
4032       * The base implementation of `_.shuffle`.
4033       *
4034       * @private
4035       * @param {Array|Object} collection The collection to shuffle.
4036       * @returns {Array} Returns the new shuffled array.
4037       */
4038      function baseShuffle(collection) {
4039        return shuffleSelf(values(collection));
4040      }
4041  
4042      /**
4043       * The base implementation of `_.slice` without an iteratee call guard.
4044       *
4045       * @private
4046       * @param {Array} array The array to slice.
4047       * @param {number} [start=0] The start position.
4048       * @param {number} [end=array.length] The end position.
4049       * @returns {Array} Returns the slice of `array`.
4050       */
4051      function baseSlice(array, start, end) {
4052        var index = -1,
4053            length = array.length;
4054  
4055        if (start < 0) {
4056          start = -start > length ? 0 : (length + start);
4057        }
4058        end = end > length ? length : end;
4059        if (end < 0) {
4060          end += length;
4061        }
4062        length = start > end ? 0 : ((end - start) >>> 0);
4063        start >>>= 0;
4064  
4065        var result = Array(length);
4066        while (++index < length) {
4067          result[index] = array[index + start];
4068        }
4069        return result;
4070      }
4071  
4072      /**
4073       * The base implementation of `_.some` without support for iteratee shorthands.
4074       *
4075       * @private
4076       * @param {Array|Object} collection The collection to iterate over.
4077       * @param {Function} predicate The function invoked per iteration.
4078       * @returns {boolean} Returns `true` if any element passes the predicate check,
4079       *  else `false`.
4080       */
4081      function baseSome(collection, predicate) {
4082        var result;
4083  
4084        baseEach(collection, function(value, index, collection) {
4085          result = predicate(value, index, collection);
4086          return !result;
4087        });
4088        return !!result;
4089      }
4090  
4091      /**
4092       * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
4093       * performs a binary search of `array` to determine the index at which `value`
4094       * should be inserted into `array` in order to maintain its sort order.
4095       *
4096       * @private
4097       * @param {Array} array The sorted array to inspect.
4098       * @param {*} value The value to evaluate.
4099       * @param {boolean} [retHighest] Specify returning the highest qualified index.
4100       * @returns {number} Returns the index at which `value` should be inserted
4101       *  into `array`.
4102       */
4103      function baseSortedIndex(array, value, retHighest) {
4104        var low = 0,
4105            high = array == null ? low : array.length;
4106  
4107        if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
4108          while (low < high) {
4109            var mid = (low + high) >>> 1,
4110                computed = array[mid];
4111  
4112            if (computed !== null && !isSymbol(computed) &&
4113                (retHighest ? (computed <= value) : (computed < value))) {
4114              low = mid + 1;
4115            } else {
4116              high = mid;
4117            }
4118          }
4119          return high;
4120        }
4121        return baseSortedIndexBy(array, value, identity, retHighest);
4122      }
4123  
4124      /**
4125       * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
4126       * which invokes `iteratee` for `value` and each element of `array` to compute
4127       * their sort ranking. The iteratee is invoked with one argument; (value).
4128       *
4129       * @private
4130       * @param {Array} array The sorted array to inspect.
4131       * @param {*} value The value to evaluate.
4132       * @param {Function} iteratee The iteratee invoked per element.
4133       * @param {boolean} [retHighest] Specify returning the highest qualified index.
4134       * @returns {number} Returns the index at which `value` should be inserted
4135       *  into `array`.
4136       */
4137      function baseSortedIndexBy(array, value, iteratee, retHighest) {
4138        value = iteratee(value);
4139  
4140        var low = 0,
4141            high = array == null ? 0 : array.length,
4142            valIsNaN = value !== value,
4143            valIsNull = value === null,
4144            valIsSymbol = isSymbol(value),
4145            valIsUndefined = value === undefined;
4146  
4147        while (low < high) {
4148          var mid = nativeFloor((low + high) / 2),
4149              computed = iteratee(array[mid]),
4150              othIsDefined = computed !== undefined,
4151              othIsNull = computed === null,
4152              othIsReflexive = computed === computed,
4153              othIsSymbol = isSymbol(computed);
4154  
4155          if (valIsNaN) {
4156            var setLow = retHighest || othIsReflexive;
4157          } else if (valIsUndefined) {
4158            setLow = othIsReflexive && (retHighest || othIsDefined);
4159          } else if (valIsNull) {
4160            setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
4161          } else if (valIsSymbol) {
4162            setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
4163          } else if (othIsNull || othIsSymbol) {
4164            setLow = false;
4165          } else {
4166            setLow = retHighest ? (computed <= value) : (computed < value);
4167          }
4168          if (setLow) {
4169            low = mid + 1;
4170          } else {
4171            high = mid;
4172          }
4173        }
4174        return nativeMin(high, MAX_ARRAY_INDEX);
4175      }
4176  
4177      /**
4178       * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
4179       * support for iteratee shorthands.
4180       *
4181       * @private
4182       * @param {Array} array The array to inspect.
4183       * @param {Function} [iteratee] The iteratee invoked per element.
4184       * @returns {Array} Returns the new duplicate free array.
4185       */
4186      function baseSortedUniq(array, iteratee) {
4187        var index = -1,
4188            length = array.length,
4189            resIndex = 0,
4190            result = [];
4191  
4192        while (++index < length) {
4193          var value = array[index],
4194              computed = iteratee ? iteratee(value) : value;
4195  
4196          if (!index || !eq(computed, seen)) {
4197            var seen = computed;
4198            result[resIndex++] = value === 0 ? 0 : value;
4199          }
4200        }
4201        return result;
4202      }
4203  
4204      /**
4205       * The base implementation of `_.toNumber` which doesn't ensure correct
4206       * conversions of binary, hexadecimal, or octal string values.
4207       *
4208       * @private
4209       * @param {*} value The value to process.
4210       * @returns {number} Returns the number.
4211       */
4212      function baseToNumber(value) {
4213        if (typeof value == 'number') {
4214          return value;
4215        }
4216        if (isSymbol(value)) {
4217          return NAN;
4218        }
4219        return +value;
4220      }
4221  
4222      /**
4223       * The base implementation of `_.toString` which doesn't convert nullish
4224       * values to empty strings.
4225       *
4226       * @private
4227       * @param {*} value The value to process.
4228       * @returns {string} Returns the string.
4229       */
4230      function baseToString(value) {
4231        // Exit early for strings to avoid a performance hit in some environments.
4232        if (typeof value == 'string') {
4233          return value;
4234        }
4235        if (isArray(value)) {
4236          // Recursively convert values (susceptible to call stack limits).
4237          return arrayMap(value, baseToString) + '';
4238        }
4239        if (isSymbol(value)) {
4240          return symbolToString ? symbolToString.call(value) : '';
4241        }
4242        var result = (value + '');
4243        return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
4244      }
4245  
4246      /**
4247       * The base implementation of `_.uniqBy` without support for iteratee shorthands.
4248       *
4249       * @private
4250       * @param {Array} array The array to inspect.
4251       * @param {Function} [iteratee] The iteratee invoked per element.
4252       * @param {Function} [comparator] The comparator invoked per element.
4253       * @returns {Array} Returns the new duplicate free array.
4254       */
4255      function baseUniq(array, iteratee, comparator) {
4256        var index = -1,
4257            includes = arrayIncludes,
4258            length = array.length,
4259            isCommon = true,
4260            result = [],
4261            seen = result;
4262  
4263        if (comparator) {
4264          isCommon = false;
4265          includes = arrayIncludesWith;
4266        }
4267        else if (length >= LARGE_ARRAY_SIZE) {
4268          var set = iteratee ? null : createSet(array);
4269          if (set) {
4270            return setToArray(set);
4271          }
4272          isCommon = false;
4273          includes = cacheHas;
4274          seen = new SetCache;
4275        }
4276        else {
4277          seen = iteratee ? [] : result;
4278        }
4279        outer:
4280        while (++index < length) {
4281          var value = array[index],
4282              computed = iteratee ? iteratee(value) : value;
4283  
4284          value = (comparator || value !== 0) ? value : 0;
4285          if (isCommon && computed === computed) {
4286            var seenIndex = seen.length;
4287            while (seenIndex--) {
4288              if (seen[seenIndex] === computed) {
4289                continue outer;
4290              }
4291            }
4292            if (iteratee) {
4293              seen.push(computed);
4294            }
4295            result.push(value);
4296          }
4297          else if (!includes(seen, computed, comparator)) {
4298            if (seen !== result) {
4299              seen.push(computed);
4300            }
4301            result.push(value);
4302          }
4303        }
4304        return result;
4305      }
4306  
4307      /**
4308       * The base implementation of `_.unset`.
4309       *
4310       * @private
4311       * @param {Object} object The object to modify.
4312       * @param {Array|string} path The property path to unset.
4313       * @returns {boolean} Returns `true` if the property is deleted, else `false`.
4314       */
4315      function baseUnset(object, path) {
4316        path = castPath(path, object);
4317        object = parent(object, path);
4318        return object == null || delete object[toKey(last(path))];
4319      }
4320  
4321      /**
4322       * The base implementation of `_.update`.
4323       *
4324       * @private
4325       * @param {Object} object The object to modify.
4326       * @param {Array|string} path The path of the property to update.
4327       * @param {Function} updater The function to produce the updated value.
4328       * @param {Function} [customizer] The function to customize path creation.
4329       * @returns {Object} Returns `object`.
4330       */
4331      function baseUpdate(object, path, updater, customizer) {
4332        return baseSet(object, path, updater(baseGet(object, path)), customizer);
4333      }
4334  
4335      /**
4336       * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
4337       * without support for iteratee shorthands.
4338       *
4339       * @private
4340       * @param {Array} array The array to query.
4341       * @param {Function} predicate The function invoked per iteration.
4342       * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
4343       * @param {boolean} [fromRight] Specify iterating from right to left.
4344       * @returns {Array} Returns the slice of `array`.
4345       */
4346      function baseWhile(array, predicate, isDrop, fromRight) {
4347        var length = array.length,
4348            index = fromRight ? length : -1;
4349  
4350        while ((fromRight ? index-- : ++index < length) &&
4351          predicate(array[index], index, array)) {}
4352  
4353        return isDrop
4354          ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
4355          : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
4356      }
4357  
4358      /**
4359       * The base implementation of `wrapperValue` which returns the result of
4360       * performing a sequence of actions on the unwrapped `value`, where each
4361       * successive action is supplied the return value of the previous.
4362       *
4363       * @private
4364       * @param {*} value The unwrapped value.
4365       * @param {Array} actions Actions to perform to resolve the unwrapped value.
4366       * @returns {*} Returns the resolved value.
4367       */
4368      function baseWrapperValue(value, actions) {
4369        var result = value;
4370        if (result instanceof LazyWrapper) {
4371          result = result.value();
4372        }
4373        return arrayReduce(actions, function(result, action) {
4374          return action.func.apply(action.thisArg, arrayPush([result], action.args));
4375        }, result);
4376      }
4377  
4378      /**
4379       * The base implementation of methods like `_.xor`, without support for
4380       * iteratee shorthands, that accepts an array of arrays to inspect.
4381       *
4382       * @private
4383       * @param {Array} arrays The arrays to inspect.
4384       * @param {Function} [iteratee] The iteratee invoked per element.
4385       * @param {Function} [comparator] The comparator invoked per element.
4386       * @returns {Array} Returns the new array of values.
4387       */
4388      function baseXor(arrays, iteratee, comparator) {
4389        var length = arrays.length;
4390        if (length < 2) {
4391          return length ? baseUniq(arrays[0]) : [];
4392        }
4393        var index = -1,
4394            result = Array(length);
4395  
4396        while (++index < length) {
4397          var array = arrays[index],
4398              othIndex = -1;
4399  
4400          while (++othIndex < length) {
4401            if (othIndex != index) {
4402              result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
4403            }
4404          }
4405        }
4406        return baseUniq(baseFlatten(result, 1), iteratee, comparator);
4407      }
4408  
4409      /**
4410       * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
4411       *
4412       * @private
4413       * @param {Array} props The property identifiers.
4414       * @param {Array} values The property values.
4415       * @param {Function} assignFunc The function to assign values.
4416       * @returns {Object} Returns the new object.
4417       */
4418      function baseZipObject(props, values, assignFunc) {
4419        var index = -1,
4420            length = props.length,
4421            valsLength = values.length,
4422            result = {};
4423  
4424        while (++index < length) {
4425          var value = index < valsLength ? values[index] : undefined;
4426          assignFunc(result, props[index], value);
4427        }
4428        return result;
4429      }
4430  
4431      /**
4432       * Casts `value` to an empty array if it's not an array like object.
4433       *
4434       * @private
4435       * @param {*} value The value to inspect.
4436       * @returns {Array|Object} Returns the cast array-like object.
4437       */
4438      function castArrayLikeObject(value) {
4439        return isArrayLikeObject(value) ? value : [];
4440      }
4441  
4442      /**
4443       * Casts `value` to `identity` if it's not a function.
4444       *
4445       * @private
4446       * @param {*} value The value to inspect.
4447       * @returns {Function} Returns cast function.
4448       */
4449      function castFunction(value) {
4450        return typeof value == 'function' ? value : identity;
4451      }
4452  
4453      /**
4454       * Casts `value` to a path array if it's not one.
4455       *
4456       * @private
4457       * @param {*} value The value to inspect.
4458       * @param {Object} [object] The object to query keys on.
4459       * @returns {Array} Returns the cast property path array.
4460       */
4461      function castPath(value, object) {
4462        if (isArray(value)) {
4463          return value;
4464        }
4465        return isKey(value, object) ? [value] : stringToPath(toString(value));
4466      }
4467  
4468      /**
4469       * A `baseRest` alias which can be replaced with `identity` by module
4470       * replacement plugins.
4471       *
4472       * @private
4473       * @type {Function}
4474       * @param {Function} func The function to apply a rest parameter to.
4475       * @returns {Function} Returns the new function.
4476       */
4477      var castRest = baseRest;
4478  
4479      /**
4480       * Casts `array` to a slice if it's needed.
4481       *
4482       * @private
4483       * @param {Array} array The array to inspect.
4484       * @param {number} start The start position.
4485       * @param {number} [end=array.length] The end position.
4486       * @returns {Array} Returns the cast slice.
4487       */
4488      function castSlice(array, start, end) {
4489        var length = array.length;
4490        end = end === undefined ? length : end;
4491        return (!start && end >= length) ? array : baseSlice(array, start, end);
4492      }
4493  
4494      /**
4495       * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
4496       *
4497       * @private
4498       * @param {number|Object} id The timer id or timeout object of the timer to clear.
4499       */
4500      var clearTimeout = ctxClearTimeout || function(id) {
4501        return root.clearTimeout(id);
4502      };
4503  
4504      /**
4505       * Creates a clone of  `buffer`.
4506       *
4507       * @private
4508       * @param {Buffer} buffer The buffer to clone.
4509       * @param {boolean} [isDeep] Specify a deep clone.
4510       * @returns {Buffer} Returns the cloned buffer.
4511       */
4512      function cloneBuffer(buffer, isDeep) {
4513        if (isDeep) {
4514          return buffer.slice();
4515        }
4516        var length = buffer.length,
4517            result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
4518  
4519        buffer.copy(result);
4520        return result;
4521      }
4522  
4523      /**
4524       * Creates a clone of `arrayBuffer`.
4525       *
4526       * @private
4527       * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
4528       * @returns {ArrayBuffer} Returns the cloned array buffer.
4529       */
4530      function cloneArrayBuffer(arrayBuffer) {
4531        var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
4532        new Uint8Array(result).set(new Uint8Array(arrayBuffer));
4533        return result;
4534      }
4535  
4536      /**
4537       * Creates a clone of `dataView`.
4538       *
4539       * @private
4540       * @param {Object} dataView The data view to clone.
4541       * @param {boolean} [isDeep] Specify a deep clone.
4542       * @returns {Object} Returns the cloned data view.
4543       */
4544      function cloneDataView(dataView, isDeep) {
4545        var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
4546        return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
4547      }
4548  
4549      /**
4550       * Creates a clone of `regexp`.
4551       *
4552       * @private
4553       * @param {Object} regexp The regexp to clone.
4554       * @returns {Object} Returns the cloned regexp.
4555       */
4556      function cloneRegExp(regexp) {
4557        var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
4558        result.lastIndex = regexp.lastIndex;
4559        return result;
4560      }
4561  
4562      /**
4563       * Creates a clone of the `symbol` object.
4564       *
4565       * @private
4566       * @param {Object} symbol The symbol object to clone.
4567       * @returns {Object} Returns the cloned symbol object.
4568       */
4569      function cloneSymbol(symbol) {
4570        return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
4571      }
4572  
4573      /**
4574       * Creates a clone of `typedArray`.
4575       *
4576       * @private
4577       * @param {Object} typedArray The typed array to clone.
4578       * @param {boolean} [isDeep] Specify a deep clone.
4579       * @returns {Object} Returns the cloned typed array.
4580       */
4581      function cloneTypedArray(typedArray, isDeep) {
4582        var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
4583        return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
4584      }
4585  
4586      /**
4587       * Compares values to sort them in ascending order.
4588       *
4589       * @private
4590       * @param {*} value The value to compare.
4591       * @param {*} other The other value to compare.
4592       * @returns {number} Returns the sort order indicator for `value`.
4593       */
4594      function compareAscending(value, other) {
4595        if (value !== other) {
4596          var valIsDefined = value !== undefined,
4597              valIsNull = value === null,
4598              valIsReflexive = value === value,
4599              valIsSymbol = isSymbol(value);
4600  
4601          var othIsDefined = other !== undefined,
4602              othIsNull = other === null,
4603              othIsReflexive = other === other,
4604              othIsSymbol = isSymbol(other);
4605  
4606          if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
4607              (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
4608              (valIsNull && othIsDefined && othIsReflexive) ||
4609              (!valIsDefined && othIsReflexive) ||
4610              !valIsReflexive) {
4611            return 1;
4612          }
4613          if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
4614              (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
4615              (othIsNull && valIsDefined && valIsReflexive) ||
4616              (!othIsDefined && valIsReflexive) ||
4617              !othIsReflexive) {
4618            return -1;
4619          }
4620        }
4621        return 0;
4622      }
4623  
4624      /**
4625       * Used by `_.orderBy` to compare multiple properties of a value to another
4626       * and stable sort them.
4627       *
4628       * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
4629       * specify an order of "desc" for descending or "asc" for ascending sort order
4630       * of corresponding values.
4631       *
4632       * @private
4633       * @param {Object} object The object to compare.
4634       * @param {Object} other The other object to compare.
4635       * @param {boolean[]|string[]} orders The order to sort by for each property.
4636       * @returns {number} Returns the sort order indicator for `object`.
4637       */
4638      function compareMultiple(object, other, orders) {
4639        var index = -1,
4640            objCriteria = object.criteria,
4641            othCriteria = other.criteria,
4642            length = objCriteria.length,
4643            ordersLength = orders.length;
4644  
4645        while (++index < length) {
4646          var result = compareAscending(objCriteria[index], othCriteria[index]);
4647          if (result) {
4648            if (index >= ordersLength) {
4649              return result;
4650            }
4651            var order = orders[index];
4652            return result * (order == 'desc' ? -1 : 1);
4653          }
4654        }
4655        // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
4656        // that causes it, under certain circumstances, to provide the same value for
4657        // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
4658        // for more details.
4659        //
4660        // This also ensures a stable sort in V8 and other engines.
4661        // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
4662        return object.index - other.index;
4663      }
4664  
4665      /**
4666       * Creates an array that is the composition of partially applied arguments,
4667       * placeholders, and provided arguments into a single array of arguments.
4668       *
4669       * @private
4670       * @param {Array} args The provided arguments.
4671       * @param {Array} partials The arguments to prepend to those provided.
4672       * @param {Array} holders The `partials` placeholder indexes.
4673       * @params {boolean} [isCurried] Specify composing for a curried function.
4674       * @returns {Array} Returns the new array of composed arguments.
4675       */
4676      function composeArgs(args, partials, holders, isCurried) {
4677        var argsIndex = -1,
4678            argsLength = args.length,
4679            holdersLength = holders.length,
4680            leftIndex = -1,
4681            leftLength = partials.length,
4682            rangeLength = nativeMax(argsLength - holdersLength, 0),
4683            result = Array(leftLength + rangeLength),
4684            isUncurried = !isCurried;
4685  
4686        while (++leftIndex < leftLength) {
4687          result[leftIndex] = partials[leftIndex];
4688        }
4689        while (++argsIndex < holdersLength) {
4690          if (isUncurried || argsIndex < argsLength) {
4691            result[holders[argsIndex]] = args[argsIndex];
4692          }
4693        }
4694        while (rangeLength--) {
4695          result[leftIndex++] = args[argsIndex++];
4696        }
4697        return result;
4698      }
4699  
4700      /**
4701       * This function is like `composeArgs` except that the arguments composition
4702       * is tailored for `_.partialRight`.
4703       *
4704       * @private
4705       * @param {Array} args The provided arguments.
4706       * @param {Array} partials The arguments to append to those provided.
4707       * @param {Array} holders The `partials` placeholder indexes.
4708       * @params {boolean} [isCurried] Specify composing for a curried function.
4709       * @returns {Array} Returns the new array of composed arguments.
4710       */
4711      function composeArgsRight(args, partials, holders, isCurried) {
4712        var argsIndex = -1,
4713            argsLength = args.length,
4714            holdersIndex = -1,
4715            holdersLength = holders.length,
4716            rightIndex = -1,
4717            rightLength = partials.length,
4718            rangeLength = nativeMax(argsLength - holdersLength, 0),
4719            result = Array(rangeLength + rightLength),
4720            isUncurried = !isCurried;
4721  
4722        while (++argsIndex < rangeLength) {
4723          result[argsIndex] = args[argsIndex];
4724        }
4725        var offset = argsIndex;
4726        while (++rightIndex < rightLength) {
4727          result[offset + rightIndex] = partials[rightIndex];
4728        }
4729        while (++holdersIndex < holdersLength) {
4730          if (isUncurried || argsIndex < argsLength) {
4731            result[offset + holders[holdersIndex]] = args[argsIndex++];
4732          }
4733        }
4734        return result;
4735      }
4736  
4737      /**
4738       * Copies the values of `source` to `array`.
4739       *
4740       * @private
4741       * @param {Array} source The array to copy values from.
4742       * @param {Array} [array=[]] The array to copy values to.
4743       * @returns {Array} Returns `array`.
4744       */
4745      function copyArray(source, array) {
4746        var index = -1,
4747            length = source.length;
4748  
4749        array || (array = Array(length));
4750        while (++index < length) {
4751          array[index] = source[index];
4752        }
4753        return array;
4754      }
4755  
4756      /**
4757       * Copies properties of `source` to `object`.
4758       *
4759       * @private
4760       * @param {Object} source The object to copy properties from.
4761       * @param {Array} props The property identifiers to copy.
4762       * @param {Object} [object={}] The object to copy properties to.
4763       * @param {Function} [customizer] The function to customize copied values.
4764       * @returns {Object} Returns `object`.
4765       */
4766      function copyObject(source, props, object, customizer) {
4767        var isNew = !object;
4768        object || (object = {});
4769  
4770        var index = -1,
4771            length = props.length;
4772  
4773        while (++index < length) {
4774          var key = props[index];
4775  
4776          var newValue = customizer
4777            ? customizer(object[key], source[key], key, object, source)
4778            : undefined;
4779  
4780          if (newValue === undefined) {
4781            newValue = source[key];
4782          }
4783          if (isNew) {
4784            baseAssignValue(object, key, newValue);
4785          } else {
4786            assignValue(object, key, newValue);
4787          }
4788        }
4789        return object;
4790      }
4791  
4792      /**
4793       * Copies own symbols of `source` to `object`.
4794       *
4795       * @private
4796       * @param {Object} source The object to copy symbols from.
4797       * @param {Object} [object={}] The object to copy symbols to.
4798       * @returns {Object} Returns `object`.
4799       */
4800      function copySymbols(source, object) {
4801        return copyObject(source, getSymbols(source), object);
4802      }
4803  
4804      /**
4805       * Copies own and inherited symbols of `source` to `object`.
4806       *
4807       * @private
4808       * @param {Object} source The object to copy symbols from.
4809       * @param {Object} [object={}] The object to copy symbols to.
4810       * @returns {Object} Returns `object`.
4811       */
4812      function copySymbolsIn(source, object) {
4813        return copyObject(source, getSymbolsIn(source), object);
4814      }
4815  
4816      /**
4817       * Creates a function like `_.groupBy`.
4818       *
4819       * @private
4820       * @param {Function} setter The function to set accumulator values.
4821       * @param {Function} [initializer] The accumulator object initializer.
4822       * @returns {Function} Returns the new aggregator function.
4823       */
4824      function createAggregator(setter, initializer) {
4825        return function(collection, iteratee) {
4826          var func = isArray(collection) ? arrayAggregator : baseAggregator,
4827              accumulator = initializer ? initializer() : {};
4828  
4829          return func(collection, setter, getIteratee(iteratee, 2), accumulator);
4830        };
4831      }
4832  
4833      /**
4834       * Creates a function like `_.assign`.
4835       *
4836       * @private
4837       * @param {Function} assigner The function to assign values.
4838       * @returns {Function} Returns the new assigner function.
4839       */
4840      function createAssigner(assigner) {
4841        return baseRest(function(object, sources) {
4842          var index = -1,
4843              length = sources.length,
4844              customizer = length > 1 ? sources[length - 1] : undefined,
4845              guard = length > 2 ? sources[2] : undefined;
4846  
4847          customizer = (assigner.length > 3 && typeof customizer == 'function')
4848            ? (length--, customizer)
4849            : undefined;
4850  
4851          if (guard && isIterateeCall(sources[0], sources[1], guard)) {
4852            customizer = length < 3 ? undefined : customizer;
4853            length = 1;
4854          }
4855          object = Object(object);
4856          while (++index < length) {
4857            var source = sources[index];
4858            if (source) {
4859              assigner(object, source, index, customizer);
4860            }
4861          }
4862          return object;
4863        });
4864      }
4865  
4866      /**
4867       * Creates a `baseEach` or `baseEachRight` function.
4868       *
4869       * @private
4870       * @param {Function} eachFunc The function to iterate over a collection.
4871       * @param {boolean} [fromRight] Specify iterating from right to left.
4872       * @returns {Function} Returns the new base function.
4873       */
4874      function createBaseEach(eachFunc, fromRight) {
4875        return function(collection, iteratee) {
4876          if (collection == null) {
4877            return collection;
4878          }
4879          if (!isArrayLike(collection)) {
4880            return eachFunc(collection, iteratee);
4881          }
4882          var length = collection.length,
4883              index = fromRight ? length : -1,
4884              iterable = Object(collection);
4885  
4886          while ((fromRight ? index-- : ++index < length)) {
4887            if (iteratee(iterable[index], index, iterable) === false) {
4888              break;
4889            }
4890          }
4891          return collection;
4892        };
4893      }
4894  
4895      /**
4896       * Creates a base function for methods like `_.forIn` and `_.forOwn`.
4897       *
4898       * @private
4899       * @param {boolean} [fromRight] Specify iterating from right to left.
4900       * @returns {Function} Returns the new base function.
4901       */
4902      function createBaseFor(fromRight) {
4903        return function(object, iteratee, keysFunc) {
4904          var index = -1,
4905              iterable = Object(object),
4906              props = keysFunc(object),
4907              length = props.length;
4908  
4909          while (length--) {
4910            var key = props[fromRight ? length : ++index];
4911            if (iteratee(iterable[key], key, iterable) === false) {
4912              break;
4913            }
4914          }
4915          return object;
4916        };
4917      }
4918  
4919      /**
4920       * Creates a function that wraps `func` to invoke it with the optional `this`
4921       * binding of `thisArg`.
4922       *
4923       * @private
4924       * @param {Function} func The function to wrap.
4925       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
4926       * @param {*} [thisArg] The `this` binding of `func`.
4927       * @returns {Function} Returns the new wrapped function.
4928       */
4929      function createBind(func, bitmask, thisArg) {
4930        var isBind = bitmask & WRAP_BIND_FLAG,
4931            Ctor = createCtor(func);
4932  
4933        function wrapper() {
4934          var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
4935          return fn.apply(isBind ? thisArg : this, arguments);
4936        }
4937        return wrapper;
4938      }
4939  
4940      /**
4941       * Creates a function like `_.lowerFirst`.
4942       *
4943       * @private
4944       * @param {string} methodName The name of the `String` case method to use.
4945       * @returns {Function} Returns the new case function.
4946       */
4947      function createCaseFirst(methodName) {
4948        return function(string) {
4949          string = toString(string);
4950  
4951          var strSymbols = hasUnicode(string)
4952            ? stringToArray(string)
4953            : undefined;
4954  
4955          var chr = strSymbols
4956            ? strSymbols[0]
4957            : string.charAt(0);
4958  
4959          var trailing = strSymbols
4960            ? castSlice(strSymbols, 1).join('')
4961            : string.slice(1);
4962  
4963          return chr[methodName]() + trailing;
4964        };
4965      }
4966  
4967      /**
4968       * Creates a function like `_.camelCase`.
4969       *
4970       * @private
4971       * @param {Function} callback The function to combine each word.
4972       * @returns {Function} Returns the new compounder function.
4973       */
4974      function createCompounder(callback) {
4975        return function(string) {
4976          return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
4977        };
4978      }
4979  
4980      /**
4981       * Creates a function that produces an instance of `Ctor` regardless of
4982       * whether it was invoked as part of a `new` expression or by `call` or `apply`.
4983       *
4984       * @private
4985       * @param {Function} Ctor The constructor to wrap.
4986       * @returns {Function} Returns the new wrapped function.
4987       */
4988      function createCtor(Ctor) {
4989        return function() {
4990          // Use a `switch` statement to work with class constructors. See
4991          // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
4992          // for more details.
4993          var args = arguments;
4994          switch (args.length) {
4995            case 0: return new Ctor;
4996            case 1: return new Ctor(args[0]);
4997            case 2: return new Ctor(args[0], args[1]);
4998            case 3: return new Ctor(args[0], args[1], args[2]);
4999            case 4: return new Ctor(args[0], args[1], args[2], args[3]);
5000            case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
5001            case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
5002            case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
5003          }
5004          var thisBinding = baseCreate(Ctor.prototype),
5005              result = Ctor.apply(thisBinding, args);
5006  
5007          // Mimic the constructor's `return` behavior.
5008          // See https://es5.github.io/#x13.2.2 for more details.
5009          return isObject(result) ? result : thisBinding;
5010        };
5011      }
5012  
5013      /**
5014       * Creates a function that wraps `func` to enable currying.
5015       *
5016       * @private
5017       * @param {Function} func The function to wrap.
5018       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5019       * @param {number} arity The arity of `func`.
5020       * @returns {Function} Returns the new wrapped function.
5021       */
5022      function createCurry(func, bitmask, arity) {
5023        var Ctor = createCtor(func);
5024  
5025        function wrapper() {
5026          var length = arguments.length,
5027              args = Array(length),
5028              index = length,
5029              placeholder = getHolder(wrapper);
5030  
5031          while (index--) {
5032            args[index] = arguments[index];
5033          }
5034          var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
5035            ? []
5036            : replaceHolders(args, placeholder);
5037  
5038          length -= holders.length;
5039          if (length < arity) {
5040            return createRecurry(
5041              func, bitmask, createHybrid, wrapper.placeholder, undefined,
5042              args, holders, undefined, undefined, arity - length);
5043          }
5044          var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5045          return apply(fn, this, args);
5046        }
5047        return wrapper;
5048      }
5049  
5050      /**
5051       * Creates a `_.find` or `_.findLast` function.
5052       *
5053       * @private
5054       * @param {Function} findIndexFunc The function to find the collection index.
5055       * @returns {Function} Returns the new find function.
5056       */
5057      function createFind(findIndexFunc) {
5058        return function(collection, predicate, fromIndex) {
5059          var iterable = Object(collection);
5060          if (!isArrayLike(collection)) {
5061            var iteratee = getIteratee(predicate, 3);
5062            collection = keys(collection);
5063            predicate = function(key) { return iteratee(iterable[key], key, iterable); };
5064          }
5065          var index = findIndexFunc(collection, predicate, fromIndex);
5066          return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
5067        };
5068      }
5069  
5070      /**
5071       * Creates a `_.flow` or `_.flowRight` function.
5072       *
5073       * @private
5074       * @param {boolean} [fromRight] Specify iterating from right to left.
5075       * @returns {Function} Returns the new flow function.
5076       */
5077      function createFlow(fromRight) {
5078        return flatRest(function(funcs) {
5079          var length = funcs.length,
5080              index = length,
5081              prereq = LodashWrapper.prototype.thru;
5082  
5083          if (fromRight) {
5084            funcs.reverse();
5085          }
5086          while (index--) {
5087            var func = funcs[index];
5088            if (typeof func != 'function') {
5089              throw new TypeError(FUNC_ERROR_TEXT);
5090            }
5091            if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
5092              var wrapper = new LodashWrapper([], true);
5093            }
5094          }
5095          index = wrapper ? index : length;
5096          while (++index < length) {
5097            func = funcs[index];
5098  
5099            var funcName = getFuncName(func),
5100                data = funcName == 'wrapper' ? getData(func) : undefined;
5101  
5102            if (data && isLaziable(data[0]) &&
5103                  data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
5104                  !data[4].length && data[9] == 1
5105                ) {
5106              wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
5107            } else {
5108              wrapper = (func.length == 1 && isLaziable(func))
5109                ? wrapper[funcName]()
5110                : wrapper.thru(func);
5111            }
5112          }
5113          return function() {
5114            var args = arguments,
5115                value = args[0];
5116  
5117            if (wrapper && args.length == 1 && isArray(value)) {
5118              return wrapper.plant(value).value();
5119            }
5120            var index = 0,
5121                result = length ? funcs[index].apply(this, args) : value;
5122  
5123            while (++index < length) {
5124              result = funcs[index].call(this, result);
5125            }
5126            return result;
5127          };
5128        });
5129      }
5130  
5131      /**
5132       * Creates a function that wraps `func` to invoke it with optional `this`
5133       * binding of `thisArg`, partial application, and currying.
5134       *
5135       * @private
5136       * @param {Function|string} func The function or method name to wrap.
5137       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5138       * @param {*} [thisArg] The `this` binding of `func`.
5139       * @param {Array} [partials] The arguments to prepend to those provided to
5140       *  the new function.
5141       * @param {Array} [holders] The `partials` placeholder indexes.
5142       * @param {Array} [partialsRight] The arguments to append to those provided
5143       *  to the new function.
5144       * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
5145       * @param {Array} [argPos] The argument positions of the new function.
5146       * @param {number} [ary] The arity cap of `func`.
5147       * @param {number} [arity] The arity of `func`.
5148       * @returns {Function} Returns the new wrapped function.
5149       */
5150      function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
5151        var isAry = bitmask & WRAP_ARY_FLAG,
5152            isBind = bitmask & WRAP_BIND_FLAG,
5153            isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
5154            isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
5155            isFlip = bitmask & WRAP_FLIP_FLAG,
5156            Ctor = isBindKey ? undefined : createCtor(func);
5157  
5158        function wrapper() {
5159          var length = arguments.length,
5160              args = Array(length),
5161              index = length;
5162  
5163          while (index--) {
5164            args[index] = arguments[index];
5165          }
5166          if (isCurried) {
5167            var placeholder = getHolder(wrapper),
5168                holdersCount = countHolders(args, placeholder);
5169          }
5170          if (partials) {
5171            args = composeArgs(args, partials, holders, isCurried);
5172          }
5173          if (partialsRight) {
5174            args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
5175          }
5176          length -= holdersCount;
5177          if (isCurried && length < arity) {
5178            var newHolders = replaceHolders(args, placeholder);
5179            return createRecurry(
5180              func, bitmask, createHybrid, wrapper.placeholder, thisArg,
5181              args, newHolders, argPos, ary, arity - length
5182            );
5183          }
5184          var thisBinding = isBind ? thisArg : this,
5185              fn = isBindKey ? thisBinding[func] : func;
5186  
5187          length = args.length;
5188          if (argPos) {
5189            args = reorder(args, argPos);
5190          } else if (isFlip && length > 1) {
5191            args.reverse();
5192          }
5193          if (isAry && ary < length) {
5194            args.length = ary;
5195          }
5196          if (this && this !== root && this instanceof wrapper) {
5197            fn = Ctor || createCtor(fn);
5198          }
5199          return fn.apply(thisBinding, args);
5200        }
5201        return wrapper;
5202      }
5203  
5204      /**
5205       * Creates a function like `_.invertBy`.
5206       *
5207       * @private
5208       * @param {Function} setter The function to set accumulator values.
5209       * @param {Function} toIteratee The function to resolve iteratees.
5210       * @returns {Function} Returns the new inverter function.
5211       */
5212      function createInverter(setter, toIteratee) {
5213        return function(object, iteratee) {
5214          return baseInverter(object, setter, toIteratee(iteratee), {});
5215        };
5216      }
5217  
5218      /**
5219       * Creates a function that performs a mathematical operation on two values.
5220       *
5221       * @private
5222       * @param {Function} operator The function to perform the operation.
5223       * @param {number} [defaultValue] The value used for `undefined` arguments.
5224       * @returns {Function} Returns the new mathematical operation function.
5225       */
5226      function createMathOperation(operator, defaultValue) {
5227        return function(value, other) {
5228          var result;
5229          if (value === undefined && other === undefined) {
5230            return defaultValue;
5231          }
5232          if (value !== undefined) {
5233            result = value;
5234          }
5235          if (other !== undefined) {
5236            if (result === undefined) {
5237              return other;
5238            }
5239            if (typeof value == 'string' || typeof other == 'string') {
5240              value = baseToString(value);
5241              other = baseToString(other);
5242            } else {
5243              value = baseToNumber(value);
5244              other = baseToNumber(other);
5245            }
5246            result = operator(value, other);
5247          }
5248          return result;
5249        };
5250      }
5251  
5252      /**
5253       * Creates a function like `_.over`.
5254       *
5255       * @private
5256       * @param {Function} arrayFunc The function to iterate over iteratees.
5257       * @returns {Function} Returns the new over function.
5258       */
5259      function createOver(arrayFunc) {
5260        return flatRest(function(iteratees) {
5261          iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
5262          return baseRest(function(args) {
5263            var thisArg = this;
5264            return arrayFunc(iteratees, function(iteratee) {
5265              return apply(iteratee, thisArg, args);
5266            });
5267          });
5268        });
5269      }
5270  
5271      /**
5272       * Creates the padding for `string` based on `length`. The `chars` string
5273       * is truncated if the number of characters exceeds `length`.
5274       *
5275       * @private
5276       * @param {number} length The padding length.
5277       * @param {string} [chars=' '] The string used as padding.
5278       * @returns {string} Returns the padding for `string`.
5279       */
5280      function createPadding(length, chars) {
5281        chars = chars === undefined ? ' ' : baseToString(chars);
5282  
5283        var charsLength = chars.length;
5284        if (charsLength < 2) {
5285          return charsLength ? baseRepeat(chars, length) : chars;
5286        }
5287        var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
5288        return hasUnicode(chars)
5289          ? castSlice(stringToArray(result), 0, length).join('')
5290          : result.slice(0, length);
5291      }
5292  
5293      /**
5294       * Creates a function that wraps `func` to invoke it with the `this` binding
5295       * of `thisArg` and `partials` prepended to the arguments it receives.
5296       *
5297       * @private
5298       * @param {Function} func The function to wrap.
5299       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5300       * @param {*} thisArg The `this` binding of `func`.
5301       * @param {Array} partials The arguments to prepend to those provided to
5302       *  the new function.
5303       * @returns {Function} Returns the new wrapped function.
5304       */
5305      function createPartial(func, bitmask, thisArg, partials) {
5306        var isBind = bitmask & WRAP_BIND_FLAG,
5307            Ctor = createCtor(func);
5308  
5309        function wrapper() {
5310          var argsIndex = -1,
5311              argsLength = arguments.length,
5312              leftIndex = -1,
5313              leftLength = partials.length,
5314              args = Array(leftLength + argsLength),
5315              fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5316  
5317          while (++leftIndex < leftLength) {
5318            args[leftIndex] = partials[leftIndex];
5319          }
5320          while (argsLength--) {
5321            args[leftIndex++] = arguments[++argsIndex];
5322          }
5323          return apply(fn, isBind ? thisArg : this, args);
5324        }
5325        return wrapper;
5326      }
5327  
5328      /**
5329       * Creates a `_.range` or `_.rangeRight` function.
5330       *
5331       * @private
5332       * @param {boolean} [fromRight] Specify iterating from right to left.
5333       * @returns {Function} Returns the new range function.
5334       */
5335      function createRange(fromRight) {
5336        return function(start, end, step) {
5337          if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
5338            end = step = undefined;
5339          }
5340          // Ensure the sign of `-0` is preserved.
5341          start = toFinite(start);
5342          if (end === undefined) {
5343            end = start;
5344            start = 0;
5345          } else {
5346            end = toFinite(end);
5347          }
5348          step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
5349          return baseRange(start, end, step, fromRight);
5350        };
5351      }
5352  
5353      /**
5354       * Creates a function that performs a relational operation on two values.
5355       *
5356       * @private
5357       * @param {Function} operator The function to perform the operation.
5358       * @returns {Function} Returns the new relational operation function.
5359       */
5360      function createRelationalOperation(operator) {
5361        return function(value, other) {
5362          if (!(typeof value == 'string' && typeof other == 'string')) {
5363            value = toNumber(value);
5364            other = toNumber(other);
5365          }
5366          return operator(value, other);
5367        };
5368      }
5369  
5370      /**
5371       * Creates a function that wraps `func` to continue currying.
5372       *
5373       * @private
5374       * @param {Function} func The function to wrap.
5375       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
5376       * @param {Function} wrapFunc The function to create the `func` wrapper.
5377       * @param {*} placeholder The placeholder value.
5378       * @param {*} [thisArg] The `this` binding of `func`.
5379       * @param {Array} [partials] The arguments to prepend to those provided to
5380       *  the new function.
5381       * @param {Array} [holders] The `partials` placeholder indexes.
5382       * @param {Array} [argPos] The argument positions of the new function.
5383       * @param {number} [ary] The arity cap of `func`.
5384       * @param {number} [arity] The arity of `func`.
5385       * @returns {Function} Returns the new wrapped function.
5386       */
5387      function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
5388        var isCurry = bitmask & WRAP_CURRY_FLAG,
5389            newHolders = isCurry ? holders : undefined,
5390            newHoldersRight = isCurry ? undefined : holders,
5391            newPartials = isCurry ? partials : undefined,
5392            newPartialsRight = isCurry ? undefined : partials;
5393  
5394        bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
5395        bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
5396  
5397        if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
5398          bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
5399        }
5400        var newData = [
5401          func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
5402          newHoldersRight, argPos, ary, arity
5403        ];
5404  
5405        var result = wrapFunc.apply(undefined, newData);
5406        if (isLaziable(func)) {
5407          setData(result, newData);
5408        }
5409        result.placeholder = placeholder;
5410        return setWrapToString(result, func, bitmask);
5411      }
5412  
5413      /**
5414       * Creates a function like `_.round`.
5415       *
5416       * @private
5417       * @param {string} methodName The name of the `Math` method to use when rounding.
5418       * @returns {Function} Returns the new round function.
5419       */
5420      function createRound(methodName) {
5421        var func = Math[methodName];
5422        return function(number, precision) {
5423          number = toNumber(number);
5424          precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
5425          if (precision) {
5426            // Shift with exponential notation to avoid floating-point issues.
5427            // See [MDN](https://mdn.io/round#Examples) for more details.
5428            var pair = (toString(number) + 'e').split('e'),
5429                value = func(pair[0] + 'e' + (+pair[1] + precision));
5430  
5431            pair = (toString(value) + 'e').split('e');
5432            return +(pair[0] + 'e' + (+pair[1] - precision));
5433          }
5434          return func(number);
5435        };
5436      }
5437  
5438      /**
5439       * Creates a set object of `values`.
5440       *
5441       * @private
5442       * @param {Array} values The values to add to the set.
5443       * @returns {Object} Returns the new set.
5444       */
5445      var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
5446        return new Set(values);
5447      };
5448  
5449      /**
5450       * Creates a `_.toPairs` or `_.toPairsIn` function.
5451       *
5452       * @private
5453       * @param {Function} keysFunc The function to get the keys of a given object.
5454       * @returns {Function} Returns the new pairs function.
5455       */
5456      function createToPairs(keysFunc) {
5457        return function(object) {
5458          var tag = getTag(object);
5459          if (tag == mapTag) {
5460            return mapToArray(object);
5461          }
5462          if (tag == setTag) {
5463            return setToPairs(object);
5464          }
5465          return baseToPairs(object, keysFunc(object));
5466        };
5467      }
5468  
5469      /**
5470       * Creates a function that either curries or invokes `func` with optional
5471       * `this` binding and partially applied arguments.
5472       *
5473       * @private
5474       * @param {Function|string} func The function or method name to wrap.
5475       * @param {number} bitmask The bitmask flags.
5476       *    1 - `_.bind`
5477       *    2 - `_.bindKey`
5478       *    4 - `_.curry` or `_.curryRight` of a bound function
5479       *    8 - `_.curry`
5480       *   16 - `_.curryRight`
5481       *   32 - `_.partial`
5482       *   64 - `_.partialRight`
5483       *  128 - `_.rearg`
5484       *  256 - `_.ary`
5485       *  512 - `_.flip`
5486       * @param {*} [thisArg] The `this` binding of `func`.
5487       * @param {Array} [partials] The arguments to be partially applied.
5488       * @param {Array} [holders] The `partials` placeholder indexes.
5489       * @param {Array} [argPos] The argument positions of the new function.
5490       * @param {number} [ary] The arity cap of `func`.
5491       * @param {number} [arity] The arity of `func`.
5492       * @returns {Function} Returns the new wrapped function.
5493       */
5494      function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
5495        var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
5496        if (!isBindKey && typeof func != 'function') {
5497          throw new TypeError(FUNC_ERROR_TEXT);
5498        }
5499        var length = partials ? partials.length : 0;
5500        if (!length) {
5501          bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
5502          partials = holders = undefined;
5503        }
5504        ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
5505        arity = arity === undefined ? arity : toInteger(arity);
5506        length -= holders ? holders.length : 0;
5507  
5508        if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
5509          var partialsRight = partials,
5510              holdersRight = holders;
5511  
5512          partials = holders = undefined;
5513        }
5514        var data = isBindKey ? undefined : getData(func);
5515  
5516        var newData = [
5517          func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
5518          argPos, ary, arity
5519        ];
5520  
5521        if (data) {
5522          mergeData(newData, data);
5523        }
5524        func = newData[0];
5525        bitmask = newData[1];
5526        thisArg = newData[2];
5527        partials = newData[3];
5528        holders = newData[4];
5529        arity = newData[9] = newData[9] === undefined
5530          ? (isBindKey ? 0 : func.length)
5531          : nativeMax(newData[9] - length, 0);
5532  
5533        if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
5534          bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
5535        }
5536        if (!bitmask || bitmask == WRAP_BIND_FLAG) {
5537          var result = createBind(func, bitmask, thisArg);
5538        } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
5539          result = createCurry(func, bitmask, arity);
5540        } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
5541          result = createPartial(func, bitmask, thisArg, partials);
5542        } else {
5543          result = createHybrid.apply(undefined, newData);
5544        }
5545        var setter = data ? baseSetData : setData;
5546        return setWrapToString(setter(result, newData), func, bitmask);
5547      }
5548  
5549      /**
5550       * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
5551       * of source objects to the destination object for all destination properties
5552       * that resolve to `undefined`.
5553       *
5554       * @private
5555       * @param {*} objValue The destination value.
5556       * @param {*} srcValue The source value.
5557       * @param {string} key The key of the property to assign.
5558       * @param {Object} object The parent object of `objValue`.
5559       * @returns {*} Returns the value to assign.
5560       */
5561      function customDefaultsAssignIn(objValue, srcValue, key, object) {
5562        if (objValue === undefined ||
5563            (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
5564          return srcValue;
5565        }
5566        return objValue;
5567      }
5568  
5569      /**
5570       * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
5571       * objects into destination objects that are passed thru.
5572       *
5573       * @private
5574       * @param {*} objValue The destination value.
5575       * @param {*} srcValue The source value.
5576       * @param {string} key The key of the property to merge.
5577       * @param {Object} object The parent object of `objValue`.
5578       * @param {Object} source The parent object of `srcValue`.
5579       * @param {Object} [stack] Tracks traversed source values and their merged
5580       *  counterparts.
5581       * @returns {*} Returns the value to assign.
5582       */
5583      function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
5584        if (isObject(objValue) && isObject(srcValue)) {
5585          // Recursively merge objects and arrays (susceptible to call stack limits).
5586          stack.set(srcValue, objValue);
5587          baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
5588          stack['delete'](srcValue);
5589        }
5590        return objValue;
5591      }
5592  
5593      /**
5594       * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
5595       * objects.
5596       *
5597       * @private
5598       * @param {*} value The value to inspect.
5599       * @param {string} key The key of the property to inspect.
5600       * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
5601       */
5602      function customOmitClone(value) {
5603        return isPlainObject(value) ? undefined : value;
5604      }
5605  
5606      /**
5607       * A specialized version of `baseIsEqualDeep` for arrays with support for
5608       * partial deep comparisons.
5609       *
5610       * @private
5611       * @param {Array} array The array to compare.
5612       * @param {Array} other The other array to compare.
5613       * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5614       * @param {Function} customizer The function to customize comparisons.
5615       * @param {Function} equalFunc The function to determine equivalents of values.
5616       * @param {Object} stack Tracks traversed `array` and `other` objects.
5617       * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
5618       */
5619      function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
5620        var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
5621            arrLength = array.length,
5622            othLength = other.length;
5623  
5624        if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
5625          return false;
5626        }
5627        // Assume cyclic values are equal.
5628        var stacked = stack.get(array);
5629        if (stacked && stack.get(other)) {
5630          return stacked == other;
5631        }
5632        var index = -1,
5633            result = true,
5634            seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
5635  
5636        stack.set(array, other);
5637        stack.set(other, array);
5638  
5639        // Ignore non-index properties.
5640        while (++index < arrLength) {
5641          var arrValue = array[index],
5642              othValue = other[index];
5643  
5644          if (customizer) {
5645            var compared = isPartial
5646              ? customizer(othValue, arrValue, index, other, array, stack)
5647              : customizer(arrValue, othValue, index, array, other, stack);
5648          }
5649          if (compared !== undefined) {
5650            if (compared) {
5651              continue;
5652            }
5653            result = false;
5654            break;
5655          }
5656          // Recursively compare arrays (susceptible to call stack limits).
5657          if (seen) {
5658            if (!arraySome(other, function(othValue, othIndex) {
5659                  if (!cacheHas(seen, othIndex) &&
5660                      (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
5661                    return seen.push(othIndex);
5662                  }
5663                })) {
5664              result = false;
5665              break;
5666            }
5667          } else if (!(
5668                arrValue === othValue ||
5669                  equalFunc(arrValue, othValue, bitmask, customizer, stack)
5670              )) {
5671            result = false;
5672            break;
5673          }
5674        }
5675        stack['delete'](array);
5676        stack['delete'](other);
5677        return result;
5678      }
5679  
5680      /**
5681       * A specialized version of `baseIsEqualDeep` for comparing objects of
5682       * the same `toStringTag`.
5683       *
5684       * **Note:** This function only supports comparing values with tags of
5685       * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
5686       *
5687       * @private
5688       * @param {Object} object The object to compare.
5689       * @param {Object} other The other object to compare.
5690       * @param {string} tag The `toStringTag` of the objects to compare.
5691       * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5692       * @param {Function} customizer The function to customize comparisons.
5693       * @param {Function} equalFunc The function to determine equivalents of values.
5694       * @param {Object} stack Tracks traversed `object` and `other` objects.
5695       * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5696       */
5697      function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
5698        switch (tag) {
5699          case dataViewTag:
5700            if ((object.byteLength != other.byteLength) ||
5701                (object.byteOffset != other.byteOffset)) {
5702              return false;
5703            }
5704            object = object.buffer;
5705            other = other.buffer;
5706  
5707          case arrayBufferTag:
5708            if ((object.byteLength != other.byteLength) ||
5709                !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
5710              return false;
5711            }
5712            return true;
5713  
5714          case boolTag:
5715          case dateTag:
5716          case numberTag:
5717            // Coerce booleans to `1` or `0` and dates to milliseconds.
5718            // Invalid dates are coerced to `NaN`.
5719            return eq(+object, +other);
5720  
5721          case errorTag:
5722            return object.name == other.name && object.message == other.message;
5723  
5724          case regexpTag:
5725          case stringTag:
5726            // Coerce regexes to strings and treat strings, primitives and objects,
5727            // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
5728            // for more details.
5729            return object == (other + '');
5730  
5731          case mapTag:
5732            var convert = mapToArray;
5733  
5734          case setTag:
5735            var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
5736            convert || (convert = setToArray);
5737  
5738            if (object.size != other.size && !isPartial) {
5739              return false;
5740            }
5741            // Assume cyclic values are equal.
5742            var stacked = stack.get(object);
5743            if (stacked) {
5744              return stacked == other;
5745            }
5746            bitmask |= COMPARE_UNORDERED_FLAG;
5747  
5748            // Recursively compare objects (susceptible to call stack limits).
5749            stack.set(object, other);
5750            var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
5751            stack['delete'](object);
5752            return result;
5753  
5754          case symbolTag:
5755            if (symbolValueOf) {
5756              return symbolValueOf.call(object) == symbolValueOf.call(other);
5757            }
5758        }
5759        return false;
5760      }
5761  
5762      /**
5763       * A specialized version of `baseIsEqualDeep` for objects with support for
5764       * partial deep comparisons.
5765       *
5766       * @private
5767       * @param {Object} object The object to compare.
5768       * @param {Object} other The other object to compare.
5769       * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5770       * @param {Function} customizer The function to customize comparisons.
5771       * @param {Function} equalFunc The function to determine equivalents of values.
5772       * @param {Object} stack Tracks traversed `object` and `other` objects.
5773       * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5774       */
5775      function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
5776        var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
5777            objProps = getAllKeys(object),
5778            objLength = objProps.length,
5779            othProps = getAllKeys(other),
5780            othLength = othProps.length;
5781  
5782        if (objLength != othLength && !isPartial) {
5783          return false;
5784        }
5785        var index = objLength;
5786        while (index--) {
5787          var key = objProps[index];
5788          if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
5789            return false;
5790          }
5791        }
5792        // Assume cyclic values are equal.
5793        var stacked = stack.get(object);
5794        if (stacked && stack.get(other)) {
5795          return stacked == other;
5796        }
5797        var result = true;
5798        stack.set(object, other);
5799        stack.set(other, object);
5800  
5801        var skipCtor = isPartial;
5802        while (++index < objLength) {
5803          key = objProps[index];
5804          var objValue = object[key],
5805              othValue = other[key];
5806  
5807          if (customizer) {
5808            var compared = isPartial
5809              ? customizer(othValue, objValue, key, other, object, stack)
5810              : customizer(objValue, othValue, key, object, other, stack);
5811          }
5812          // Recursively compare objects (susceptible to call stack limits).
5813          if (!(compared === undefined
5814                ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
5815                : compared
5816              )) {
5817            result = false;
5818            break;
5819          }
5820          skipCtor || (skipCtor = key == 'constructor');
5821        }
5822        if (result && !skipCtor) {
5823          var objCtor = object.constructor,
5824              othCtor = other.constructor;
5825  
5826          // Non `Object` object instances with different constructors are not equal.
5827          if (objCtor != othCtor &&
5828              ('constructor' in object && 'constructor' in other) &&
5829              !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
5830                typeof othCtor == 'function' && othCtor instanceof othCtor)) {
5831            result = false;
5832          }
5833        }
5834        stack['delete'](object);
5835        stack['delete'](other);
5836        return result;
5837      }
5838  
5839      /**
5840       * A specialized version of `baseRest` which flattens the rest array.
5841       *
5842       * @private
5843       * @param {Function} func The function to apply a rest parameter to.
5844       * @returns {Function} Returns the new function.
5845       */
5846      function flatRest(func) {
5847        return setToString(overRest(func, undefined, flatten), func + '');
5848      }
5849  
5850      /**
5851       * Creates an array of own enumerable property names and symbols of `object`.
5852       *
5853       * @private
5854       * @param {Object} object The object to query.
5855       * @returns {Array} Returns the array of property names and symbols.
5856       */
5857      function getAllKeys(object) {
5858        return baseGetAllKeys(object, keys, getSymbols);
5859      }
5860  
5861      /**
5862       * Creates an array of own and inherited enumerable property names and
5863       * symbols of `object`.
5864       *
5865       * @private
5866       * @param {Object} object The object to query.
5867       * @returns {Array} Returns the array of property names and symbols.
5868       */
5869      function getAllKeysIn(object) {
5870        return baseGetAllKeys(object, keysIn, getSymbolsIn);
5871      }
5872  
5873      /**
5874       * Gets metadata for `func`.
5875       *
5876       * @private
5877       * @param {Function} func The function to query.
5878       * @returns {*} Returns the metadata for `func`.
5879       */
5880      var getData = !metaMap ? noop : function(func) {
5881        return metaMap.get(func);
5882      };
5883  
5884      /**
5885       * Gets the name of `func`.
5886       *
5887       * @private
5888       * @param {Function} func The function to query.
5889       * @returns {string} Returns the function name.
5890       */
5891      function getFuncName(func) {
5892        var result = (func.name + ''),
5893            array = realNames[result],
5894            length = hasOwnProperty.call(realNames, result) ? array.length : 0;
5895  
5896        while (length--) {
5897          var data = array[length],
5898              otherFunc = data.func;
5899          if (otherFunc == null || otherFunc == func) {
5900            return data.name;
5901          }
5902        }
5903        return result;
5904      }
5905  
5906      /**
5907       * Gets the argument placeholder value for `func`.
5908       *
5909       * @private
5910       * @param {Function} func The function to inspect.
5911       * @returns {*} Returns the placeholder value.
5912       */
5913      function getHolder(func) {
5914        var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
5915        return object.placeholder;
5916      }
5917  
5918      /**
5919       * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
5920       * this function returns the custom method, otherwise it returns `baseIteratee`.
5921       * If arguments are provided, the chosen function is invoked with them and
5922       * its result is returned.
5923       *
5924       * @private
5925       * @param {*} [value] The value to convert to an iteratee.
5926       * @param {number} [arity] The arity of the created iteratee.
5927       * @returns {Function} Returns the chosen function or its result.
5928       */
5929      function getIteratee() {
5930        var result = lodash.iteratee || iteratee;
5931        result = result === iteratee ? baseIteratee : result;
5932        return arguments.length ? result(arguments[0], arguments[1]) : result;
5933      }
5934  
5935      /**
5936       * Gets the data for `map`.
5937       *
5938       * @private
5939       * @param {Object} map The map to query.
5940       * @param {string} key The reference key.
5941       * @returns {*} Returns the map data.
5942       */
5943      function getMapData(map, key) {
5944        var data = map.__data__;
5945        return isKeyable(key)
5946          ? data[typeof key == 'string' ? 'string' : 'hash']
5947          : data.map;
5948      }
5949  
5950      /**
5951       * Gets the property names, values, and compare flags of `object`.
5952       *
5953       * @private
5954       * @param {Object} object The object to query.
5955       * @returns {Array} Returns the match data of `object`.
5956       */
5957      function getMatchData(object) {
5958        var result = keys(object),
5959            length = result.length;
5960  
5961        while (length--) {
5962          var key = result[length],
5963              value = object[key];
5964  
5965          result[length] = [key, value, isStrictComparable(value)];
5966        }
5967        return result;
5968      }
5969  
5970      /**
5971       * Gets the native function at `key` of `object`.
5972       *
5973       * @private
5974       * @param {Object} object The object to query.
5975       * @param {string} key The key of the method to get.
5976       * @returns {*} Returns the function if it's native, else `undefined`.
5977       */
5978      function getNative(object, key) {
5979        var value = getValue(object, key);
5980        return baseIsNative(value) ? value : undefined;
5981      }
5982  
5983      /**
5984       * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
5985       *
5986       * @private
5987       * @param {*} value The value to query.
5988       * @returns {string} Returns the raw `toStringTag`.
5989       */
5990      function getRawTag(value) {
5991        var isOwn = hasOwnProperty.call(value, symToStringTag),
5992            tag = value[symToStringTag];
5993  
5994        try {
5995          value[symToStringTag] = undefined;
5996          var unmasked = true;
5997        } catch (e) {}
5998  
5999        var result = nativeObjectToString.call(value);
6000        if (unmasked) {
6001          if (isOwn) {
6002            value[symToStringTag] = tag;
6003          } else {
6004            delete value[symToStringTag];
6005          }
6006        }
6007        return result;
6008      }
6009  
6010      /**
6011       * Creates an array of the own enumerable symbols of `object`.
6012       *
6013       * @private
6014       * @param {Object} object The object to query.
6015       * @returns {Array} Returns the array of symbols.
6016       */
6017      var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
6018        if (object == null) {
6019          return [];
6020        }
6021        object = Object(object);
6022        return arrayFilter(nativeGetSymbols(object), function(symbol) {
6023          return propertyIsEnumerable.call(object, symbol);
6024        });
6025      };
6026  
6027      /**
6028       * Creates an array of the own and inherited enumerable symbols of `object`.
6029       *
6030       * @private
6031       * @param {Object} object The object to query.
6032       * @returns {Array} Returns the array of symbols.
6033       */
6034      var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
6035        var result = [];
6036        while (object) {
6037          arrayPush(result, getSymbols(object));
6038          object = getPrototype(object);
6039        }
6040        return result;
6041      };
6042  
6043      /**
6044       * Gets the `toStringTag` of `value`.
6045       *
6046       * @private
6047       * @param {*} value The value to query.
6048       * @returns {string} Returns the `toStringTag`.
6049       */
6050      var getTag = baseGetTag;
6051  
6052      // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
6053      if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
6054          (Map && getTag(new Map) != mapTag) ||
6055          (Promise && getTag(Promise.resolve()) != promiseTag) ||
6056          (Set && getTag(new Set) != setTag) ||
6057          (WeakMap && getTag(new WeakMap) != weakMapTag)) {
6058        getTag = function(value) {
6059          var result = baseGetTag(value),
6060              Ctor = result == objectTag ? value.constructor : undefined,
6061              ctorString = Ctor ? toSource(Ctor) : '';
6062  
6063          if (ctorString) {
6064            switch (ctorString) {
6065              case dataViewCtorString: return dataViewTag;
6066              case mapCtorString: return mapTag;
6067              case promiseCtorString: return promiseTag;
6068              case setCtorString: return setTag;
6069              case weakMapCtorString: return weakMapTag;
6070            }
6071          }
6072          return result;
6073        };
6074      }
6075  
6076      /**
6077       * Gets the view, applying any `transforms` to the `start` and `end` positions.
6078       *
6079       * @private
6080       * @param {number} start The start of the view.
6081       * @param {number} end The end of the view.
6082       * @param {Array} transforms The transformations to apply to the view.
6083       * @returns {Object} Returns an object containing the `start` and `end`
6084       *  positions of the view.
6085       */
6086      function getView(start, end, transforms) {
6087        var index = -1,
6088            length = transforms.length;
6089  
6090        while (++index < length) {
6091          var data = transforms[index],
6092              size = data.size;
6093  
6094          switch (data.type) {
6095            case 'drop':      start += size; break;
6096            case 'dropRight': end -= size; break;
6097            case 'take':      end = nativeMin(end, start + size); break;
6098            case 'takeRight': start = nativeMax(start, end - size); break;
6099          }
6100        }
6101        return { 'start': start, 'end': end };
6102      }
6103  
6104      /**
6105       * Extracts wrapper details from the `source` body comment.
6106       *
6107       * @private
6108       * @param {string} source The source to inspect.
6109       * @returns {Array} Returns the wrapper details.
6110       */
6111      function getWrapDetails(source) {
6112        var match = source.match(reWrapDetails);
6113        return match ? match[1].split(reSplitDetails) : [];
6114      }
6115  
6116      /**
6117       * Checks if `path` exists on `object`.
6118       *
6119       * @private
6120       * @param {Object} object The object to query.
6121       * @param {Array|string} path The path to check.
6122       * @param {Function} hasFunc The function to check properties.
6123       * @returns {boolean} Returns `true` if `path` exists, else `false`.
6124       */
6125      function hasPath(object, path, hasFunc) {
6126        path = castPath(path, object);
6127  
6128        var index = -1,
6129            length = path.length,
6130            result = false;
6131  
6132        while (++index < length) {
6133          var key = toKey(path[index]);
6134          if (!(result = object != null && hasFunc(object, key))) {
6135            break;
6136          }
6137          object = object[key];
6138        }
6139        if (result || ++index != length) {
6140          return result;
6141        }
6142        length = object == null ? 0 : object.length;
6143        return !!length && isLength(length) && isIndex(key, length) &&
6144          (isArray(object) || isArguments(object));
6145      }
6146  
6147      /**
6148       * Initializes an array clone.
6149       *
6150       * @private
6151       * @param {Array} array The array to clone.
6152       * @returns {Array} Returns the initialized clone.
6153       */
6154      function initCloneArray(array) {
6155        var length = array.length,
6156            result = new array.constructor(length);
6157  
6158        // Add properties assigned by `RegExp#exec`.
6159        if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
6160          result.index = array.index;
6161          result.input = array.input;
6162        }
6163        return result;
6164      }
6165  
6166      /**
6167       * Initializes an object clone.
6168       *
6169       * @private
6170       * @param {Object} object The object to clone.
6171       * @returns {Object} Returns the initialized clone.
6172       */
6173      function initCloneObject(object) {
6174        return (typeof object.constructor == 'function' && !isPrototype(object))
6175          ? baseCreate(getPrototype(object))
6176          : {};
6177      }
6178  
6179      /**
6180       * Initializes an object clone based on its `toStringTag`.
6181       *
6182       * **Note:** This function only supports cloning values with tags of
6183       * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
6184       *
6185       * @private
6186       * @param {Object} object The object to clone.
6187       * @param {string} tag The `toStringTag` of the object to clone.
6188       * @param {boolean} [isDeep] Specify a deep clone.
6189       * @returns {Object} Returns the initialized clone.
6190       */
6191      function initCloneByTag(object, tag, isDeep) {
6192        var Ctor = object.constructor;
6193        switch (tag) {
6194          case arrayBufferTag:
6195            return cloneArrayBuffer(object);
6196  
6197          case boolTag:
6198          case dateTag:
6199            return new Ctor(+object);
6200  
6201          case dataViewTag:
6202            return cloneDataView(object, isDeep);
6203  
6204          case float32Tag: case float64Tag:
6205          case int8Tag: case int16Tag: case int32Tag:
6206          case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
6207            return cloneTypedArray(object, isDeep);
6208  
6209          case mapTag:
6210            return new Ctor;
6211  
6212          case numberTag:
6213          case stringTag:
6214            return new Ctor(object);
6215  
6216          case regexpTag:
6217            return cloneRegExp(object);
6218  
6219          case setTag:
6220            return new Ctor;
6221  
6222          case symbolTag:
6223            return cloneSymbol(object);
6224        }
6225      }
6226  
6227      /**
6228       * Inserts wrapper `details` in a comment at the top of the `source` body.
6229       *
6230       * @private
6231       * @param {string} source The source to modify.
6232       * @returns {Array} details The details to insert.
6233       * @returns {string} Returns the modified source.
6234       */
6235      function insertWrapDetails(source, details) {
6236        var length = details.length;
6237        if (!length) {
6238          return source;
6239        }
6240        var lastIndex = length - 1;
6241        details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
6242        details = details.join(length > 2 ? ', ' : ' ');
6243        return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
6244      }
6245  
6246      /**
6247       * Checks if `value` is a flattenable `arguments` object or array.
6248       *
6249       * @private
6250       * @param {*} value The value to check.
6251       * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
6252       */
6253      function isFlattenable(value) {
6254        return isArray(value) || isArguments(value) ||
6255          !!(spreadableSymbol && value && value[spreadableSymbol]);
6256      }
6257  
6258      /**
6259       * Checks if `value` is a valid array-like index.
6260       *
6261       * @private
6262       * @param {*} value The value to check.
6263       * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
6264       * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
6265       */
6266      function isIndex(value, length) {
6267        var type = typeof value;
6268        length = length == null ? MAX_SAFE_INTEGER : length;
6269  
6270        return !!length &&
6271          (type == 'number' ||
6272            (type != 'symbol' && reIsUint.test(value))) &&
6273              (value > -1 && value % 1 == 0 && value < length);
6274      }
6275  
6276      /**
6277       * Checks if the given arguments are from an iteratee call.
6278       *
6279       * @private
6280       * @param {*} value The potential iteratee value argument.
6281       * @param {*} index The potential iteratee index or key argument.
6282       * @param {*} object The potential iteratee object argument.
6283       * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
6284       *  else `false`.
6285       */
6286      function isIterateeCall(value, index, object) {
6287        if (!isObject(object)) {
6288          return false;
6289        }
6290        var type = typeof index;
6291        if (type == 'number'
6292              ? (isArrayLike(object) && isIndex(index, object.length))
6293              : (type == 'string' && index in object)
6294            ) {
6295          return eq(object[index], value);
6296        }
6297        return false;
6298      }
6299  
6300      /**
6301       * Checks if `value` is a property name and not a property path.
6302       *
6303       * @private
6304       * @param {*} value The value to check.
6305       * @param {Object} [object] The object to query keys on.
6306       * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
6307       */
6308      function isKey(value, object) {
6309        if (isArray(value)) {
6310          return false;
6311        }
6312        var type = typeof value;
6313        if (type == 'number' || type == 'symbol' || type == 'boolean' ||
6314            value == null || isSymbol(value)) {
6315          return true;
6316        }
6317        return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
6318          (object != null && value in Object(object));
6319      }
6320  
6321      /**
6322       * Checks if `value` is suitable for use as unique object key.
6323       *
6324       * @private
6325       * @param {*} value The value to check.
6326       * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
6327       */
6328      function isKeyable(value) {
6329        var type = typeof value;
6330        return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
6331          ? (value !== '__proto__')
6332          : (value === null);
6333      }
6334  
6335      /**
6336       * Checks if `func` has a lazy counterpart.
6337       *
6338       * @private
6339       * @param {Function} func The function to check.
6340       * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
6341       *  else `false`.
6342       */
6343      function isLaziable(func) {
6344        var funcName = getFuncName(func),
6345            other = lodash[funcName];
6346  
6347        if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
6348          return false;
6349        }
6350        if (func === other) {
6351          return true;
6352        }
6353        var data = getData(other);
6354        return !!data && func === data[0];
6355      }
6356  
6357      /**
6358       * Checks if `func` has its source masked.
6359       *
6360       * @private
6361       * @param {Function} func The function to check.
6362       * @returns {boolean} Returns `true` if `func` is masked, else `false`.
6363       */
6364      function isMasked(func) {
6365        return !!maskSrcKey && (maskSrcKey in func);
6366      }
6367  
6368      /**
6369       * Checks if `func` is capable of being masked.
6370       *
6371       * @private
6372       * @param {*} value The value to check.
6373       * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
6374       */
6375      var isMaskable = coreJsData ? isFunction : stubFalse;
6376  
6377      /**
6378       * Checks if `value` is likely a prototype object.
6379       *
6380       * @private
6381       * @param {*} value The value to check.
6382       * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
6383       */
6384      function isPrototype(value) {
6385        var Ctor = value && value.constructor,
6386            proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
6387  
6388        return value === proto;
6389      }
6390  
6391      /**
6392       * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
6393       *
6394       * @private
6395       * @param {*} value The value to check.
6396       * @returns {boolean} Returns `true` if `value` if suitable for strict
6397       *  equality comparisons, else `false`.
6398       */
6399      function isStrictComparable(value) {
6400        return value === value && !isObject(value);
6401      }
6402  
6403      /**
6404       * A specialized version of `matchesProperty` for source values suitable
6405       * for strict equality comparisons, i.e. `===`.
6406       *
6407       * @private
6408       * @param {string} key The key of the property to get.
6409       * @param {*} srcValue The value to match.
6410       * @returns {Function} Returns the new spec function.
6411       */
6412      function matchesStrictComparable(key, srcValue) {
6413        return function(object) {
6414          if (object == null) {
6415            return false;
6416          }
6417          return object[key] === srcValue &&
6418            (srcValue !== undefined || (key in Object(object)));
6419        };
6420      }
6421  
6422      /**
6423       * A specialized version of `_.memoize` which clears the memoized function's
6424       * cache when it exceeds `MAX_MEMOIZE_SIZE`.
6425       *
6426       * @private
6427       * @param {Function} func The function to have its output memoized.
6428       * @returns {Function} Returns the new memoized function.
6429       */
6430      function memoizeCapped(func) {
6431        var result = memoize(func, function(key) {
6432          if (cache.size === MAX_MEMOIZE_SIZE) {
6433            cache.clear();
6434          }
6435          return key;
6436        });
6437  
6438        var cache = result.cache;
6439        return result;
6440      }
6441  
6442      /**
6443       * Merges the function metadata of `source` into `data`.
6444       *
6445       * Merging metadata reduces the number of wrappers used to invoke a function.
6446       * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
6447       * may be applied regardless of execution order. Methods like `_.ary` and
6448       * `_.rearg` modify function arguments, making the order in which they are
6449       * executed important, preventing the merging of metadata. However, we make
6450       * an exception for a safe combined case where curried functions have `_.ary`
6451       * and or `_.rearg` applied.
6452       *
6453       * @private
6454       * @param {Array} data The destination metadata.
6455       * @param {Array} source The source metadata.
6456       * @returns {Array} Returns `data`.
6457       */
6458      function mergeData(data, source) {
6459        var bitmask = data[1],
6460            srcBitmask = source[1],
6461            newBitmask = bitmask | srcBitmask,
6462            isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
6463  
6464        var isCombo =
6465          ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
6466          ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
6467          ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
6468  
6469        // Exit early if metadata can't be merged.
6470        if (!(isCommon || isCombo)) {
6471          return data;
6472        }
6473        // Use source `thisArg` if available.
6474        if (srcBitmask & WRAP_BIND_FLAG) {
6475          data[2] = source[2];
6476          // Set when currying a bound function.
6477          newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
6478        }
6479        // Compose partial arguments.
6480        var value = source[3];
6481        if (value) {
6482          var partials = data[3];
6483          data[3] = partials ? composeArgs(partials, value, source[4]) : value;
6484          data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
6485        }
6486        // Compose partial right arguments.
6487        value = source[5];
6488        if (value) {
6489          partials = data[5];
6490          data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
6491          data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
6492        }
6493        // Use source `argPos` if available.
6494        value = source[7];
6495        if (value) {
6496          data[7] = value;
6497        }
6498        // Use source `ary` if it's smaller.
6499        if (srcBitmask & WRAP_ARY_FLAG) {
6500          data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
6501        }
6502        // Use source `arity` if one is not provided.
6503        if (data[9] == null) {
6504          data[9] = source[9];
6505        }
6506        // Use source `func` and merge bitmasks.
6507        data[0] = source[0];
6508        data[1] = newBitmask;
6509  
6510        return data;
6511      }
6512  
6513      /**
6514       * This function is like
6515       * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
6516       * except that it includes inherited enumerable properties.
6517       *
6518       * @private
6519       * @param {Object} object The object to query.
6520       * @returns {Array} Returns the array of property names.
6521       */
6522      function nativeKeysIn(object) {
6523        var result = [];
6524        if (object != null) {
6525          for (var key in Object(object)) {
6526            result.push(key);
6527          }
6528        }
6529        return result;
6530      }
6531  
6532      /**
6533       * Converts `value` to a string using `Object.prototype.toString`.
6534       *
6535       * @private
6536       * @param {*} value The value to convert.
6537       * @returns {string} Returns the converted string.
6538       */
6539      function objectToString(value) {
6540        return nativeObjectToString.call(value);
6541      }
6542  
6543      /**
6544       * A specialized version of `baseRest` which transforms the rest array.
6545       *
6546       * @private
6547       * @param {Function} func The function to apply a rest parameter to.
6548       * @param {number} [start=func.length-1] The start position of the rest parameter.
6549       * @param {Function} transform The rest array transform.
6550       * @returns {Function} Returns the new function.
6551       */
6552      function overRest(func, start, transform) {
6553        start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
6554        return function() {
6555          var args = arguments,
6556              index = -1,
6557              length = nativeMax(args.length - start, 0),
6558              array = Array(length);
6559  
6560          while (++index < length) {
6561            array[index] = args[start + index];
6562          }
6563          index = -1;
6564          var otherArgs = Array(start + 1);
6565          while (++index < start) {
6566            otherArgs[index] = args[index];
6567          }
6568          otherArgs[start] = transform(array);
6569          return apply(func, this, otherArgs);
6570        };
6571      }
6572  
6573      /**
6574       * Gets the parent value at `path` of `object`.
6575       *
6576       * @private
6577       * @param {Object} object The object to query.
6578       * @param {Array} path The path to get the parent value of.
6579       * @returns {*} Returns the parent value.
6580       */
6581      function parent(object, path) {
6582        return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
6583      }
6584  
6585      /**
6586       * Reorder `array` according to the specified indexes where the element at
6587       * the first index is assigned as the first element, the element at
6588       * the second index is assigned as the second element, and so on.
6589       *
6590       * @private
6591       * @param {Array} array The array to reorder.
6592       * @param {Array} indexes The arranged array indexes.
6593       * @returns {Array} Returns `array`.
6594       */
6595      function reorder(array, indexes) {
6596        var arrLength = array.length,
6597            length = nativeMin(indexes.length, arrLength),
6598            oldArray = copyArray(array);
6599  
6600        while (length--) {
6601          var index = indexes[length];
6602          array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
6603        }
6604        return array;
6605      }
6606  
6607      /**
6608       * Gets the value at `key`, unless `key` is "__proto__".
6609       *
6610       * @private
6611       * @param {Object} object The object to query.
6612       * @param {string} key The key of the property to get.
6613       * @returns {*} Returns the property value.
6614       */
6615      function safeGet(object, key) {
6616        if (key == '__proto__') {
6617          return;
6618        }
6619  
6620        return object[key];
6621      }
6622  
6623      /**
6624       * Sets metadata for `func`.
6625       *
6626       * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
6627       * period of time, it will trip its breaker and transition to an identity
6628       * function to avoid garbage collection pauses in V8. See
6629       * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
6630       * for more details.
6631       *
6632       * @private
6633       * @param {Function} func The function to associate metadata with.
6634       * @param {*} data The metadata.
6635       * @returns {Function} Returns `func`.
6636       */
6637      var setData = shortOut(baseSetData);
6638  
6639      /**
6640       * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
6641       *
6642       * @private
6643       * @param {Function} func The function to delay.
6644       * @param {number} wait The number of milliseconds to delay invocation.
6645       * @returns {number|Object} Returns the timer id or timeout object.
6646       */
6647      var setTimeout = ctxSetTimeout || function(func, wait) {
6648        return root.setTimeout(func, wait);
6649      };
6650  
6651      /**
6652       * Sets the `toString` method of `func` to return `string`.
6653       *
6654       * @private
6655       * @param {Function} func The function to modify.
6656       * @param {Function} string The `toString` result.
6657       * @returns {Function} Returns `func`.
6658       */
6659      var setToString = shortOut(baseSetToString);
6660  
6661      /**
6662       * Sets the `toString` method of `wrapper` to mimic the source of `reference`
6663       * with wrapper details in a comment at the top of the source body.
6664       *
6665       * @private
6666       * @param {Function} wrapper The function to modify.
6667       * @param {Function} reference The reference function.
6668       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6669       * @returns {Function} Returns `wrapper`.
6670       */
6671      function setWrapToString(wrapper, reference, bitmask) {
6672        var source = (reference + '');
6673        return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
6674      }
6675  
6676      /**
6677       * Creates a function that'll short out and invoke `identity` instead
6678       * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
6679       * milliseconds.
6680       *
6681       * @private
6682       * @param {Function} func The function to restrict.
6683       * @returns {Function} Returns the new shortable function.
6684       */
6685      function shortOut(func) {
6686        var count = 0,
6687            lastCalled = 0;
6688  
6689        return function() {
6690          var stamp = nativeNow(),
6691              remaining = HOT_SPAN - (stamp - lastCalled);
6692  
6693          lastCalled = stamp;
6694          if (remaining > 0) {
6695            if (++count >= HOT_COUNT) {
6696              return arguments[0];
6697            }
6698          } else {
6699            count = 0;
6700          }
6701          return func.apply(undefined, arguments);
6702        };
6703      }
6704  
6705      /**
6706       * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
6707       *
6708       * @private
6709       * @param {Array} array The array to shuffle.
6710       * @param {number} [size=array.length] The size of `array`.
6711       * @returns {Array} Returns `array`.
6712       */
6713      function shuffleSelf(array, size) {
6714        var index = -1,
6715            length = array.length,
6716            lastIndex = length - 1;
6717  
6718        size = size === undefined ? length : size;
6719        while (++index < size) {
6720          var rand = baseRandom(index, lastIndex),
6721              value = array[rand];
6722  
6723          array[rand] = array[index];
6724          array[index] = value;
6725        }
6726        array.length = size;
6727        return array;
6728      }
6729  
6730      /**
6731       * Converts `string` to a property path array.
6732       *
6733       * @private
6734       * @param {string} string The string to convert.
6735       * @returns {Array} Returns the property path array.
6736       */
6737      var stringToPath = memoizeCapped(function(string) {
6738        var result = [];
6739        if (string.charCodeAt(0) === 46 /* . */) {
6740          result.push('');
6741        }
6742        string.replace(rePropName, function(match, number, quote, subString) {
6743          result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
6744        });
6745        return result;
6746      });
6747  
6748      /**
6749       * Converts `value` to a string key if it's not a string or symbol.
6750       *
6751       * @private
6752       * @param {*} value The value to inspect.
6753       * @returns {string|symbol} Returns the key.
6754       */
6755      function toKey(value) {
6756        if (typeof value == 'string' || isSymbol(value)) {
6757          return value;
6758        }
6759        var result = (value + '');
6760        return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
6761      }
6762  
6763      /**
6764       * Converts `func` to its source code.
6765       *
6766       * @private
6767       * @param {Function} func The function to convert.
6768       * @returns {string} Returns the source code.
6769       */
6770      function toSource(func) {
6771        if (func != null) {
6772          try {
6773            return funcToString.call(func);
6774          } catch (e) {}
6775          try {
6776            return (func + '');
6777          } catch (e) {}
6778        }
6779        return '';
6780      }
6781  
6782      /**
6783       * Updates wrapper `details` based on `bitmask` flags.
6784       *
6785       * @private
6786       * @returns {Array} details The details to modify.
6787       * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6788       * @returns {Array} Returns `details`.
6789       */
6790      function updateWrapDetails(details, bitmask) {
6791        arrayEach(wrapFlags, function(pair) {
6792          var value = '_.' + pair[0];
6793          if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
6794            details.push(value);
6795          }
6796        });
6797        return details.sort();
6798      }
6799  
6800      /**
6801       * Creates a clone of `wrapper`.
6802       *
6803       * @private
6804       * @param {Object} wrapper The wrapper to clone.
6805       * @returns {Object} Returns the cloned wrapper.
6806       */
6807      function wrapperClone(wrapper) {
6808        if (wrapper instanceof LazyWrapper) {
6809          return wrapper.clone();
6810        }
6811        var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
6812        result.__actions__ = copyArray(wrapper.__actions__);
6813        result.__index__  = wrapper.__index__;
6814        result.__values__ = wrapper.__values__;
6815        return result;
6816      }
6817  
6818      /*------------------------------------------------------------------------*/
6819  
6820      /**
6821       * Creates an array of elements split into groups the length of `size`.
6822       * If `array` can't be split evenly, the final chunk will be the remaining
6823       * elements.
6824       *
6825       * @static
6826       * @memberOf _
6827       * @since 3.0.0
6828       * @category Array
6829       * @param {Array} array The array to process.
6830       * @param {number} [size=1] The length of each chunk
6831       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
6832       * @returns {Array} Returns the new array of chunks.
6833       * @example
6834       *
6835       * _.chunk(['a', 'b', 'c', 'd'], 2);
6836       * // => [['a', 'b'], ['c', 'd']]
6837       *
6838       * _.chunk(['a', 'b', 'c', 'd'], 3);
6839       * // => [['a', 'b', 'c'], ['d']]
6840       */
6841      function chunk(array, size, guard) {
6842        if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
6843          size = 1;
6844        } else {
6845          size = nativeMax(toInteger(size), 0);
6846        }
6847        var length = array == null ? 0 : array.length;
6848        if (!length || size < 1) {
6849          return [];
6850        }
6851        var index = 0,
6852            resIndex = 0,
6853            result = Array(nativeCeil(length / size));
6854  
6855        while (index < length) {
6856          result[resIndex++] = baseSlice(array, index, (index += size));
6857        }
6858        return result;
6859      }
6860  
6861      /**
6862       * Creates an array with all falsey values removed. The values `false`, `null`,
6863       * `0`, `""`, `undefined`, and `NaN` are falsey.
6864       *
6865       * @static
6866       * @memberOf _
6867       * @since 0.1.0
6868       * @category Array
6869       * @param {Array} array The array to compact.
6870       * @returns {Array} Returns the new array of filtered values.
6871       * @example
6872       *
6873       * _.compact([0, 1, false, 2, '', 3]);
6874       * // => [1, 2, 3]
6875       */
6876      function compact(array) {
6877        var index = -1,
6878            length = array == null ? 0 : array.length,
6879            resIndex = 0,
6880            result = [];
6881  
6882        while (++index < length) {
6883          var value = array[index];
6884          if (value) {
6885            result[resIndex++] = value;
6886          }
6887        }
6888        return result;
6889      }
6890  
6891      /**
6892       * Creates a new array concatenating `array` with any additional arrays
6893       * and/or values.
6894       *
6895       * @static
6896       * @memberOf _
6897       * @since 4.0.0
6898       * @category Array
6899       * @param {Array} array The array to concatenate.
6900       * @param {...*} [values] The values to concatenate.
6901       * @returns {Array} Returns the new concatenated array.
6902       * @example
6903       *
6904       * var array = [1];
6905       * var other = _.concat(array, 2, [3], [[4]]);
6906       *
6907       * console.log(other);
6908       * // => [1, 2, 3, [4]]
6909       *
6910       * console.log(array);
6911       * // => [1]
6912       */
6913      function concat() {
6914        var length = arguments.length;
6915        if (!length) {
6916          return [];
6917        }
6918        var args = Array(length - 1),
6919            array = arguments[0],
6920            index = length;
6921  
6922        while (index--) {
6923          args[index - 1] = arguments[index];
6924        }
6925        return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
6926      }
6927  
6928      /**
6929       * Creates an array of `array` values not included in the other given arrays
6930       * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
6931       * for equality comparisons. The order and references of result values are
6932       * determined by the first array.
6933       *
6934       * **Note:** Unlike `_.pullAll`, this method returns a new array.
6935       *
6936       * @static
6937       * @memberOf _
6938       * @since 0.1.0
6939       * @category Array
6940       * @param {Array} array The array to inspect.
6941       * @param {...Array} [values] The values to exclude.
6942       * @returns {Array} Returns the new array of filtered values.
6943       * @see _.without, _.xor
6944       * @example
6945       *
6946       * _.difference([2, 1], [2, 3]);
6947       * // => [1]
6948       */
6949      var difference = baseRest(function(array, values) {
6950        return isArrayLikeObject(array)
6951          ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
6952          : [];
6953      });
6954  
6955      /**
6956       * This method is like `_.difference` except that it accepts `iteratee` which
6957       * is invoked for each element of `array` and `values` to generate the criterion
6958       * by which they're compared. The order and references of result values are
6959       * determined by the first array. The iteratee is invoked with one argument:
6960       * (value).
6961       *
6962       * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
6963       *
6964       * @static
6965       * @memberOf _
6966       * @since 4.0.0
6967       * @category Array
6968       * @param {Array} array The array to inspect.
6969       * @param {...Array} [values] The values to exclude.
6970       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
6971       * @returns {Array} Returns the new array of filtered values.
6972       * @example
6973       *
6974       * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
6975       * // => [1.2]
6976       *
6977       * // The `_.property` iteratee shorthand.
6978       * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
6979       * // => [{ 'x': 2 }]
6980       */
6981      var differenceBy = baseRest(function(array, values) {
6982        var iteratee = last(values);
6983        if (isArrayLikeObject(iteratee)) {
6984          iteratee = undefined;
6985        }
6986        return isArrayLikeObject(array)
6987          ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
6988          : [];
6989      });
6990  
6991      /**
6992       * This method is like `_.difference` except that it accepts `comparator`
6993       * which is invoked to compare elements of `array` to `values`. The order and
6994       * references of result values are determined by the first array. The comparator
6995       * is invoked with two arguments: (arrVal, othVal).
6996       *
6997       * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
6998       *
6999       * @static
7000       * @memberOf _
7001       * @since 4.0.0
7002       * @category Array
7003       * @param {Array} array The array to inspect.
7004       * @param {...Array} [values] The values to exclude.
7005       * @param {Function} [comparator] The comparator invoked per element.
7006       * @returns {Array} Returns the new array of filtered values.
7007       * @example
7008       *
7009       * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
7010       *
7011       * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
7012       * // => [{ 'x': 2, 'y': 1 }]
7013       */
7014      var differenceWith = baseRest(function(array, values) {
7015        var comparator = last(values);
7016        if (isArrayLikeObject(comparator)) {
7017          comparator = undefined;
7018        }
7019        return isArrayLikeObject(array)
7020          ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
7021          : [];
7022      });
7023  
7024      /**
7025       * Creates a slice of `array` with `n` elements dropped from the beginning.
7026       *
7027       * @static
7028       * @memberOf _
7029       * @since 0.5.0
7030       * @category Array
7031       * @param {Array} array The array to query.
7032       * @param {number} [n=1] The number of elements to drop.
7033       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7034       * @returns {Array} Returns the slice of `array`.
7035       * @example
7036       *
7037       * _.drop([1, 2, 3]);
7038       * // => [2, 3]
7039       *
7040       * _.drop([1, 2, 3], 2);
7041       * // => [3]
7042       *
7043       * _.drop([1, 2, 3], 5);
7044       * // => []
7045       *
7046       * _.drop([1, 2, 3], 0);
7047       * // => [1, 2, 3]
7048       */
7049      function drop(array, n, guard) {
7050        var length = array == null ? 0 : array.length;
7051        if (!length) {
7052          return [];
7053        }
7054        n = (guard || n === undefined) ? 1 : toInteger(n);
7055        return baseSlice(array, n < 0 ? 0 : n, length);
7056      }
7057  
7058      /**
7059       * Creates a slice of `array` with `n` elements dropped from the end.
7060       *
7061       * @static
7062       * @memberOf _
7063       * @since 3.0.0
7064       * @category Array
7065       * @param {Array} array The array to query.
7066       * @param {number} [n=1] The number of elements to drop.
7067       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7068       * @returns {Array} Returns the slice of `array`.
7069       * @example
7070       *
7071       * _.dropRight([1, 2, 3]);
7072       * // => [1, 2]
7073       *
7074       * _.dropRight([1, 2, 3], 2);
7075       * // => [1]
7076       *
7077       * _.dropRight([1, 2, 3], 5);
7078       * // => []
7079       *
7080       * _.dropRight([1, 2, 3], 0);
7081       * // => [1, 2, 3]
7082       */
7083      function dropRight(array, n, guard) {
7084        var length = array == null ? 0 : array.length;
7085        if (!length) {
7086          return [];
7087        }
7088        n = (guard || n === undefined) ? 1 : toInteger(n);
7089        n = length - n;
7090        return baseSlice(array, 0, n < 0 ? 0 : n);
7091      }
7092  
7093      /**
7094       * Creates a slice of `array` excluding elements dropped from the end.
7095       * Elements are dropped until `predicate` returns falsey. The predicate is
7096       * invoked with three arguments: (value, index, array).
7097       *
7098       * @static
7099       * @memberOf _
7100       * @since 3.0.0
7101       * @category Array
7102       * @param {Array} array The array to query.
7103       * @param {Function} [predicate=_.identity] The function invoked per iteration.
7104       * @returns {Array} Returns the slice of `array`.
7105       * @example
7106       *
7107       * var users = [
7108       *   { 'user': 'barney',  'active': true },
7109       *   { 'user': 'fred',    'active': false },
7110       *   { 'user': 'pebbles', 'active': false }
7111       * ];
7112       *
7113       * _.dropRightWhile(users, function(o) { return !o.active; });
7114       * // => objects for ['barney']
7115       *
7116       * // The `_.matches` iteratee shorthand.
7117       * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
7118       * // => objects for ['barney', 'fred']
7119       *
7120       * // The `_.matchesProperty` iteratee shorthand.
7121       * _.dropRightWhile(users, ['active', false]);
7122       * // => objects for ['barney']
7123       *
7124       * // The `_.property` iteratee shorthand.
7125       * _.dropRightWhile(users, 'active');
7126       * // => objects for ['barney', 'fred', 'pebbles']
7127       */
7128      function dropRightWhile(array, predicate) {
7129        return (array && array.length)
7130          ? baseWhile(array, getIteratee(predicate, 3), true, true)
7131          : [];
7132      }
7133  
7134      /**
7135       * Creates a slice of `array` excluding elements dropped from the beginning.
7136       * Elements are dropped until `predicate` returns falsey. The predicate is
7137       * invoked with three arguments: (value, index, array).
7138       *
7139       * @static
7140       * @memberOf _
7141       * @since 3.0.0
7142       * @category Array
7143       * @param {Array} array The array to query.
7144       * @param {Function} [predicate=_.identity] The function invoked per iteration.
7145       * @returns {Array} Returns the slice of `array`.
7146       * @example
7147       *
7148       * var users = [
7149       *   { 'user': 'barney',  'active': false },
7150       *   { 'user': 'fred',    'active': false },
7151       *   { 'user': 'pebbles', 'active': true }
7152       * ];
7153       *
7154       * _.dropWhile(users, function(o) { return !o.active; });
7155       * // => objects for ['pebbles']
7156       *
7157       * // The `_.matches` iteratee shorthand.
7158       * _.dropWhile(users, { 'user': 'barney', 'active': false });
7159       * // => objects for ['fred', 'pebbles']
7160       *
7161       * // The `_.matchesProperty` iteratee shorthand.
7162       * _.dropWhile(users, ['active', false]);
7163       * // => objects for ['pebbles']
7164       *
7165       * // The `_.property` iteratee shorthand.
7166       * _.dropWhile(users, 'active');
7167       * // => objects for ['barney', 'fred', 'pebbles']
7168       */
7169      function dropWhile(array, predicate) {
7170        return (array && array.length)
7171          ? baseWhile(array, getIteratee(predicate, 3), true)
7172          : [];
7173      }
7174  
7175      /**
7176       * Fills elements of `array` with `value` from `start` up to, but not
7177       * including, `end`.
7178       *
7179       * **Note:** This method mutates `array`.
7180       *
7181       * @static
7182       * @memberOf _
7183       * @since 3.2.0
7184       * @category Array
7185       * @param {Array} array The array to fill.
7186       * @param {*} value The value to fill `array` with.
7187       * @param {number} [start=0] The start position.
7188       * @param {number} [end=array.length] The end position.
7189       * @returns {Array} Returns `array`.
7190       * @example
7191       *
7192       * var array = [1, 2, 3];
7193       *
7194       * _.fill(array, 'a');
7195       * console.log(array);
7196       * // => ['a', 'a', 'a']
7197       *
7198       * _.fill(Array(3), 2);
7199       * // => [2, 2, 2]
7200       *
7201       * _.fill([4, 6, 8, 10], '*', 1, 3);
7202       * // => [4, '*', '*', 10]
7203       */
7204      function fill(array, value, start, end) {
7205        var length = array == null ? 0 : array.length;
7206        if (!length) {
7207          return [];
7208        }
7209        if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
7210          start = 0;
7211          end = length;
7212        }
7213        return baseFill(array, value, start, end);
7214      }
7215  
7216      /**
7217       * This method is like `_.find` except that it returns the index of the first
7218       * element `predicate` returns truthy for instead of the element itself.
7219       *
7220       * @static
7221       * @memberOf _
7222       * @since 1.1.0
7223       * @category Array
7224       * @param {Array} array The array to inspect.
7225       * @param {Function} [predicate=_.identity] The function invoked per iteration.
7226       * @param {number} [fromIndex=0] The index to search from.
7227       * @returns {number} Returns the index of the found element, else `-1`.
7228       * @example
7229       *
7230       * var users = [
7231       *   { 'user': 'barney',  'active': false },
7232       *   { 'user': 'fred',    'active': false },
7233       *   { 'user': 'pebbles', 'active': true }
7234       * ];
7235       *
7236       * _.findIndex(users, function(o) { return o.user == 'barney'; });
7237       * // => 0
7238       *
7239       * // The `_.matches` iteratee shorthand.
7240       * _.findIndex(users, { 'user': 'fred', 'active': false });
7241       * // => 1
7242       *
7243       * // The `_.matchesProperty` iteratee shorthand.
7244       * _.findIndex(users, ['active', false]);
7245       * // => 0
7246       *
7247       * // The `_.property` iteratee shorthand.
7248       * _.findIndex(users, 'active');
7249       * // => 2
7250       */
7251      function findIndex(array, predicate, fromIndex) {
7252        var length = array == null ? 0 : array.length;
7253        if (!length) {
7254          return -1;
7255        }
7256        var index = fromIndex == null ? 0 : toInteger(fromIndex);
7257        if (index < 0) {
7258          index = nativeMax(length + index, 0);
7259        }
7260        return baseFindIndex(array, getIteratee(predicate, 3), index);
7261      }
7262  
7263      /**
7264       * This method is like `_.findIndex` except that it iterates over elements
7265       * of `collection` from right to left.
7266       *
7267       * @static
7268       * @memberOf _
7269       * @since 2.0.0
7270       * @category Array
7271       * @param {Array} array The array to inspect.
7272       * @param {Function} [predicate=_.identity] The function invoked per iteration.
7273       * @param {number} [fromIndex=array.length-1] The index to search from.
7274       * @returns {number} Returns the index of the found element, else `-1`.
7275       * @example
7276       *
7277       * var users = [
7278       *   { 'user': 'barney',  'active': true },
7279       *   { 'user': 'fred',    'active': false },
7280       *   { 'user': 'pebbles', 'active': false }
7281       * ];
7282       *
7283       * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
7284       * // => 2
7285       *
7286       * // The `_.matches` iteratee shorthand.
7287       * _.findLastIndex(users, { 'user': 'barney', 'active': true });
7288       * // => 0
7289       *
7290       * // The `_.matchesProperty` iteratee shorthand.
7291       * _.findLastIndex(users, ['active', false]);
7292       * // => 2
7293       *
7294       * // The `_.property` iteratee shorthand.
7295       * _.findLastIndex(users, 'active');
7296       * // => 0
7297       */
7298      function findLastIndex(array, predicate, fromIndex) {
7299        var length = array == null ? 0 : array.length;
7300        if (!length) {
7301          return -1;
7302        }
7303        var index = length - 1;
7304        if (fromIndex !== undefined) {
7305          index = toInteger(fromIndex);
7306          index = fromIndex < 0
7307            ? nativeMax(length + index, 0)
7308            : nativeMin(index, length - 1);
7309        }
7310        return baseFindIndex(array, getIteratee(predicate, 3), index, true);
7311      }
7312  
7313      /**
7314       * Flattens `array` a single level deep.
7315       *
7316       * @static
7317       * @memberOf _
7318       * @since 0.1.0
7319       * @category Array
7320       * @param {Array} array The array to flatten.
7321       * @returns {Array} Returns the new flattened array.
7322       * @example
7323       *
7324       * _.flatten([1, [2, [3, [4]], 5]]);
7325       * // => [1, 2, [3, [4]], 5]
7326       */
7327      function flatten(array) {
7328        var length = array == null ? 0 : array.length;
7329        return length ? baseFlatten(array, 1) : [];
7330      }
7331  
7332      /**
7333       * Recursively flattens `array`.
7334       *
7335       * @static
7336       * @memberOf _
7337       * @since 3.0.0
7338       * @category Array
7339       * @param {Array} array The array to flatten.
7340       * @returns {Array} Returns the new flattened array.
7341       * @example
7342       *
7343       * _.flattenDeep([1, [2, [3, [4]], 5]]);
7344       * // => [1, 2, 3, 4, 5]
7345       */
7346      function flattenDeep(array) {
7347        var length = array == null ? 0 : array.length;
7348        return length ? baseFlatten(array, INFINITY) : [];
7349      }
7350  
7351      /**
7352       * Recursively flatten `array` up to `depth` times.
7353       *
7354       * @static
7355       * @memberOf _
7356       * @since 4.4.0
7357       * @category Array
7358       * @param {Array} array The array to flatten.
7359       * @param {number} [depth=1] The maximum recursion depth.
7360       * @returns {Array} Returns the new flattened array.
7361       * @example
7362       *
7363       * var array = [1, [2, [3, [4]], 5]];
7364       *
7365       * _.flattenDepth(array, 1);
7366       * // => [1, 2, [3, [4]], 5]
7367       *
7368       * _.flattenDepth(array, 2);
7369       * // => [1, 2, 3, [4], 5]
7370       */
7371      function flattenDepth(array, depth) {
7372        var length = array == null ? 0 : array.length;
7373        if (!length) {
7374          return [];
7375        }
7376        depth = depth === undefined ? 1 : toInteger(depth);
7377        return baseFlatten(array, depth);
7378      }
7379  
7380      /**
7381       * The inverse of `_.toPairs`; this method returns an object composed
7382       * from key-value `pairs`.
7383       *
7384       * @static
7385       * @memberOf _
7386       * @since 4.0.0
7387       * @category Array
7388       * @param {Array} pairs The key-value pairs.
7389       * @returns {Object} Returns the new object.
7390       * @example
7391       *
7392       * _.fromPairs([['a', 1], ['b', 2]]);
7393       * // => { 'a': 1, 'b': 2 }
7394       */
7395      function fromPairs(pairs) {
7396        var index = -1,
7397            length = pairs == null ? 0 : pairs.length,
7398            result = {};
7399  
7400        while (++index < length) {
7401          var pair = pairs[index];
7402          result[pair[0]] = pair[1];
7403        }
7404        return result;
7405      }
7406  
7407      /**
7408       * Gets the first element of `array`.
7409       *
7410       * @static
7411       * @memberOf _
7412       * @since 0.1.0
7413       * @alias first
7414       * @category Array
7415       * @param {Array} array The array to query.
7416       * @returns {*} Returns the first element of `array`.
7417       * @example
7418       *
7419       * _.head([1, 2, 3]);
7420       * // => 1
7421       *
7422       * _.head([]);
7423       * // => undefined
7424       */
7425      function head(array) {
7426        return (array && array.length) ? array[0] : undefined;
7427      }
7428  
7429      /**
7430       * Gets the index at which the first occurrence of `value` is found in `array`
7431       * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7432       * for equality comparisons. If `fromIndex` is negative, it's used as the
7433       * offset from the end of `array`.
7434       *
7435       * @static
7436       * @memberOf _
7437       * @since 0.1.0
7438       * @category Array
7439       * @param {Array} array The array to inspect.
7440       * @param {*} value The value to search for.
7441       * @param {number} [fromIndex=0] The index to search from.
7442       * @returns {number} Returns the index of the matched value, else `-1`.
7443       * @example
7444       *
7445       * _.indexOf([1, 2, 1, 2], 2);
7446       * // => 1
7447       *
7448       * // Search from the `fromIndex`.
7449       * _.indexOf([1, 2, 1, 2], 2, 2);
7450       * // => 3
7451       */
7452      function indexOf(array, value, fromIndex) {
7453        var length = array == null ? 0 : array.length;
7454        if (!length) {
7455          return -1;
7456        }
7457        var index = fromIndex == null ? 0 : toInteger(fromIndex);
7458        if (index < 0) {
7459          index = nativeMax(length + index, 0);
7460        }
7461        return baseIndexOf(array, value, index);
7462      }
7463  
7464      /**
7465       * Gets all but the last element of `array`.
7466       *
7467       * @static
7468       * @memberOf _
7469       * @since 0.1.0
7470       * @category Array
7471       * @param {Array} array The array to query.
7472       * @returns {Array} Returns the slice of `array`.
7473       * @example
7474       *
7475       * _.initial([1, 2, 3]);
7476       * // => [1, 2]
7477       */
7478      function initial(array) {
7479        var length = array == null ? 0 : array.length;
7480        return length ? baseSlice(array, 0, -1) : [];
7481      }
7482  
7483      /**
7484       * Creates an array of unique values that are included in all given arrays
7485       * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7486       * for equality comparisons. The order and references of result values are
7487       * determined by the first array.
7488       *
7489       * @static
7490       * @memberOf _
7491       * @since 0.1.0
7492       * @category Array
7493       * @param {...Array} [arrays] The arrays to inspect.
7494       * @returns {Array} Returns the new array of intersecting values.
7495       * @example
7496       *
7497       * _.intersection([2, 1], [2, 3]);
7498       * // => [2]
7499       */
7500      var intersection = baseRest(function(arrays) {
7501        var mapped = arrayMap(arrays, castArrayLikeObject);
7502        return (mapped.length && mapped[0] === arrays[0])
7503          ? baseIntersection(mapped)
7504          : [];
7505      });
7506  
7507      /**
7508       * This method is like `_.intersection` except that it accepts `iteratee`
7509       * which is invoked for each element of each `arrays` to generate the criterion
7510       * by which they're compared. The order and references of result values are
7511       * determined by the first array. The iteratee is invoked with one argument:
7512       * (value).
7513       *
7514       * @static
7515       * @memberOf _
7516       * @since 4.0.0
7517       * @category Array
7518       * @param {...Array} [arrays] The arrays to inspect.
7519       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7520       * @returns {Array} Returns the new array of intersecting values.
7521       * @example
7522       *
7523       * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
7524       * // => [2.1]
7525       *
7526       * // The `_.property` iteratee shorthand.
7527       * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
7528       * // => [{ 'x': 1 }]
7529       */
7530      var intersectionBy = baseRest(function(arrays) {
7531        var iteratee = last(arrays),
7532            mapped = arrayMap(arrays, castArrayLikeObject);
7533  
7534        if (iteratee === last(mapped)) {
7535          iteratee = undefined;
7536        } else {
7537          mapped.pop();
7538        }
7539        return (mapped.length && mapped[0] === arrays[0])
7540          ? baseIntersection(mapped, getIteratee(iteratee, 2))
7541          : [];
7542      });
7543  
7544      /**
7545       * This method is like `_.intersection` except that it accepts `comparator`
7546       * which is invoked to compare elements of `arrays`. The order and references
7547       * of result values are determined by the first array. The comparator is
7548       * invoked with two arguments: (arrVal, othVal).
7549       *
7550       * @static
7551       * @memberOf _
7552       * @since 4.0.0
7553       * @category Array
7554       * @param {...Array} [arrays] The arrays to inspect.
7555       * @param {Function} [comparator] The comparator invoked per element.
7556       * @returns {Array} Returns the new array of intersecting values.
7557       * @example
7558       *
7559       * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
7560       * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
7561       *
7562       * _.intersectionWith(objects, others, _.isEqual);
7563       * // => [{ 'x': 1, 'y': 2 }]
7564       */
7565      var intersectionWith = baseRest(function(arrays) {
7566        var comparator = last(arrays),
7567            mapped = arrayMap(arrays, castArrayLikeObject);
7568  
7569        comparator = typeof comparator == 'function' ? comparator : undefined;
7570        if (comparator) {
7571          mapped.pop();
7572        }
7573        return (mapped.length && mapped[0] === arrays[0])
7574          ? baseIntersection(mapped, undefined, comparator)
7575          : [];
7576      });
7577  
7578      /**
7579       * Converts all elements in `array` into a string separated by `separator`.
7580       *
7581       * @static
7582       * @memberOf _
7583       * @since 4.0.0
7584       * @category Array
7585       * @param {Array} array The array to convert.
7586       * @param {string} [separator=','] The element separator.
7587       * @returns {string} Returns the joined string.
7588       * @example
7589       *
7590       * _.join(['a', 'b', 'c'], '~');
7591       * // => 'a~b~c'
7592       */
7593      function join(array, separator) {
7594        return array == null ? '' : nativeJoin.call(array, separator);
7595      }
7596  
7597      /**
7598       * Gets the last element of `array`.
7599       *
7600       * @static
7601       * @memberOf _
7602       * @since 0.1.0
7603       * @category Array
7604       * @param {Array} array The array to query.
7605       * @returns {*} Returns the last element of `array`.
7606       * @example
7607       *
7608       * _.last([1, 2, 3]);
7609       * // => 3
7610       */
7611      function last(array) {
7612        var length = array == null ? 0 : array.length;
7613        return length ? array[length - 1] : undefined;
7614      }
7615  
7616      /**
7617       * This method is like `_.indexOf` except that it iterates over elements of
7618       * `array` from right to left.
7619       *
7620       * @static
7621       * @memberOf _
7622       * @since 0.1.0
7623       * @category Array
7624       * @param {Array} array The array to inspect.
7625       * @param {*} value The value to search for.
7626       * @param {number} [fromIndex=array.length-1] The index to search from.
7627       * @returns {number} Returns the index of the matched value, else `-1`.
7628       * @example
7629       *
7630       * _.lastIndexOf([1, 2, 1, 2], 2);
7631       * // => 3
7632       *
7633       * // Search from the `fromIndex`.
7634       * _.lastIndexOf([1, 2, 1, 2], 2, 2);
7635       * // => 1
7636       */
7637      function lastIndexOf(array, value, fromIndex) {
7638        var length = array == null ? 0 : array.length;
7639        if (!length) {
7640          return -1;
7641        }
7642        var index = length;
7643        if (fromIndex !== undefined) {
7644          index = toInteger(fromIndex);
7645          index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
7646        }
7647        return value === value
7648          ? strictLastIndexOf(array, value, index)
7649          : baseFindIndex(array, baseIsNaN, index, true);
7650      }
7651  
7652      /**
7653       * Gets the element at index `n` of `array`. If `n` is negative, the nth
7654       * element from the end is returned.
7655       *
7656       * @static
7657       * @memberOf _
7658       * @since 4.11.0
7659       * @category Array
7660       * @param {Array} array The array to query.
7661       * @param {number} [n=0] The index of the element to return.
7662       * @returns {*} Returns the nth element of `array`.
7663       * @example
7664       *
7665       * var array = ['a', 'b', 'c', 'd'];
7666       *
7667       * _.nth(array, 1);
7668       * // => 'b'
7669       *
7670       * _.nth(array, -2);
7671       * // => 'c';
7672       */
7673      function nth(array, n) {
7674        return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
7675      }
7676  
7677      /**
7678       * Removes all given values from `array` using
7679       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7680       * for equality comparisons.
7681       *
7682       * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
7683       * to remove elements from an array by predicate.
7684       *
7685       * @static
7686       * @memberOf _
7687       * @since 2.0.0
7688       * @category Array
7689       * @param {Array} array The array to modify.
7690       * @param {...*} [values] The values to remove.
7691       * @returns {Array} Returns `array`.
7692       * @example
7693       *
7694       * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
7695       *
7696       * _.pull(array, 'a', 'c');
7697       * console.log(array);
7698       * // => ['b', 'b']
7699       */
7700      var pull = baseRest(pullAll);
7701  
7702      /**
7703       * This method is like `_.pull` except that it accepts an array of values to remove.
7704       *
7705       * **Note:** Unlike `_.difference`, this method mutates `array`.
7706       *
7707       * @static
7708       * @memberOf _
7709       * @since 4.0.0
7710       * @category Array
7711       * @param {Array} array The array to modify.
7712       * @param {Array} values The values to remove.
7713       * @returns {Array} Returns `array`.
7714       * @example
7715       *
7716       * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
7717       *
7718       * _.pullAll(array, ['a', 'c']);
7719       * console.log(array);
7720       * // => ['b', 'b']
7721       */
7722      function pullAll(array, values) {
7723        return (array && array.length && values && values.length)
7724          ? basePullAll(array, values)
7725          : array;
7726      }
7727  
7728      /**
7729       * This method is like `_.pullAll` except that it accepts `iteratee` which is
7730       * invoked for each element of `array` and `values` to generate the criterion
7731       * by which they're compared. The iteratee is invoked with one argument: (value).
7732       *
7733       * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
7734       *
7735       * @static
7736       * @memberOf _
7737       * @since 4.0.0
7738       * @category Array
7739       * @param {Array} array The array to modify.
7740       * @param {Array} values The values to remove.
7741       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7742       * @returns {Array} Returns `array`.
7743       * @example
7744       *
7745       * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
7746       *
7747       * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
7748       * console.log(array);
7749       * // => [{ 'x': 2 }]
7750       */
7751      function pullAllBy(array, values, iteratee) {
7752        return (array && array.length && values && values.length)
7753          ? basePullAll(array, values, getIteratee(iteratee, 2))
7754          : array;
7755      }
7756  
7757      /**
7758       * This method is like `_.pullAll` except that it accepts `comparator` which
7759       * is invoked to compare elements of `array` to `values`. The comparator is
7760       * invoked with two arguments: (arrVal, othVal).
7761       *
7762       * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
7763       *
7764       * @static
7765       * @memberOf _
7766       * @since 4.6.0
7767       * @category Array
7768       * @param {Array} array The array to modify.
7769       * @param {Array} values The values to remove.
7770       * @param {Function} [comparator] The comparator invoked per element.
7771       * @returns {Array} Returns `array`.
7772       * @example
7773       *
7774       * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
7775       *
7776       * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
7777       * console.log(array);
7778       * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
7779       */
7780      function pullAllWith(array, values, comparator) {
7781        return (array && array.length && values && values.length)
7782          ? basePullAll(array, values, undefined, comparator)
7783          : array;
7784      }
7785  
7786      /**
7787       * Removes elements from `array` corresponding to `indexes` and returns an
7788       * array of removed elements.
7789       *
7790       * **Note:** Unlike `_.at`, this method mutates `array`.
7791       *
7792       * @static
7793       * @memberOf _
7794       * @since 3.0.0
7795       * @category Array
7796       * @param {Array} array The array to modify.
7797       * @param {...(number|number[])} [indexes] The indexes of elements to remove.
7798       * @returns {Array} Returns the new array of removed elements.
7799       * @example
7800       *
7801       * var array = ['a', 'b', 'c', 'd'];
7802       * var pulled = _.pullAt(array, [1, 3]);
7803       *
7804       * console.log(array);
7805       * // => ['a', 'c']
7806       *
7807       * console.log(pulled);
7808       * // => ['b', 'd']
7809       */
7810      var pullAt = flatRest(function(array, indexes) {
7811        var length = array == null ? 0 : array.length,
7812            result = baseAt(array, indexes);
7813  
7814        basePullAt(array, arrayMap(indexes, function(index) {
7815          return isIndex(index, length) ? +index : index;
7816        }).sort(compareAscending));
7817  
7818        return result;
7819      });
7820  
7821      /**
7822       * Removes all elements from `array` that `predicate` returns truthy for
7823       * and returns an array of the removed elements. The predicate is invoked
7824       * with three arguments: (value, index, array).
7825       *
7826       * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
7827       * to pull elements from an array by value.
7828       *
7829       * @static
7830       * @memberOf _
7831       * @since 2.0.0
7832       * @category Array
7833       * @param {Array} array The array to modify.
7834       * @param {Function} [predicate=_.identity] The function invoked per iteration.
7835       * @returns {Array} Returns the new array of removed elements.
7836       * @example
7837       *
7838       * var array = [1, 2, 3, 4];
7839       * var evens = _.remove(array, function(n) {
7840       *   return n % 2 == 0;
7841       * });
7842       *
7843       * console.log(array);
7844       * // => [1, 3]
7845       *
7846       * console.log(evens);
7847       * // => [2, 4]
7848       */
7849      function remove(array, predicate) {
7850        var result = [];
7851        if (!(array && array.length)) {
7852          return result;
7853        }
7854        var index = -1,
7855            indexes = [],
7856            length = array.length;
7857  
7858        predicate = getIteratee(predicate, 3);
7859        while (++index < length) {
7860          var value = array[index];
7861          if (predicate(value, index, array)) {
7862            result.push(value);
7863            indexes.push(index);
7864          }
7865        }
7866        basePullAt(array, indexes);
7867        return result;
7868      }
7869  
7870      /**
7871       * Reverses `array` so that the first element becomes the last, the second
7872       * element becomes the second to last, and so on.
7873       *
7874       * **Note:** This method mutates `array` and is based on
7875       * [`Array#reverse`](https://mdn.io/Array/reverse).
7876       *
7877       * @static
7878       * @memberOf _
7879       * @since 4.0.0
7880       * @category Array
7881       * @param {Array} array The array to modify.
7882       * @returns {Array} Returns `array`.
7883       * @example
7884       *
7885       * var array = [1, 2, 3];
7886       *
7887       * _.reverse(array);
7888       * // => [3, 2, 1]
7889       *
7890       * console.log(array);
7891       * // => [3, 2, 1]
7892       */
7893      function reverse(array) {
7894        return array == null ? array : nativeReverse.call(array);
7895      }
7896  
7897      /**
7898       * Creates a slice of `array` from `start` up to, but not including, `end`.
7899       *
7900       * **Note:** This method is used instead of
7901       * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
7902       * returned.
7903       *
7904       * @static
7905       * @memberOf _
7906       * @since 3.0.0
7907       * @category Array
7908       * @param {Array} array The array to slice.
7909       * @param {number} [start=0] The start position.
7910       * @param {number} [end=array.length] The end position.
7911       * @returns {Array} Returns the slice of `array`.
7912       */
7913      function slice(array, start, end) {
7914        var length = array == null ? 0 : array.length;
7915        if (!length) {
7916          return [];
7917        }
7918        if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
7919          start = 0;
7920          end = length;
7921        }
7922        else {
7923          start = start == null ? 0 : toInteger(start);
7924          end = end === undefined ? length : toInteger(end);
7925        }
7926        return baseSlice(array, start, end);
7927      }
7928  
7929      /**
7930       * Uses a binary search to determine the lowest index at which `value`
7931       * should be inserted into `array` in order to maintain its sort order.
7932       *
7933       * @static
7934       * @memberOf _
7935       * @since 0.1.0
7936       * @category Array
7937       * @param {Array} array The sorted array to inspect.
7938       * @param {*} value The value to evaluate.
7939       * @returns {number} Returns the index at which `value` should be inserted
7940       *  into `array`.
7941       * @example
7942       *
7943       * _.sortedIndex([30, 50], 40);
7944       * // => 1
7945       */
7946      function sortedIndex(array, value) {
7947        return baseSortedIndex(array, value);
7948      }
7949  
7950      /**
7951       * This method is like `_.sortedIndex` except that it accepts `iteratee`
7952       * which is invoked for `value` and each element of `array` to compute their
7953       * sort ranking. The iteratee is invoked with one argument: (value).
7954       *
7955       * @static
7956       * @memberOf _
7957       * @since 4.0.0
7958       * @category Array
7959       * @param {Array} array The sorted array to inspect.
7960       * @param {*} value The value to evaluate.
7961       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7962       * @returns {number} Returns the index at which `value` should be inserted
7963       *  into `array`.
7964       * @example
7965       *
7966       * var objects = [{ 'x': 4 }, { 'x': 5 }];
7967       *
7968       * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
7969       * // => 0
7970       *
7971       * // The `_.property` iteratee shorthand.
7972       * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
7973       * // => 0
7974       */
7975      function sortedIndexBy(array, value, iteratee) {
7976        return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
7977      }
7978  
7979      /**
7980       * This method is like `_.indexOf` except that it performs a binary
7981       * search on a sorted `array`.
7982       *
7983       * @static
7984       * @memberOf _
7985       * @since 4.0.0
7986       * @category Array
7987       * @param {Array} array The array to inspect.
7988       * @param {*} value The value to search for.
7989       * @returns {number} Returns the index of the matched value, else `-1`.
7990       * @example
7991       *
7992       * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
7993       * // => 1
7994       */
7995      function sortedIndexOf(array, value) {
7996        var length = array == null ? 0 : array.length;
7997        if (length) {
7998          var index = baseSortedIndex(array, value);
7999          if (index < length && eq(array[index], value)) {
8000            return index;
8001          }
8002        }
8003        return -1;
8004      }
8005  
8006      /**
8007       * This method is like `_.sortedIndex` except that it returns the highest
8008       * index at which `value` should be inserted into `array` in order to
8009       * maintain its sort order.
8010       *
8011       * @static
8012       * @memberOf _
8013       * @since 3.0.0
8014       * @category Array
8015       * @param {Array} array The sorted array to inspect.
8016       * @param {*} value The value to evaluate.
8017       * @returns {number} Returns the index at which `value` should be inserted
8018       *  into `array`.
8019       * @example
8020       *
8021       * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
8022       * // => 4
8023       */
8024      function sortedLastIndex(array, value) {
8025        return baseSortedIndex(array, value, true);
8026      }
8027  
8028      /**
8029       * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
8030       * which is invoked for `value` and each element of `array` to compute their
8031       * sort ranking. The iteratee is invoked with one argument: (value).
8032       *
8033       * @static
8034       * @memberOf _
8035       * @since 4.0.0
8036       * @category Array
8037       * @param {Array} array The sorted array to inspect.
8038       * @param {*} value The value to evaluate.
8039       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8040       * @returns {number} Returns the index at which `value` should be inserted
8041       *  into `array`.
8042       * @example
8043       *
8044       * var objects = [{ 'x': 4 }, { 'x': 5 }];
8045       *
8046       * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
8047       * // => 1
8048       *
8049       * // The `_.property` iteratee shorthand.
8050       * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
8051       * // => 1
8052       */
8053      function sortedLastIndexBy(array, value, iteratee) {
8054        return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
8055      }
8056  
8057      /**
8058       * This method is like `_.lastIndexOf` except that it performs a binary
8059       * search on a sorted `array`.
8060       *
8061       * @static
8062       * @memberOf _
8063       * @since 4.0.0
8064       * @category Array
8065       * @param {Array} array The array to inspect.
8066       * @param {*} value The value to search for.
8067       * @returns {number} Returns the index of the matched value, else `-1`.
8068       * @example
8069       *
8070       * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
8071       * // => 3
8072       */
8073      function sortedLastIndexOf(array, value) {
8074        var length = array == null ? 0 : array.length;
8075        if (length) {
8076          var index = baseSortedIndex(array, value, true) - 1;
8077          if (eq(array[index], value)) {
8078            return index;
8079          }
8080        }
8081        return -1;
8082      }
8083  
8084      /**
8085       * This method is like `_.uniq` except that it's designed and optimized
8086       * for sorted arrays.
8087       *
8088       * @static
8089       * @memberOf _
8090       * @since 4.0.0
8091       * @category Array
8092       * @param {Array} array The array to inspect.
8093       * @returns {Array} Returns the new duplicate free array.
8094       * @example
8095       *
8096       * _.sortedUniq([1, 1, 2]);
8097       * // => [1, 2]
8098       */
8099      function sortedUniq(array) {
8100        return (array && array.length)
8101          ? baseSortedUniq(array)
8102          : [];
8103      }
8104  
8105      /**
8106       * This method is like `_.uniqBy` except that it's designed and optimized
8107       * for sorted arrays.
8108       *
8109       * @static
8110       * @memberOf _
8111       * @since 4.0.0
8112       * @category Array
8113       * @param {Array} array The array to inspect.
8114       * @param {Function} [iteratee] The iteratee invoked per element.
8115       * @returns {Array} Returns the new duplicate free array.
8116       * @example
8117       *
8118       * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
8119       * // => [1.1, 2.3]
8120       */
8121      function sortedUniqBy(array, iteratee) {
8122        return (array && array.length)
8123          ? baseSortedUniq(array, getIteratee(iteratee, 2))
8124          : [];
8125      }
8126  
8127      /**
8128       * Gets all but the first element of `array`.
8129       *
8130       * @static
8131       * @memberOf _
8132       * @since 4.0.0
8133       * @category Array
8134       * @param {Array} array The array to query.
8135       * @returns {Array} Returns the slice of `array`.
8136       * @example
8137       *
8138       * _.tail([1, 2, 3]);
8139       * // => [2, 3]
8140       */
8141      function tail(array) {
8142        var length = array == null ? 0 : array.length;
8143        return length ? baseSlice(array, 1, length) : [];
8144      }
8145  
8146      /**
8147       * Creates a slice of `array` with `n` elements taken from the beginning.
8148       *
8149       * @static
8150       * @memberOf _
8151       * @since 0.1.0
8152       * @category Array
8153       * @param {Array} array The array to query.
8154       * @param {number} [n=1] The number of elements to take.
8155       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8156       * @returns {Array} Returns the slice of `array`.
8157       * @example
8158       *
8159       * _.take([1, 2, 3]);
8160       * // => [1]
8161       *
8162       * _.take([1, 2, 3], 2);
8163       * // => [1, 2]
8164       *
8165       * _.take([1, 2, 3], 5);
8166       * // => [1, 2, 3]
8167       *
8168       * _.take([1, 2, 3], 0);
8169       * // => []
8170       */
8171      function take(array, n, guard) {
8172        if (!(array && array.length)) {
8173          return [];
8174        }
8175        n = (guard || n === undefined) ? 1 : toInteger(n);
8176        return baseSlice(array, 0, n < 0 ? 0 : n);
8177      }
8178  
8179      /**
8180       * Creates a slice of `array` with `n` elements taken from the end.
8181       *
8182       * @static
8183       * @memberOf _
8184       * @since 3.0.0
8185       * @category Array
8186       * @param {Array} array The array to query.
8187       * @param {number} [n=1] The number of elements to take.
8188       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8189       * @returns {Array} Returns the slice of `array`.
8190       * @example
8191       *
8192       * _.takeRight([1, 2, 3]);
8193       * // => [3]
8194       *
8195       * _.takeRight([1, 2, 3], 2);
8196       * // => [2, 3]
8197       *
8198       * _.takeRight([1, 2, 3], 5);
8199       * // => [1, 2, 3]
8200       *
8201       * _.takeRight([1, 2, 3], 0);
8202       * // => []
8203       */
8204      function takeRight(array, n, guard) {
8205        var length = array == null ? 0 : array.length;
8206        if (!length) {
8207          return [];
8208        }
8209        n = (guard || n === undefined) ? 1 : toInteger(n);
8210        n = length - n;
8211        return baseSlice(array, n < 0 ? 0 : n, length);
8212      }
8213  
8214      /**
8215       * Creates a slice of `array` with elements taken from the end. Elements are
8216       * taken until `predicate` returns falsey. The predicate is invoked with
8217       * three arguments: (value, index, array).
8218       *
8219       * @static
8220       * @memberOf _
8221       * @since 3.0.0
8222       * @category Array
8223       * @param {Array} array The array to query.
8224       * @param {Function} [predicate=_.identity] The function invoked per iteration.
8225       * @returns {Array} Returns the slice of `array`.
8226       * @example
8227       *
8228       * var users = [
8229       *   { 'user': 'barney',  'active': true },
8230       *   { 'user': 'fred',    'active': false },
8231       *   { 'user': 'pebbles', 'active': false }
8232       * ];
8233       *
8234       * _.takeRightWhile(users, function(o) { return !o.active; });
8235       * // => objects for ['fred', 'pebbles']
8236       *
8237       * // The `_.matches` iteratee shorthand.
8238       * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
8239       * // => objects for ['pebbles']
8240       *
8241       * // The `_.matchesProperty` iteratee shorthand.
8242       * _.takeRightWhile(users, ['active', false]);
8243       * // => objects for ['fred', 'pebbles']
8244       *
8245       * // The `_.property` iteratee shorthand.
8246       * _.takeRightWhile(users, 'active');
8247       * // => []
8248       */
8249      function takeRightWhile(array, predicate) {
8250        return (array && array.length)
8251          ? baseWhile(array, getIteratee(predicate, 3), false, true)
8252          : [];
8253      }
8254  
8255      /**
8256       * Creates a slice of `array` with elements taken from the beginning. Elements
8257       * are taken until `predicate` returns falsey. The predicate is invoked with
8258       * three arguments: (value, index, array).
8259       *
8260       * @static
8261       * @memberOf _
8262       * @since 3.0.0
8263       * @category Array
8264       * @param {Array} array The array to query.
8265       * @param {Function} [predicate=_.identity] The function invoked per iteration.
8266       * @returns {Array} Returns the slice of `array`.
8267       * @example
8268       *
8269       * var users = [
8270       *   { 'user': 'barney',  'active': false },
8271       *   { 'user': 'fred',    'active': false },
8272       *   { 'user': 'pebbles', 'active': true }
8273       * ];
8274       *
8275       * _.takeWhile(users, function(o) { return !o.active; });
8276       * // => objects for ['barney', 'fred']
8277       *
8278       * // The `_.matches` iteratee shorthand.
8279       * _.takeWhile(users, { 'user': 'barney', 'active': false });
8280       * // => objects for ['barney']
8281       *
8282       * // The `_.matchesProperty` iteratee shorthand.
8283       * _.takeWhile(users, ['active', false]);
8284       * // => objects for ['barney', 'fred']
8285       *
8286       * // The `_.property` iteratee shorthand.
8287       * _.takeWhile(users, 'active');
8288       * // => []
8289       */
8290      function takeWhile(array, predicate) {
8291        return (array && array.length)
8292          ? baseWhile(array, getIteratee(predicate, 3))
8293          : [];
8294      }
8295  
8296      /**
8297       * Creates an array of unique values, in order, from all given arrays using
8298       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8299       * for equality comparisons.
8300       *
8301       * @static
8302       * @memberOf _
8303       * @since 0.1.0
8304       * @category Array
8305       * @param {...Array} [arrays] The arrays to inspect.
8306       * @returns {Array} Returns the new array of combined values.
8307       * @example
8308       *
8309       * _.union([2], [1, 2]);
8310       * // => [2, 1]
8311       */
8312      var union = baseRest(function(arrays) {
8313        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
8314      });
8315  
8316      /**
8317       * This method is like `_.union` except that it accepts `iteratee` which is
8318       * invoked for each element of each `arrays` to generate the criterion by
8319       * which uniqueness is computed. Result values are chosen from the first
8320       * array in which the value occurs. The iteratee is invoked with one argument:
8321       * (value).
8322       *
8323       * @static
8324       * @memberOf _
8325       * @since 4.0.0
8326       * @category Array
8327       * @param {...Array} [arrays] The arrays to inspect.
8328       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8329       * @returns {Array} Returns the new array of combined values.
8330       * @example
8331       *
8332       * _.unionBy([2.1], [1.2, 2.3], Math.floor);
8333       * // => [2.1, 1.2]
8334       *
8335       * // The `_.property` iteratee shorthand.
8336       * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8337       * // => [{ 'x': 1 }, { 'x': 2 }]
8338       */
8339      var unionBy = baseRest(function(arrays) {
8340        var iteratee = last(arrays);
8341        if (isArrayLikeObject(iteratee)) {
8342          iteratee = undefined;
8343        }
8344        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
8345      });
8346  
8347      /**
8348       * This method is like `_.union` except that it accepts `comparator` which
8349       * is invoked to compare elements of `arrays`. Result values are chosen from
8350       * the first array in which the value occurs. The comparator is invoked
8351       * with two arguments: (arrVal, othVal).
8352       *
8353       * @static
8354       * @memberOf _
8355       * @since 4.0.0
8356       * @category Array
8357       * @param {...Array} [arrays] The arrays to inspect.
8358       * @param {Function} [comparator] The comparator invoked per element.
8359       * @returns {Array} Returns the new array of combined values.
8360       * @example
8361       *
8362       * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8363       * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8364       *
8365       * _.unionWith(objects, others, _.isEqual);
8366       * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
8367       */
8368      var unionWith = baseRest(function(arrays) {
8369        var comparator = last(arrays);
8370        comparator = typeof comparator == 'function' ? comparator : undefined;
8371        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
8372      });
8373  
8374      /**
8375       * Creates a duplicate-free version of an array, using
8376       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8377       * for equality comparisons, in which only the first occurrence of each element
8378       * is kept. The order of result values is determined by the order they occur
8379       * in the array.
8380       *
8381       * @static
8382       * @memberOf _
8383       * @since 0.1.0
8384       * @category Array
8385       * @param {Array} array The array to inspect.
8386       * @returns {Array} Returns the new duplicate free array.
8387       * @example
8388       *
8389       * _.uniq([2, 1, 2]);
8390       * // => [2, 1]
8391       */
8392      function uniq(array) {
8393        return (array && array.length) ? baseUniq(array) : [];
8394      }
8395  
8396      /**
8397       * This method is like `_.uniq` except that it accepts `iteratee` which is
8398       * invoked for each element in `array` to generate the criterion by which
8399       * uniqueness is computed. The order of result values is determined by the
8400       * order they occur in the array. The iteratee is invoked with one argument:
8401       * (value).
8402       *
8403       * @static
8404       * @memberOf _
8405       * @since 4.0.0
8406       * @category Array
8407       * @param {Array} array The array to inspect.
8408       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8409       * @returns {Array} Returns the new duplicate free array.
8410       * @example
8411       *
8412       * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
8413       * // => [2.1, 1.2]
8414       *
8415       * // The `_.property` iteratee shorthand.
8416       * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
8417       * // => [{ 'x': 1 }, { 'x': 2 }]
8418       */
8419      function uniqBy(array, iteratee) {
8420        return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
8421      }
8422  
8423      /**
8424       * This method is like `_.uniq` except that it accepts `comparator` which
8425       * is invoked to compare elements of `array`. The order of result values is
8426       * determined by the order they occur in the array.The comparator is invoked
8427       * with two arguments: (arrVal, othVal).
8428       *
8429       * @static
8430       * @memberOf _
8431       * @since 4.0.0
8432       * @category Array
8433       * @param {Array} array The array to inspect.
8434       * @param {Function} [comparator] The comparator invoked per element.
8435       * @returns {Array} Returns the new duplicate free array.
8436       * @example
8437       *
8438       * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
8439       *
8440       * _.uniqWith(objects, _.isEqual);
8441       * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
8442       */
8443      function uniqWith(array, comparator) {
8444        comparator = typeof comparator == 'function' ? comparator : undefined;
8445        return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
8446      }
8447  
8448      /**
8449       * This method is like `_.zip` except that it accepts an array of grouped
8450       * elements and creates an array regrouping the elements to their pre-zip
8451       * configuration.
8452       *
8453       * @static
8454       * @memberOf _
8455       * @since 1.2.0
8456       * @category Array
8457       * @param {Array} array The array of grouped elements to process.
8458       * @returns {Array} Returns the new array of regrouped elements.
8459       * @example
8460       *
8461       * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
8462       * // => [['a', 1, true], ['b', 2, false]]
8463       *
8464       * _.unzip(zipped);
8465       * // => [['a', 'b'], [1, 2], [true, false]]
8466       */
8467      function unzip(array) {
8468        if (!(array && array.length)) {
8469          return [];
8470        }
8471        var length = 0;
8472        array = arrayFilter(array, function(group) {
8473          if (isArrayLikeObject(group)) {
8474            length = nativeMax(group.length, length);
8475            return true;
8476          }
8477        });
8478        return baseTimes(length, function(index) {
8479          return arrayMap(array, baseProperty(index));
8480        });
8481      }
8482  
8483      /**
8484       * This method is like `_.unzip` except that it accepts `iteratee` to specify
8485       * how regrouped values should be combined. The iteratee is invoked with the
8486       * elements of each group: (...group).
8487       *
8488       * @static
8489       * @memberOf _
8490       * @since 3.8.0
8491       * @category Array
8492       * @param {Array} array The array of grouped elements to process.
8493       * @param {Function} [iteratee=_.identity] The function to combine
8494       *  regrouped values.
8495       * @returns {Array} Returns the new array of regrouped elements.
8496       * @example
8497       *
8498       * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
8499       * // => [[1, 10, 100], [2, 20, 200]]
8500       *
8501       * _.unzipWith(zipped, _.add);
8502       * // => [3, 30, 300]
8503       */
8504      function unzipWith(array, iteratee) {
8505        if (!(array && array.length)) {
8506          return [];
8507        }
8508        var result = unzip(array);
8509        if (iteratee == null) {
8510          return result;
8511        }
8512        return arrayMap(result, function(group) {
8513          return apply(iteratee, undefined, group);
8514        });
8515      }
8516  
8517      /**
8518       * Creates an array excluding all given values using
8519       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8520       * for equality comparisons.
8521       *
8522       * **Note:** Unlike `_.pull`, this method returns a new array.
8523       *
8524       * @static
8525       * @memberOf _
8526       * @since 0.1.0
8527       * @category Array
8528       * @param {Array} array The array to inspect.
8529       * @param {...*} [values] The values to exclude.
8530       * @returns {Array} Returns the new array of filtered values.
8531       * @see _.difference, _.xor
8532       * @example
8533       *
8534       * _.without([2, 1, 2, 3], 1, 2);
8535       * // => [3]
8536       */
8537      var without = baseRest(function(array, values) {
8538        return isArrayLikeObject(array)
8539          ? baseDifference(array, values)
8540          : [];
8541      });
8542  
8543      /**
8544       * Creates an array of unique values that is the
8545       * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
8546       * of the given arrays. The order of result values is determined by the order
8547       * they occur in the arrays.
8548       *
8549       * @static
8550       * @memberOf _
8551       * @since 2.4.0
8552       * @category Array
8553       * @param {...Array} [arrays] The arrays to inspect.
8554       * @returns {Array} Returns the new array of filtered values.
8555       * @see _.difference, _.without
8556       * @example
8557       *
8558       * _.xor([2, 1], [2, 3]);
8559       * // => [1, 3]
8560       */
8561      var xor = baseRest(function(arrays) {
8562        return baseXor(arrayFilter(arrays, isArrayLikeObject));
8563      });
8564  
8565      /**
8566       * This method is like `_.xor` except that it accepts `iteratee` which is
8567       * invoked for each element of each `arrays` to generate the criterion by
8568       * which by which they're compared. The order of result values is determined
8569       * by the order they occur in the arrays. The iteratee is invoked with one
8570       * argument: (value).
8571       *
8572       * @static
8573       * @memberOf _
8574       * @since 4.0.0
8575       * @category Array
8576       * @param {...Array} [arrays] The arrays to inspect.
8577       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8578       * @returns {Array} Returns the new array of filtered values.
8579       * @example
8580       *
8581       * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
8582       * // => [1.2, 3.4]
8583       *
8584       * // The `_.property` iteratee shorthand.
8585       * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8586       * // => [{ 'x': 2 }]
8587       */
8588      var xorBy = baseRest(function(arrays) {
8589        var iteratee = last(arrays);
8590        if (isArrayLikeObject(iteratee)) {
8591          iteratee = undefined;
8592        }
8593        return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
8594      });
8595  
8596      /**
8597       * This method is like `_.xor` except that it accepts `comparator` which is
8598       * invoked to compare elements of `arrays`. The order of result values is
8599       * determined by the order they occur in the arrays. The comparator is invoked
8600       * with two arguments: (arrVal, othVal).
8601       *
8602       * @static
8603       * @memberOf _
8604       * @since 4.0.0
8605       * @category Array
8606       * @param {...Array} [arrays] The arrays to inspect.
8607       * @param {Function} [comparator] The comparator invoked per element.
8608       * @returns {Array} Returns the new array of filtered values.
8609       * @example
8610       *
8611       * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8612       * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8613       *
8614       * _.xorWith(objects, others, _.isEqual);
8615       * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
8616       */
8617      var xorWith = baseRest(function(arrays) {
8618        var comparator = last(arrays);
8619        comparator = typeof comparator == 'function' ? comparator : undefined;
8620        return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
8621      });
8622  
8623      /**
8624       * Creates an array of grouped elements, the first of which contains the
8625       * first elements of the given arrays, the second of which contains the
8626       * second elements of the given arrays, and so on.
8627       *
8628       * @static
8629       * @memberOf _
8630       * @since 0.1.0
8631       * @category Array
8632       * @param {...Array} [arrays] The arrays to process.
8633       * @returns {Array} Returns the new array of grouped elements.
8634       * @example
8635       *
8636       * _.zip(['a', 'b'], [1, 2], [true, false]);
8637       * // => [['a', 1, true], ['b', 2, false]]
8638       */
8639      var zip = baseRest(unzip);
8640  
8641      /**
8642       * This method is like `_.fromPairs` except that it accepts two arrays,
8643       * one of property identifiers and one of corresponding values.
8644       *
8645       * @static
8646       * @memberOf _
8647       * @since 0.4.0
8648       * @category Array
8649       * @param {Array} [props=[]] The property identifiers.
8650       * @param {Array} [values=[]] The property values.
8651       * @returns {Object} Returns the new object.
8652       * @example
8653       *
8654       * _.zipObject(['a', 'b'], [1, 2]);
8655       * // => { 'a': 1, 'b': 2 }
8656       */
8657      function zipObject(props, values) {
8658        return baseZipObject(props || [], values || [], assignValue);
8659      }
8660  
8661      /**
8662       * This method is like `_.zipObject` except that it supports property paths.
8663       *
8664       * @static
8665       * @memberOf _
8666       * @since 4.1.0
8667       * @category Array
8668       * @param {Array} [props=[]] The property identifiers.
8669       * @param {Array} [values=[]] The property values.
8670       * @returns {Object} Returns the new object.
8671       * @example
8672       *
8673       * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
8674       * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
8675       */
8676      function zipObjectDeep(props, values) {
8677        return baseZipObject(props || [], values || [], baseSet);
8678      }
8679  
8680      /**
8681       * This method is like `_.zip` except that it accepts `iteratee` to specify
8682       * how grouped values should be combined. The iteratee is invoked with the
8683       * elements of each group: (...group).
8684       *
8685       * @static
8686       * @memberOf _
8687       * @since 3.8.0
8688       * @category Array
8689       * @param {...Array} [arrays] The arrays to process.
8690       * @param {Function} [iteratee=_.identity] The function to combine
8691       *  grouped values.
8692       * @returns {Array} Returns the new array of grouped elements.
8693       * @example
8694       *
8695       * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
8696       *   return a + b + c;
8697       * });
8698       * // => [111, 222]
8699       */
8700      var zipWith = baseRest(function(arrays) {
8701        var length = arrays.length,
8702            iteratee = length > 1 ? arrays[length - 1] : undefined;
8703  
8704        iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
8705        return unzipWith(arrays, iteratee);
8706      });
8707  
8708      /*------------------------------------------------------------------------*/
8709  
8710      /**
8711       * Creates a `lodash` wrapper instance that wraps `value` with explicit method
8712       * chain sequences enabled. The result of such sequences must be unwrapped
8713       * with `_#value`.
8714       *
8715       * @static
8716       * @memberOf _
8717       * @since 1.3.0
8718       * @category Seq
8719       * @param {*} value The value to wrap.
8720       * @returns {Object} Returns the new `lodash` wrapper instance.
8721       * @example
8722       *
8723       * var users = [
8724       *   { 'user': 'barney',  'age': 36 },
8725       *   { 'user': 'fred',    'age': 40 },
8726       *   { 'user': 'pebbles', 'age': 1 }
8727       * ];
8728       *
8729       * var youngest = _
8730       *   .chain(users)
8731       *   .sortBy('age')
8732       *   .map(function(o) {
8733       *     return o.user + ' is ' + o.age;
8734       *   })
8735       *   .head()
8736       *   .value();
8737       * // => 'pebbles is 1'
8738       */
8739      function chain(value) {
8740        var result = lodash(value);
8741        result.__chain__ = true;
8742        return result;
8743      }
8744  
8745      /**
8746       * This method invokes `interceptor` and returns `value`. The interceptor
8747       * is invoked with one argument; (value). The purpose of this method is to
8748       * "tap into" a method chain sequence in order to modify intermediate results.
8749       *
8750       * @static
8751       * @memberOf _
8752       * @since 0.1.0
8753       * @category Seq
8754       * @param {*} value The value to provide to `interceptor`.
8755       * @param {Function} interceptor The function to invoke.
8756       * @returns {*} Returns `value`.
8757       * @example
8758       *
8759       * _([1, 2, 3])
8760       *  .tap(function(array) {
8761       *    // Mutate input array.
8762       *    array.pop();
8763       *  })
8764       *  .reverse()
8765       *  .value();
8766       * // => [2, 1]
8767       */
8768      function tap(value, interceptor) {
8769        interceptor(value);
8770        return value;
8771      }
8772  
8773      /**
8774       * This method is like `_.tap` except that it returns the result of `interceptor`.
8775       * The purpose of this method is to "pass thru" values replacing intermediate
8776       * results in a method chain sequence.
8777       *
8778       * @static
8779       * @memberOf _
8780       * @since 3.0.0
8781       * @category Seq
8782       * @param {*} value The value to provide to `interceptor`.
8783       * @param {Function} interceptor The function to invoke.
8784       * @returns {*} Returns the result of `interceptor`.
8785       * @example
8786       *
8787       * _('  abc  ')
8788       *  .chain()
8789       *  .trim()
8790       *  .thru(function(value) {
8791       *    return [value];
8792       *  })
8793       *  .value();
8794       * // => ['abc']
8795       */
8796      function thru(value, interceptor) {
8797        return interceptor(value);
8798      }
8799  
8800      /**
8801       * This method is the wrapper version of `_.at`.
8802       *
8803       * @name at
8804       * @memberOf _
8805       * @since 1.0.0
8806       * @category Seq
8807       * @param {...(string|string[])} [paths] The property paths to pick.
8808       * @returns {Object} Returns the new `lodash` wrapper instance.
8809       * @example
8810       *
8811       * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
8812       *
8813       * _(object).at(['a[0].b.c', 'a[1]']).value();
8814       * // => [3, 4]
8815       */
8816      var wrapperAt = flatRest(function(paths) {
8817        var length = paths.length,
8818            start = length ? paths[0] : 0,
8819            value = this.__wrapped__,
8820            interceptor = function(object) { return baseAt(object, paths); };
8821  
8822        if (length > 1 || this.__actions__.length ||
8823            !(value instanceof LazyWrapper) || !isIndex(start)) {
8824          return this.thru(interceptor);
8825        }
8826        value = value.slice(start, +start + (length ? 1 : 0));
8827        value.__actions__.push({
8828          'func': thru,
8829          'args': [interceptor],
8830          'thisArg': undefined
8831        });
8832        return new LodashWrapper(value, this.__chain__).thru(function(array) {
8833          if (length && !array.length) {
8834            array.push(undefined);
8835          }
8836          return array;
8837        });
8838      });
8839  
8840      /**
8841       * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
8842       *
8843       * @name chain
8844       * @memberOf _
8845       * @since 0.1.0
8846       * @category Seq
8847       * @returns {Object} Returns the new `lodash` wrapper instance.
8848       * @example
8849       *
8850       * var users = [
8851       *   { 'user': 'barney', 'age': 36 },
8852       *   { 'user': 'fred',   'age': 40 }
8853       * ];
8854       *
8855       * // A sequence without explicit chaining.
8856       * _(users).head();
8857       * // => { 'user': 'barney', 'age': 36 }
8858       *
8859       * // A sequence with explicit chaining.
8860       * _(users)
8861       *   .chain()
8862       *   .head()
8863       *   .pick('user')
8864       *   .value();
8865       * // => { 'user': 'barney' }
8866       */
8867      function wrapperChain() {
8868        return chain(this);
8869      }
8870  
8871      /**
8872       * Executes the chain sequence and returns the wrapped result.
8873       *
8874       * @name commit
8875       * @memberOf _
8876       * @since 3.2.0
8877       * @category Seq
8878       * @returns {Object} Returns the new `lodash` wrapper instance.
8879       * @example
8880       *
8881       * var array = [1, 2];
8882       * var wrapped = _(array).push(3);
8883       *
8884       * console.log(array);
8885       * // => [1, 2]
8886       *
8887       * wrapped = wrapped.commit();
8888       * console.log(array);
8889       * // => [1, 2, 3]
8890       *
8891       * wrapped.last();
8892       * // => 3
8893       *
8894       * console.log(array);
8895       * // => [1, 2, 3]
8896       */
8897      function wrapperCommit() {
8898        return new LodashWrapper(this.value(), this.__chain__);
8899      }
8900  
8901      /**
8902       * Gets the next value on a wrapped object following the
8903       * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
8904       *
8905       * @name next
8906       * @memberOf _
8907       * @since 4.0.0
8908       * @category Seq
8909       * @returns {Object} Returns the next iterator value.
8910       * @example
8911       *
8912       * var wrapped = _([1, 2]);
8913       *
8914       * wrapped.next();
8915       * // => { 'done': false, 'value': 1 }
8916       *
8917       * wrapped.next();
8918       * // => { 'done': false, 'value': 2 }
8919       *
8920       * wrapped.next();
8921       * // => { 'done': true, 'value': undefined }
8922       */
8923      function wrapperNext() {
8924        if (this.__values__ === undefined) {
8925          this.__values__ = toArray(this.value());
8926        }
8927        var done = this.__index__ >= this.__values__.length,
8928            value = done ? undefined : this.__values__[this.__index__++];
8929  
8930        return { 'done': done, 'value': value };
8931      }
8932  
8933      /**
8934       * Enables the wrapper to be iterable.
8935       *
8936       * @name Symbol.iterator
8937       * @memberOf _
8938       * @since 4.0.0
8939       * @category Seq
8940       * @returns {Object} Returns the wrapper object.
8941       * @example
8942       *
8943       * var wrapped = _([1, 2]);
8944       *
8945       * wrapped[Symbol.iterator]() === wrapped;
8946       * // => true
8947       *
8948       * Array.from(wrapped);
8949       * // => [1, 2]
8950       */
8951      function wrapperToIterator() {
8952        return this;
8953      }
8954  
8955      /**
8956       * Creates a clone of the chain sequence planting `value` as the wrapped value.
8957       *
8958       * @name plant
8959       * @memberOf _
8960       * @since 3.2.0
8961       * @category Seq
8962       * @param {*} value The value to plant.
8963       * @returns {Object} Returns the new `lodash` wrapper instance.
8964       * @example
8965       *
8966       * function square(n) {
8967       *   return n * n;
8968       * }
8969       *
8970       * var wrapped = _([1, 2]).map(square);
8971       * var other = wrapped.plant([3, 4]);
8972       *
8973       * other.value();
8974       * // => [9, 16]
8975       *
8976       * wrapped.value();
8977       * // => [1, 4]
8978       */
8979      function wrapperPlant(value) {
8980        var result,
8981            parent = this;
8982  
8983        while (parent instanceof baseLodash) {
8984          var clone = wrapperClone(parent);
8985          clone.__index__ = 0;
8986          clone.__values__ = undefined;
8987          if (result) {
8988            previous.__wrapped__ = clone;
8989          } else {
8990            result = clone;
8991          }
8992          var previous = clone;
8993          parent = parent.__wrapped__;
8994        }
8995        previous.__wrapped__ = value;
8996        return result;
8997      }
8998  
8999      /**
9000       * This method is the wrapper version of `_.reverse`.
9001       *
9002       * **Note:** This method mutates the wrapped array.
9003       *
9004       * @name reverse
9005       * @memberOf _
9006       * @since 0.1.0
9007       * @category Seq
9008       * @returns {Object} Returns the new `lodash` wrapper instance.
9009       * @example
9010       *
9011       * var array = [1, 2, 3];
9012       *
9013       * _(array).reverse().value()
9014       * // => [3, 2, 1]
9015       *
9016       * console.log(array);
9017       * // => [3, 2, 1]
9018       */
9019      function wrapperReverse() {
9020        var value = this.__wrapped__;
9021        if (value instanceof LazyWrapper) {
9022          var wrapped = value;
9023          if (this.__actions__.length) {
9024            wrapped = new LazyWrapper(this);
9025          }
9026          wrapped = wrapped.reverse();
9027          wrapped.__actions__.push({
9028            'func': thru,
9029            'args': [reverse],
9030            'thisArg': undefined
9031          });
9032          return new LodashWrapper(wrapped, this.__chain__);
9033        }
9034        return this.thru(reverse);
9035      }
9036  
9037      /**
9038       * Executes the chain sequence to resolve the unwrapped value.
9039       *
9040       * @name value
9041       * @memberOf _
9042       * @since 0.1.0
9043       * @alias toJSON, valueOf
9044       * @category Seq
9045       * @returns {*} Returns the resolved unwrapped value.
9046       * @example
9047       *
9048       * _([1, 2, 3]).value();
9049       * // => [1, 2, 3]
9050       */
9051      function wrapperValue() {
9052        return baseWrapperValue(this.__wrapped__, this.__actions__);
9053      }
9054  
9055      /*------------------------------------------------------------------------*/
9056  
9057      /**
9058       * Creates an object composed of keys generated from the results of running
9059       * each element of `collection` thru `iteratee`. The corresponding value of
9060       * each key is the number of times the key was returned by `iteratee`. The
9061       * iteratee is invoked with one argument: (value).
9062       *
9063       * @static
9064       * @memberOf _
9065       * @since 0.5.0
9066       * @category Collection
9067       * @param {Array|Object} collection The collection to iterate over.
9068       * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9069       * @returns {Object} Returns the composed aggregate object.
9070       * @example
9071       *
9072       * _.countBy([6.1, 4.2, 6.3], Math.floor);
9073       * // => { '4': 1, '6': 2 }
9074       *
9075       * // The `_.property` iteratee shorthand.
9076       * _.countBy(['one', 'two', 'three'], 'length');
9077       * // => { '3': 2, '5': 1 }
9078       */
9079      var countBy = createAggregator(function(result, value, key) {
9080        if (hasOwnProperty.call(result, key)) {
9081          ++result[key];
9082        } else {
9083          baseAssignValue(result, key, 1);
9084        }
9085      });
9086  
9087      /**
9088       * Checks if `predicate` returns truthy for **all** elements of `collection`.
9089       * Iteration is stopped once `predicate` returns falsey. The predicate is
9090       * invoked with three arguments: (value, index|key, collection).
9091       *
9092       * **Note:** This method returns `true` for
9093       * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
9094       * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
9095       * elements of empty collections.
9096       *
9097       * @static
9098       * @memberOf _
9099       * @since 0.1.0
9100       * @category Collection
9101       * @param {Array|Object} collection The collection to iterate over.
9102       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9103       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9104       * @returns {boolean} Returns `true` if all elements pass the predicate check,
9105       *  else `false`.
9106       * @example
9107       *
9108       * _.every([true, 1, null, 'yes'], Boolean);
9109       * // => false
9110       *
9111       * var users = [
9112       *   { 'user': 'barney', 'age': 36, 'active': false },
9113       *   { 'user': 'fred',   'age': 40, 'active': false }
9114       * ];
9115       *
9116       * // The `_.matches` iteratee shorthand.
9117       * _.every(users, { 'user': 'barney', 'active': false });
9118       * // => false
9119       *
9120       * // The `_.matchesProperty` iteratee shorthand.
9121       * _.every(users, ['active', false]);
9122       * // => true
9123       *
9124       * // The `_.property` iteratee shorthand.
9125       * _.every(users, 'active');
9126       * // => false
9127       */
9128      function every(collection, predicate, guard) {
9129        var func = isArray(collection) ? arrayEvery : baseEvery;
9130        if (guard && isIterateeCall(collection, predicate, guard)) {
9131          predicate = undefined;
9132        }
9133        return func(collection, getIteratee(predicate, 3));
9134      }
9135  
9136      /**
9137       * Iterates over elements of `collection`, returning an array of all elements
9138       * `predicate` returns truthy for. The predicate is invoked with three
9139       * arguments: (value, index|key, collection).
9140       *
9141       * **Note:** Unlike `_.remove`, this method returns a new array.
9142       *
9143       * @static
9144       * @memberOf _
9145       * @since 0.1.0
9146       * @category Collection
9147       * @param {Array|Object} collection The collection to iterate over.
9148       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9149       * @returns {Array} Returns the new filtered array.
9150       * @see _.reject
9151       * @example
9152       *
9153       * var users = [
9154       *   { 'user': 'barney', 'age': 36, 'active': true },
9155       *   { 'user': 'fred',   'age': 40, 'active': false }
9156       * ];
9157       *
9158       * _.filter(users, function(o) { return !o.active; });
9159       * // => objects for ['fred']
9160       *
9161       * // The `_.matches` iteratee shorthand.
9162       * _.filter(users, { 'age': 36, 'active': true });
9163       * // => objects for ['barney']
9164       *
9165       * // The `_.matchesProperty` iteratee shorthand.
9166       * _.filter(users, ['active', false]);
9167       * // => objects for ['fred']
9168       *
9169       * // The `_.property` iteratee shorthand.
9170       * _.filter(users, 'active');
9171       * // => objects for ['barney']
9172       */
9173      function filter(collection, predicate) {
9174        var func = isArray(collection) ? arrayFilter : baseFilter;
9175        return func(collection, getIteratee(predicate, 3));
9176      }
9177  
9178      /**
9179       * Iterates over elements of `collection`, returning the first element
9180       * `predicate` returns truthy for. The predicate is invoked with three
9181       * arguments: (value, index|key, collection).
9182       *
9183       * @static
9184       * @memberOf _
9185       * @since 0.1.0
9186       * @category Collection
9187       * @param {Array|Object} collection The collection to inspect.
9188       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9189       * @param {number} [fromIndex=0] The index to search from.
9190       * @returns {*} Returns the matched element, else `undefined`.
9191       * @example
9192       *
9193       * var users = [
9194       *   { 'user': 'barney',  'age': 36, 'active': true },
9195       *   { 'user': 'fred',    'age': 40, 'active': false },
9196       *   { 'user': 'pebbles', 'age': 1,  'active': true }
9197       * ];
9198       *
9199       * _.find(users, function(o) { return o.age < 40; });
9200       * // => object for 'barney'
9201       *
9202       * // The `_.matches` iteratee shorthand.
9203       * _.find(users, { 'age': 1, 'active': true });
9204       * // => object for 'pebbles'
9205       *
9206       * // The `_.matchesProperty` iteratee shorthand.
9207       * _.find(users, ['active', false]);
9208       * // => object for 'fred'
9209       *
9210       * // The `_.property` iteratee shorthand.
9211       * _.find(users, 'active');
9212       * // => object for 'barney'
9213       */
9214      var find = createFind(findIndex);
9215  
9216      /**
9217       * This method is like `_.find` except that it iterates over elements of
9218       * `collection` from right to left.
9219       *
9220       * @static
9221       * @memberOf _
9222       * @since 2.0.0
9223       * @category Collection
9224       * @param {Array|Object} collection The collection to inspect.
9225       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9226       * @param {number} [fromIndex=collection.length-1] The index to search from.
9227       * @returns {*} Returns the matched element, else `undefined`.
9228       * @example
9229       *
9230       * _.findLast([1, 2, 3, 4], function(n) {
9231       *   return n % 2 == 1;
9232       * });
9233       * // => 3
9234       */
9235      var findLast = createFind(findLastIndex);
9236  
9237      /**
9238       * Creates a flattened array of values by running each element in `collection`
9239       * thru `iteratee` and flattening the mapped results. The iteratee is invoked
9240       * with three arguments: (value, index|key, collection).
9241       *
9242       * @static
9243       * @memberOf _
9244       * @since 4.0.0
9245       * @category Collection
9246       * @param {Array|Object} collection The collection to iterate over.
9247       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9248       * @returns {Array} Returns the new flattened array.
9249       * @example
9250       *
9251       * function duplicate(n) {
9252       *   return [n, n];
9253       * }
9254       *
9255       * _.flatMap([1, 2], duplicate);
9256       * // => [1, 1, 2, 2]
9257       */
9258      function flatMap(collection, iteratee) {
9259        return baseFlatten(map(collection, iteratee), 1);
9260      }
9261  
9262      /**
9263       * This method is like `_.flatMap` except that it recursively flattens the
9264       * mapped results.
9265       *
9266       * @static
9267       * @memberOf _
9268       * @since 4.7.0
9269       * @category Collection
9270       * @param {Array|Object} collection The collection to iterate over.
9271       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9272       * @returns {Array} Returns the new flattened array.
9273       * @example
9274       *
9275       * function duplicate(n) {
9276       *   return [[[n, n]]];
9277       * }
9278       *
9279       * _.flatMapDeep([1, 2], duplicate);
9280       * // => [1, 1, 2, 2]
9281       */
9282      function flatMapDeep(collection, iteratee) {
9283        return baseFlatten(map(collection, iteratee), INFINITY);
9284      }
9285  
9286      /**
9287       * This method is like `_.flatMap` except that it recursively flattens the
9288       * mapped results up to `depth` times.
9289       *
9290       * @static
9291       * @memberOf _
9292       * @since 4.7.0
9293       * @category Collection
9294       * @param {Array|Object} collection The collection to iterate over.
9295       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9296       * @param {number} [depth=1] The maximum recursion depth.
9297       * @returns {Array} Returns the new flattened array.
9298       * @example
9299       *
9300       * function duplicate(n) {
9301       *   return [[[n, n]]];
9302       * }
9303       *
9304       * _.flatMapDepth([1, 2], duplicate, 2);
9305       * // => [[1, 1], [2, 2]]
9306       */
9307      function flatMapDepth(collection, iteratee, depth) {
9308        depth = depth === undefined ? 1 : toInteger(depth);
9309        return baseFlatten(map(collection, iteratee), depth);
9310      }
9311  
9312      /**
9313       * Iterates over elements of `collection` and invokes `iteratee` for each element.
9314       * The iteratee is invoked with three arguments: (value, index|key, collection).
9315       * Iteratee functions may exit iteration early by explicitly returning `false`.
9316       *
9317       * **Note:** As with other "Collections" methods, objects with a "length"
9318       * property are iterated like arrays. To avoid this behavior use `_.forIn`
9319       * or `_.forOwn` for object iteration.
9320       *
9321       * @static
9322       * @memberOf _
9323       * @since 0.1.0
9324       * @alias each
9325       * @category Collection
9326       * @param {Array|Object} collection The collection to iterate over.
9327       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9328       * @returns {Array|Object} Returns `collection`.
9329       * @see _.forEachRight
9330       * @example
9331       *
9332       * _.forEach([1, 2], function(value) {
9333       *   console.log(value);
9334       * });
9335       * // => Logs `1` then `2`.
9336       *
9337       * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
9338       *   console.log(key);
9339       * });
9340       * // => Logs 'a' then 'b' (iteration order is not guaranteed).
9341       */
9342      function forEach(collection, iteratee) {
9343        var func = isArray(collection) ? arrayEach : baseEach;
9344        return func(collection, getIteratee(iteratee, 3));
9345      }
9346  
9347      /**
9348       * This method is like `_.forEach` except that it iterates over elements of
9349       * `collection` from right to left.
9350       *
9351       * @static
9352       * @memberOf _
9353       * @since 2.0.0
9354       * @alias eachRight
9355       * @category Collection
9356       * @param {Array|Object} collection The collection to iterate over.
9357       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9358       * @returns {Array|Object} Returns `collection`.
9359       * @see _.forEach
9360       * @example
9361       *
9362       * _.forEachRight([1, 2], function(value) {
9363       *   console.log(value);
9364       * });
9365       * // => Logs `2` then `1`.
9366       */
9367      function forEachRight(collection, iteratee) {
9368        var func = isArray(collection) ? arrayEachRight : baseEachRight;
9369        return func(collection, getIteratee(iteratee, 3));
9370      }
9371  
9372      /**
9373       * Creates an object composed of keys generated from the results of running
9374       * each element of `collection` thru `iteratee`. The order of grouped values
9375       * is determined by the order they occur in `collection`. The corresponding
9376       * value of each key is an array of elements responsible for generating the
9377       * key. The iteratee is invoked with one argument: (value).
9378       *
9379       * @static
9380       * @memberOf _
9381       * @since 0.1.0
9382       * @category Collection
9383       * @param {Array|Object} collection The collection to iterate over.
9384       * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9385       * @returns {Object} Returns the composed aggregate object.
9386       * @example
9387       *
9388       * _.groupBy([6.1, 4.2, 6.3], Math.floor);
9389       * // => { '4': [4.2], '6': [6.1, 6.3] }
9390       *
9391       * // The `_.property` iteratee shorthand.
9392       * _.groupBy(['one', 'two', 'three'], 'length');
9393       * // => { '3': ['one', 'two'], '5': ['three'] }
9394       */
9395      var groupBy = createAggregator(function(result, value, key) {
9396        if (hasOwnProperty.call(result, key)) {
9397          result[key].push(value);
9398        } else {
9399          baseAssignValue(result, key, [value]);
9400        }
9401      });
9402  
9403      /**
9404       * Checks if `value` is in `collection`. If `collection` is a string, it's
9405       * checked for a substring of `value`, otherwise
9406       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9407       * is used for equality comparisons. If `fromIndex` is negative, it's used as
9408       * the offset from the end of `collection`.
9409       *
9410       * @static
9411       * @memberOf _
9412       * @since 0.1.0
9413       * @category Collection
9414       * @param {Array|Object|string} collection The collection to inspect.
9415       * @param {*} value The value to search for.
9416       * @param {number} [fromIndex=0] The index to search from.
9417       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
9418       * @returns {boolean} Returns `true` if `value` is found, else `false`.
9419       * @example
9420       *
9421       * _.includes([1, 2, 3], 1);
9422       * // => true
9423       *
9424       * _.includes([1, 2, 3], 1, 2);
9425       * // => false
9426       *
9427       * _.includes({ 'a': 1, 'b': 2 }, 1);
9428       * // => true
9429       *
9430       * _.includes('abcd', 'bc');
9431       * // => true
9432       */
9433      function includes(collection, value, fromIndex, guard) {
9434        collection = isArrayLike(collection) ? collection : values(collection);
9435        fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
9436  
9437        var length = collection.length;
9438        if (fromIndex < 0) {
9439          fromIndex = nativeMax(length + fromIndex, 0);
9440        }
9441        return isString(collection)
9442          ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
9443          : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
9444      }
9445  
9446      /**
9447       * Invokes the method at `path` of each element in `collection`, returning
9448       * an array of the results of each invoked method. Any additional arguments
9449       * are provided to each invoked method. If `path` is a function, it's invoked
9450       * for, and `this` bound to, each element in `collection`.
9451       *
9452       * @static
9453       * @memberOf _
9454       * @since 4.0.0
9455       * @category Collection
9456       * @param {Array|Object} collection The collection to iterate over.
9457       * @param {Array|Function|string} path The path of the method to invoke or
9458       *  the function invoked per iteration.
9459       * @param {...*} [args] The arguments to invoke each method with.
9460       * @returns {Array} Returns the array of results.
9461       * @example
9462       *
9463       * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
9464       * // => [[1, 5, 7], [1, 2, 3]]
9465       *
9466       * _.invokeMap([123, 456], String.prototype.split, '');
9467       * // => [['1', '2', '3'], ['4', '5', '6']]
9468       */
9469      var invokeMap = baseRest(function(collection, path, args) {
9470        var index = -1,
9471            isFunc = typeof path == 'function',
9472            result = isArrayLike(collection) ? Array(collection.length) : [];
9473  
9474        baseEach(collection, function(value) {
9475          result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
9476        });
9477        return result;
9478      });
9479  
9480      /**
9481       * Creates an object composed of keys generated from the results of running
9482       * each element of `collection` thru `iteratee`. The corresponding value of
9483       * each key is the last element responsible for generating the key. The
9484       * iteratee is invoked with one argument: (value).
9485       *
9486       * @static
9487       * @memberOf _
9488       * @since 4.0.0
9489       * @category Collection
9490       * @param {Array|Object} collection The collection to iterate over.
9491       * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9492       * @returns {Object} Returns the composed aggregate object.
9493       * @example
9494       *
9495       * var array = [
9496       *   { 'dir': 'left', 'code': 97 },
9497       *   { 'dir': 'right', 'code': 100 }
9498       * ];
9499       *
9500       * _.keyBy(array, function(o) {
9501       *   return String.fromCharCode(o.code);
9502       * });
9503       * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
9504       *
9505       * _.keyBy(array, 'dir');
9506       * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
9507       */
9508      var keyBy = createAggregator(function(result, value, key) {
9509        baseAssignValue(result, key, value);
9510      });
9511  
9512      /**
9513       * Creates an array of values by running each element in `collection` thru
9514       * `iteratee`. The iteratee is invoked with three arguments:
9515       * (value, index|key, collection).
9516       *
9517       * Many lodash methods are guarded to work as iteratees for methods like
9518       * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
9519       *
9520       * The guarded methods are:
9521       * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
9522       * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
9523       * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
9524       * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
9525       *
9526       * @static
9527       * @memberOf _
9528       * @since 0.1.0
9529       * @category Collection
9530       * @param {Array|Object} collection The collection to iterate over.
9531       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9532       * @returns {Array} Returns the new mapped array.
9533       * @example
9534       *
9535       * function square(n) {
9536       *   return n * n;
9537       * }
9538       *
9539       * _.map([4, 8], square);
9540       * // => [16, 64]
9541       *
9542       * _.map({ 'a': 4, 'b': 8 }, square);
9543       * // => [16, 64] (iteration order is not guaranteed)
9544       *
9545       * var users = [
9546       *   { 'user': 'barney' },
9547       *   { 'user': 'fred' }
9548       * ];
9549       *
9550       * // The `_.property` iteratee shorthand.
9551       * _.map(users, 'user');
9552       * // => ['barney', 'fred']
9553       */
9554      function map(collection, iteratee) {
9555        var func = isArray(collection) ? arrayMap : baseMap;
9556        return func(collection, getIteratee(iteratee, 3));
9557      }
9558  
9559      /**
9560       * This method is like `_.sortBy` except that it allows specifying the sort
9561       * orders of the iteratees to sort by. If `orders` is unspecified, all values
9562       * are sorted in ascending order. Otherwise, specify an order of "desc" for
9563       * descending or "asc" for ascending sort order of corresponding values.
9564       *
9565       * @static
9566       * @memberOf _
9567       * @since 4.0.0
9568       * @category Collection
9569       * @param {Array|Object} collection The collection to iterate over.
9570       * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
9571       *  The iteratees to sort by.
9572       * @param {string[]} [orders] The sort orders of `iteratees`.
9573       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
9574       * @returns {Array} Returns the new sorted array.
9575       * @example
9576       *
9577       * var users = [
9578       *   { 'user': 'fred',   'age': 48 },
9579       *   { 'user': 'barney', 'age': 34 },
9580       *   { 'user': 'fred',   'age': 40 },
9581       *   { 'user': 'barney', 'age': 36 }
9582       * ];
9583       *
9584       * // Sort by `user` in ascending order and by `age` in descending order.
9585       * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
9586       * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
9587       */
9588      function orderBy(collection, iteratees, orders, guard) {
9589        if (collection == null) {
9590          return [];
9591        }
9592        if (!isArray(iteratees)) {
9593          iteratees = iteratees == null ? [] : [iteratees];
9594        }
9595        orders = guard ? undefined : orders;
9596        if (!isArray(orders)) {
9597          orders = orders == null ? [] : [orders];
9598        }
9599        return baseOrderBy(collection, iteratees, orders);
9600      }
9601  
9602      /**
9603       * Creates an array of elements split into two groups, the first of which
9604       * contains elements `predicate` returns truthy for, the second of which
9605       * contains elements `predicate` returns falsey for. The predicate is
9606       * invoked with one argument: (value).
9607       *
9608       * @static
9609       * @memberOf _
9610       * @since 3.0.0
9611       * @category Collection
9612       * @param {Array|Object} collection The collection to iterate over.
9613       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9614       * @returns {Array} Returns the array of grouped elements.
9615       * @example
9616       *
9617       * var users = [
9618       *   { 'user': 'barney',  'age': 36, 'active': false },
9619       *   { 'user': 'fred',    'age': 40, 'active': true },
9620       *   { 'user': 'pebbles', 'age': 1,  'active': false }
9621       * ];
9622       *
9623       * _.partition(users, function(o) { return o.active; });
9624       * // => objects for [['fred'], ['barney', 'pebbles']]
9625       *
9626       * // The `_.matches` iteratee shorthand.
9627       * _.partition(users, { 'age': 1, 'active': false });
9628       * // => objects for [['pebbles'], ['barney', 'fred']]
9629       *
9630       * // The `_.matchesProperty` iteratee shorthand.
9631       * _.partition(users, ['active', false]);
9632       * // => objects for [['barney', 'pebbles'], ['fred']]
9633       *
9634       * // The `_.property` iteratee shorthand.
9635       * _.partition(users, 'active');
9636       * // => objects for [['fred'], ['barney', 'pebbles']]
9637       */
9638      var partition = createAggregator(function(result, value, key) {
9639        result[key ? 0 : 1].push(value);
9640      }, function() { return [[], []]; });
9641  
9642      /**
9643       * Reduces `collection` to a value which is the accumulated result of running
9644       * each element in `collection` thru `iteratee`, where each successive
9645       * invocation is supplied the return value of the previous. If `accumulator`
9646       * is not given, the first element of `collection` is used as the initial
9647       * value. The iteratee is invoked with four arguments:
9648       * (accumulator, value, index|key, collection).
9649       *
9650       * Many lodash methods are guarded to work as iteratees for methods like
9651       * `_.reduce`, `_.reduceRight`, and `_.transform`.
9652       *
9653       * The guarded methods are:
9654       * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
9655       * and `sortBy`
9656       *
9657       * @static
9658       * @memberOf _
9659       * @since 0.1.0
9660       * @category Collection
9661       * @param {Array|Object} collection The collection to iterate over.
9662       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9663       * @param {*} [accumulator] The initial value.
9664       * @returns {*} Returns the accumulated value.
9665       * @see _.reduceRight
9666       * @example
9667       *
9668       * _.reduce([1, 2], function(sum, n) {
9669       *   return sum + n;
9670       * }, 0);
9671       * // => 3
9672       *
9673       * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
9674       *   (result[value] || (result[value] = [])).push(key);
9675       *   return result;
9676       * }, {});
9677       * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
9678       */
9679      function reduce(collection, iteratee, accumulator) {
9680        var func = isArray(collection) ? arrayReduce : baseReduce,
9681            initAccum = arguments.length < 3;
9682  
9683        return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
9684      }
9685  
9686      /**
9687       * This method is like `_.reduce` except that it iterates over elements of
9688       * `collection` from right to left.
9689       *
9690       * @static
9691       * @memberOf _
9692       * @since 0.1.0
9693       * @category Collection
9694       * @param {Array|Object} collection The collection to iterate over.
9695       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9696       * @param {*} [accumulator] The initial value.
9697       * @returns {*} Returns the accumulated value.
9698       * @see _.reduce
9699       * @example
9700       *
9701       * var array = [[0, 1], [2, 3], [4, 5]];
9702       *
9703       * _.reduceRight(array, function(flattened, other) {
9704       *   return flattened.concat(other);
9705       * }, []);
9706       * // => [4, 5, 2, 3, 0, 1]
9707       */
9708      function reduceRight(collection, iteratee, accumulator) {
9709        var func = isArray(collection) ? arrayReduceRight : baseReduce,
9710            initAccum = arguments.length < 3;
9711  
9712        return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
9713      }
9714  
9715      /**
9716       * The opposite of `_.filter`; this method returns the elements of `collection`
9717       * that `predicate` does **not** return truthy for.
9718       *
9719       * @static
9720       * @memberOf _
9721       * @since 0.1.0
9722       * @category Collection
9723       * @param {Array|Object} collection The collection to iterate over.
9724       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9725       * @returns {Array} Returns the new filtered array.
9726       * @see _.filter
9727       * @example
9728       *
9729       * var users = [
9730       *   { 'user': 'barney', 'age': 36, 'active': false },
9731       *   { 'user': 'fred',   'age': 40, 'active': true }
9732       * ];
9733       *
9734       * _.reject(users, function(o) { return !o.active; });
9735       * // => objects for ['fred']
9736       *
9737       * // The `_.matches` iteratee shorthand.
9738       * _.reject(users, { 'age': 40, 'active': true });
9739       * // => objects for ['barney']
9740       *
9741       * // The `_.matchesProperty` iteratee shorthand.
9742       * _.reject(users, ['active', false]);
9743       * // => objects for ['fred']
9744       *
9745       * // The `_.property` iteratee shorthand.
9746       * _.reject(users, 'active');
9747       * // => objects for ['barney']
9748       */
9749      function reject(collection, predicate) {
9750        var func = isArray(collection) ? arrayFilter : baseFilter;
9751        return func(collection, negate(getIteratee(predicate, 3)));
9752      }
9753  
9754      /**
9755       * Gets a random element from `collection`.
9756       *
9757       * @static
9758       * @memberOf _
9759       * @since 2.0.0
9760       * @category Collection
9761       * @param {Array|Object} collection The collection to sample.
9762       * @returns {*} Returns the random element.
9763       * @example
9764       *
9765       * _.sample([1, 2, 3, 4]);
9766       * // => 2
9767       */
9768      function sample(collection) {
9769        var func = isArray(collection) ? arraySample : baseSample;
9770        return func(collection);
9771      }
9772  
9773      /**
9774       * Gets `n` random elements at unique keys from `collection` up to the
9775       * size of `collection`.
9776       *
9777       * @static
9778       * @memberOf _
9779       * @since 4.0.0
9780       * @category Collection
9781       * @param {Array|Object} collection The collection to sample.
9782       * @param {number} [n=1] The number of elements to sample.
9783       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9784       * @returns {Array} Returns the random elements.
9785       * @example
9786       *
9787       * _.sampleSize([1, 2, 3], 2);
9788       * // => [3, 1]
9789       *
9790       * _.sampleSize([1, 2, 3], 4);
9791       * // => [2, 3, 1]
9792       */
9793      function sampleSize(collection, n, guard) {
9794        if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
9795          n = 1;
9796        } else {
9797          n = toInteger(n);
9798        }
9799        var func = isArray(collection) ? arraySampleSize : baseSampleSize;
9800        return func(collection, n);
9801      }
9802  
9803      /**
9804       * Creates an array of shuffled values, using a version of the
9805       * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
9806       *
9807       * @static
9808       * @memberOf _
9809       * @since 0.1.0
9810       * @category Collection
9811       * @param {Array|Object} collection The collection to shuffle.
9812       * @returns {Array} Returns the new shuffled array.
9813       * @example
9814       *
9815       * _.shuffle([1, 2, 3, 4]);
9816       * // => [4, 1, 3, 2]
9817       */
9818      function shuffle(collection) {
9819        var func = isArray(collection) ? arrayShuffle : baseShuffle;
9820        return func(collection);
9821      }
9822  
9823      /**
9824       * Gets the size of `collection` by returning its length for array-like
9825       * values or the number of own enumerable string keyed properties for objects.
9826       *
9827       * @static
9828       * @memberOf _
9829       * @since 0.1.0
9830       * @category Collection
9831       * @param {Array|Object|string} collection The collection to inspect.
9832       * @returns {number} Returns the collection size.
9833       * @example
9834       *
9835       * _.size([1, 2, 3]);
9836       * // => 3
9837       *
9838       * _.size({ 'a': 1, 'b': 2 });
9839       * // => 2
9840       *
9841       * _.size('pebbles');
9842       * // => 7
9843       */
9844      function size(collection) {
9845        if (collection == null) {
9846          return 0;
9847        }
9848        if (isArrayLike(collection)) {
9849          return isString(collection) ? stringSize(collection) : collection.length;
9850        }
9851        var tag = getTag(collection);
9852        if (tag == mapTag || tag == setTag) {
9853          return collection.size;
9854        }
9855        return baseKeys(collection).length;
9856      }
9857  
9858      /**
9859       * Checks if `predicate` returns truthy for **any** element of `collection`.
9860       * Iteration is stopped once `predicate` returns truthy. The predicate is
9861       * invoked with three arguments: (value, index|key, collection).
9862       *
9863       * @static
9864       * @memberOf _
9865       * @since 0.1.0
9866       * @category Collection
9867       * @param {Array|Object} collection The collection to iterate over.
9868       * @param {Function} [predicate=_.identity] The function invoked per iteration.
9869       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9870       * @returns {boolean} Returns `true` if any element passes the predicate check,
9871       *  else `false`.
9872       * @example
9873       *
9874       * _.some([null, 0, 'yes', false], Boolean);
9875       * // => true
9876       *
9877       * var users = [
9878       *   { 'user': 'barney', 'active': true },
9879       *   { 'user': 'fred',   'active': false }
9880       * ];
9881       *
9882       * // The `_.matches` iteratee shorthand.
9883       * _.some(users, { 'user': 'barney', 'active': false });
9884       * // => false
9885       *
9886       * // The `_.matchesProperty` iteratee shorthand.
9887       * _.some(users, ['active', false]);
9888       * // => true
9889       *
9890       * // The `_.property` iteratee shorthand.
9891       * _.some(users, 'active');
9892       * // => true
9893       */
9894      function some(collection, predicate, guard) {
9895        var func = isArray(collection) ? arraySome : baseSome;
9896        if (guard && isIterateeCall(collection, predicate, guard)) {
9897          predicate = undefined;
9898        }
9899        return func(collection, getIteratee(predicate, 3));
9900      }
9901  
9902      /**
9903       * Creates an array of elements, sorted in ascending order by the results of
9904       * running each element in a collection thru each iteratee. This method
9905       * performs a stable sort, that is, it preserves the original sort order of
9906       * equal elements. The iteratees are invoked with one argument: (value).
9907       *
9908       * @static
9909       * @memberOf _
9910       * @since 0.1.0
9911       * @category Collection
9912       * @param {Array|Object} collection The collection to iterate over.
9913       * @param {...(Function|Function[])} [iteratees=[_.identity]]
9914       *  The iteratees to sort by.
9915       * @returns {Array} Returns the new sorted array.
9916       * @example
9917       *
9918       * var users = [
9919       *   { 'user': 'fred',   'age': 48 },
9920       *   { 'user': 'barney', 'age': 36 },
9921       *   { 'user': 'fred',   'age': 40 },
9922       *   { 'user': 'barney', 'age': 34 }
9923       * ];
9924       *
9925       * _.sortBy(users, [function(o) { return o.user; }]);
9926       * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
9927       *
9928       * _.sortBy(users, ['user', 'age']);
9929       * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
9930       */
9931      var sortBy = baseRest(function(collection, iteratees) {
9932        if (collection == null) {
9933          return [];
9934        }
9935        var length = iteratees.length;
9936        if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
9937          iteratees = [];
9938        } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
9939          iteratees = [iteratees[0]];
9940        }
9941        return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
9942      });
9943  
9944      /*------------------------------------------------------------------------*/
9945  
9946      /**
9947       * Gets the timestamp of the number of milliseconds that have elapsed since
9948       * the Unix epoch (1 January 1970 00:00:00 UTC).
9949       *
9950       * @static
9951       * @memberOf _
9952       * @since 2.4.0
9953       * @category Date
9954       * @returns {number} Returns the timestamp.
9955       * @example
9956       *
9957       * _.defer(function(stamp) {
9958       *   console.log(_.now() - stamp);
9959       * }, _.now());
9960       * // => Logs the number of milliseconds it took for the deferred invocation.
9961       */
9962      var now = ctxNow || function() {
9963        return root.Date.now();
9964      };
9965  
9966      /*------------------------------------------------------------------------*/
9967  
9968      /**
9969       * The opposite of `_.before`; this method creates a function that invokes
9970       * `func` once it's called `n` or more times.
9971       *
9972       * @static
9973       * @memberOf _
9974       * @since 0.1.0
9975       * @category Function
9976       * @param {number} n The number of calls before `func` is invoked.
9977       * @param {Function} func The function to restrict.
9978       * @returns {Function} Returns the new restricted function.
9979       * @example
9980       *
9981       * var saves = ['profile', 'settings'];
9982       *
9983       * var done = _.after(saves.length, function() {
9984       *   console.log('done saving!');
9985       * });
9986       *
9987       * _.forEach(saves, function(type) {
9988       *   asyncSave({ 'type': type, 'complete': done });
9989       * });
9990       * // => Logs 'done saving!' after the two async saves have completed.
9991       */
9992      function after(n, func) {
9993        if (typeof func != 'function') {
9994          throw new TypeError(FUNC_ERROR_TEXT);
9995        }
9996        n = toInteger(n);
9997        return function() {
9998          if (--n < 1) {
9999            return func.apply(this, arguments);
10000          }
10001        };
10002      }
10003  
10004      /**
10005       * Creates a function that invokes `func`, with up to `n` arguments,
10006       * ignoring any additional arguments.
10007       *
10008       * @static
10009       * @memberOf _
10010       * @since 3.0.0
10011       * @category Function
10012       * @param {Function} func The function to cap arguments for.
10013       * @param {number} [n=func.length] The arity cap.
10014       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10015       * @returns {Function} Returns the new capped function.
10016       * @example
10017       *
10018       * _.map(['6', '8', '10'], _.ary(parseInt, 1));
10019       * // => [6, 8, 10]
10020       */
10021      function ary(func, n, guard) {
10022        n = guard ? undefined : n;
10023        n = (func && n == null) ? func.length : n;
10024        return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
10025      }
10026  
10027      /**
10028       * Creates a function that invokes `func`, with the `this` binding and arguments
10029       * of the created function, while it's called less than `n` times. Subsequent
10030       * calls to the created function return the result of the last `func` invocation.
10031       *
10032       * @static
10033       * @memberOf _
10034       * @since 3.0.0
10035       * @category Function
10036       * @param {number} n The number of calls at which `func` is no longer invoked.
10037       * @param {Function} func The function to restrict.
10038       * @returns {Function} Returns the new restricted function.
10039       * @example
10040       *
10041       * jQuery(element).on('click', _.before(5, addContactToList));
10042       * // => Allows adding up to 4 contacts to the list.
10043       */
10044      function before(n, func) {
10045        var result;
10046        if (typeof func != 'function') {
10047          throw new TypeError(FUNC_ERROR_TEXT);
10048        }
10049        n = toInteger(n);
10050        return function() {
10051          if (--n > 0) {
10052            result = func.apply(this, arguments);
10053          }
10054          if (n <= 1) {
10055            func = undefined;
10056          }
10057          return result;
10058        };
10059      }
10060  
10061      /**
10062       * Creates a function that invokes `func` with the `this` binding of `thisArg`
10063       * and `partials` prepended to the arguments it receives.
10064       *
10065       * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
10066       * may be used as a placeholder for partially applied arguments.
10067       *
10068       * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
10069       * property of bound functions.
10070       *
10071       * @static
10072       * @memberOf _
10073       * @since 0.1.0
10074       * @category Function
10075       * @param {Function} func The function to bind.
10076       * @param {*} thisArg The `this` binding of `func`.
10077       * @param {...*} [partials] The arguments to be partially applied.
10078       * @returns {Function} Returns the new bound function.
10079       * @example
10080       *
10081       * function greet(greeting, punctuation) {
10082       *   return greeting + ' ' + this.user + punctuation;
10083       * }
10084       *
10085       * var object = { 'user': 'fred' };
10086       *
10087       * var bound = _.bind(greet, object, 'hi');
10088       * bound('!');
10089       * // => 'hi fred!'
10090       *
10091       * // Bound with placeholders.
10092       * var bound = _.bind(greet, object, _, '!');
10093       * bound('hi');
10094       * // => 'hi fred!'
10095       */
10096      var bind = baseRest(function(func, thisArg, partials) {
10097        var bitmask = WRAP_BIND_FLAG;
10098        if (partials.length) {
10099          var holders = replaceHolders(partials, getHolder(bind));
10100          bitmask |= WRAP_PARTIAL_FLAG;
10101        }
10102        return createWrap(func, bitmask, thisArg, partials, holders);
10103      });
10104  
10105      /**
10106       * Creates a function that invokes the method at `object[key]` with `partials`
10107       * prepended to the arguments it receives.
10108       *
10109       * This method differs from `_.bind` by allowing bound functions to reference
10110       * methods that may be redefined or don't yet exist. See
10111       * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
10112       * for more details.
10113       *
10114       * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
10115       * builds, may be used as a placeholder for partially applied arguments.
10116       *
10117       * @static
10118       * @memberOf _
10119       * @since 0.10.0
10120       * @category Function
10121       * @param {Object} object The object to invoke the method on.
10122       * @param {string} key The key of the method.
10123       * @param {...*} [partials] The arguments to be partially applied.
10124       * @returns {Function} Returns the new bound function.
10125       * @example
10126       *
10127       * var object = {
10128       *   'user': 'fred',
10129       *   'greet': function(greeting, punctuation) {
10130       *     return greeting + ' ' + this.user + punctuation;
10131       *   }
10132       * };
10133       *
10134       * var bound = _.bindKey(object, 'greet', 'hi');
10135       * bound('!');
10136       * // => 'hi fred!'
10137       *
10138       * object.greet = function(greeting, punctuation) {
10139       *   return greeting + 'ya ' + this.user + punctuation;
10140       * };
10141       *
10142       * bound('!');
10143       * // => 'hiya fred!'
10144       *
10145       * // Bound with placeholders.
10146       * var bound = _.bindKey(object, 'greet', _, '!');
10147       * bound('hi');
10148       * // => 'hiya fred!'
10149       */
10150      var bindKey = baseRest(function(object, key, partials) {
10151        var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10152        if (partials.length) {
10153          var holders = replaceHolders(partials, getHolder(bindKey));
10154          bitmask |= WRAP_PARTIAL_FLAG;
10155        }
10156        return createWrap(key, bitmask, object, partials, holders);
10157      });
10158  
10159      /**
10160       * Creates a function that accepts arguments of `func` and either invokes
10161       * `func` returning its result, if at least `arity` number of arguments have
10162       * been provided, or returns a function that accepts the remaining `func`
10163       * arguments, and so on. The arity of `func` may be specified if `func.length`
10164       * is not sufficient.
10165       *
10166       * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
10167       * may be used as a placeholder for provided arguments.
10168       *
10169       * **Note:** This method doesn't set the "length" property of curried functions.
10170       *
10171       * @static
10172       * @memberOf _
10173       * @since 2.0.0
10174       * @category Function
10175       * @param {Function} func The function to curry.
10176       * @param {number} [arity=func.length] The arity of `func`.
10177       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10178       * @returns {Function} Returns the new curried function.
10179       * @example
10180       *
10181       * var abc = function(a, b, c) {
10182       *   return [a, b, c];
10183       * };
10184       *
10185       * var curried = _.curry(abc);
10186       *
10187       * curried(1)(2)(3);
10188       * // => [1, 2, 3]
10189       *
10190       * curried(1, 2)(3);
10191       * // => [1, 2, 3]
10192       *
10193       * curried(1, 2, 3);
10194       * // => [1, 2, 3]
10195       *
10196       * // Curried with placeholders.
10197       * curried(1)(_, 3)(2);
10198       * // => [1, 2, 3]
10199       */
10200      function curry(func, arity, guard) {
10201        arity = guard ? undefined : arity;
10202        var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10203        result.placeholder = curry.placeholder;
10204        return result;
10205      }
10206  
10207      /**
10208       * This method is like `_.curry` except that arguments are applied to `func`
10209       * in the manner of `_.partialRight` instead of `_.partial`.
10210       *
10211       * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
10212       * builds, may be used as a placeholder for provided arguments.
10213       *
10214       * **Note:** This method doesn't set the "length" property of curried functions.
10215       *
10216       * @static
10217       * @memberOf _
10218       * @since 3.0.0
10219       * @category Function
10220       * @param {Function} func The function to curry.
10221       * @param {number} [arity=func.length] The arity of `func`.
10222       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10223       * @returns {Function} Returns the new curried function.
10224       * @example
10225       *
10226       * var abc = function(a, b, c) {
10227       *   return [a, b, c];
10228       * };
10229       *
10230       * var curried = _.curryRight(abc);
10231       *
10232       * curried(3)(2)(1);
10233       * // => [1, 2, 3]
10234       *
10235       * curried(2, 3)(1);
10236       * // => [1, 2, 3]
10237       *
10238       * curried(1, 2, 3);
10239       * // => [1, 2, 3]
10240       *
10241       * // Curried with placeholders.
10242       * curried(3)(1, _)(2);
10243       * // => [1, 2, 3]
10244       */
10245      function curryRight(func, arity, guard) {
10246        arity = guard ? undefined : arity;
10247        var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10248        result.placeholder = curryRight.placeholder;
10249        return result;
10250      }
10251  
10252      /**
10253       * Creates a debounced function that delays invoking `func` until after `wait`
10254       * milliseconds have elapsed since the last time the debounced function was
10255       * invoked. The debounced function comes with a `cancel` method to cancel
10256       * delayed `func` invocations and a `flush` method to immediately invoke them.
10257       * Provide `options` to indicate whether `func` should be invoked on the
10258       * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
10259       * with the last arguments provided to the debounced function. Subsequent
10260       * calls to the debounced function return the result of the last `func`
10261       * invocation.
10262       *
10263       * **Note:** If `leading` and `trailing` options are `true`, `func` is
10264       * invoked on the trailing edge of the timeout only if the debounced function
10265       * is invoked more than once during the `wait` timeout.
10266       *
10267       * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
10268       * until to the next tick, similar to `setTimeout` with a timeout of `0`.
10269       *
10270       * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
10271       * for details over the differences between `_.debounce` and `_.throttle`.
10272       *
10273       * @static
10274       * @memberOf _
10275       * @since 0.1.0
10276       * @category Function
10277       * @param {Function} func The function to debounce.
10278       * @param {number} [wait=0] The number of milliseconds to delay.
10279       * @param {Object} [options={}] The options object.
10280       * @param {boolean} [options.leading=false]
10281       *  Specify invoking on the leading edge of the timeout.
10282       * @param {number} [options.maxWait]
10283       *  The maximum time `func` is allowed to be delayed before it's invoked.
10284       * @param {boolean} [options.trailing=true]
10285       *  Specify invoking on the trailing edge of the timeout.
10286       * @returns {Function} Returns the new debounced function.
10287       * @example
10288       *
10289       * // Avoid costly calculations while the window size is in flux.
10290       * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
10291       *
10292       * // Invoke `sendMail` when clicked, debouncing subsequent calls.
10293       * jQuery(element).on('click', _.debounce(sendMail, 300, {
10294       *   'leading': true,
10295       *   'trailing': false
10296       * }));
10297       *
10298       * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
10299       * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
10300       * var source = new EventSource('/stream');
10301       * jQuery(source).on('message', debounced);
10302       *
10303       * // Cancel the trailing debounced invocation.
10304       * jQuery(window).on('popstate', debounced.cancel);
10305       */
10306      function debounce(func, wait, options) {
10307        var lastArgs,
10308            lastThis,
10309            maxWait,
10310            result,
10311            timerId,
10312            lastCallTime,
10313            lastInvokeTime = 0,
10314            leading = false,
10315            maxing = false,
10316            trailing = true;
10317  
10318        if (typeof func != 'function') {
10319          throw new TypeError(FUNC_ERROR_TEXT);
10320        }
10321        wait = toNumber(wait) || 0;
10322        if (isObject(options)) {
10323          leading = !!options.leading;
10324          maxing = 'maxWait' in options;
10325          maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
10326          trailing = 'trailing' in options ? !!options.trailing : trailing;
10327        }
10328  
10329        function invokeFunc(time) {
10330          var args = lastArgs,
10331              thisArg = lastThis;
10332  
10333          lastArgs = lastThis = undefined;
10334          lastInvokeTime = time;
10335          result = func.apply(thisArg, args);
10336          return result;
10337        }
10338  
10339        function leadingEdge(time) {
10340          // Reset any `maxWait` timer.
10341          lastInvokeTime = time;
10342          // Start the timer for the trailing edge.
10343          timerId = setTimeout(timerExpired, wait);
10344          // Invoke the leading edge.
10345          return leading ? invokeFunc(time) : result;
10346        }
10347  
10348        function remainingWait(time) {
10349          var timeSinceLastCall = time - lastCallTime,
10350              timeSinceLastInvoke = time - lastInvokeTime,
10351              timeWaiting = wait - timeSinceLastCall;
10352  
10353          return maxing
10354            ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
10355            : timeWaiting;
10356        }
10357  
10358        function shouldInvoke(time) {
10359          var timeSinceLastCall = time - lastCallTime,
10360              timeSinceLastInvoke = time - lastInvokeTime;
10361  
10362          // Either this is the first call, activity has stopped and we're at the
10363          // trailing edge, the system time has gone backwards and we're treating
10364          // it as the trailing edge, or we've hit the `maxWait` limit.
10365          return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
10366            (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
10367        }
10368  
10369        function timerExpired() {
10370          var time = now();
10371          if (shouldInvoke(time)) {
10372            return trailingEdge(time);
10373          }
10374          // Restart the timer.
10375          timerId = setTimeout(timerExpired, remainingWait(time));
10376        }
10377  
10378        function trailingEdge(time) {
10379          timerId = undefined;
10380  
10381          // Only invoke if we have `lastArgs` which means `func` has been
10382          // debounced at least once.
10383          if (trailing && lastArgs) {
10384            return invokeFunc(time);
10385          }
10386          lastArgs = lastThis = undefined;
10387          return result;
10388        }
10389  
10390        function cancel() {
10391          if (timerId !== undefined) {
10392            clearTimeout(timerId);
10393          }
10394          lastInvokeTime = 0;
10395          lastArgs = lastCallTime = lastThis = timerId = undefined;
10396        }
10397  
10398        function flush() {
10399          return timerId === undefined ? result : trailingEdge(now());
10400        }
10401  
10402        function debounced() {
10403          var time = now(),
10404              isInvoking = shouldInvoke(time);
10405  
10406          lastArgs = arguments;
10407          lastThis = this;
10408          lastCallTime = time;
10409  
10410          if (isInvoking) {
10411            if (timerId === undefined) {
10412              return leadingEdge(lastCallTime);
10413            }
10414            if (maxing) {
10415              // Handle invocations in a tight loop.
10416              timerId = setTimeout(timerExpired, wait);
10417              return invokeFunc(lastCallTime);
10418            }
10419          }
10420          if (timerId === undefined) {
10421            timerId = setTimeout(timerExpired, wait);
10422          }
10423          return result;
10424        }
10425        debounced.cancel = cancel;
10426        debounced.flush = flush;
10427        return debounced;
10428      }
10429  
10430      /**
10431       * Defers invoking the `func` until the current call stack has cleared. Any
10432       * additional arguments are provided to `func` when it's invoked.
10433       *
10434       * @static
10435       * @memberOf _
10436       * @since 0.1.0
10437       * @category Function
10438       * @param {Function} func The function to defer.
10439       * @param {...*} [args] The arguments to invoke `func` with.
10440       * @returns {number} Returns the timer id.
10441       * @example
10442       *
10443       * _.defer(function(text) {
10444       *   console.log(text);
10445       * }, 'deferred');
10446       * // => Logs 'deferred' after one millisecond.
10447       */
10448      var defer = baseRest(function(func, args) {
10449        return baseDelay(func, 1, args);
10450      });
10451  
10452      /**
10453       * Invokes `func` after `wait` milliseconds. Any additional arguments are
10454       * provided to `func` when it's invoked.
10455       *
10456       * @static
10457       * @memberOf _
10458       * @since 0.1.0
10459       * @category Function
10460       * @param {Function} func The function to delay.
10461       * @param {number} wait The number of milliseconds to delay invocation.
10462       * @param {...*} [args] The arguments to invoke `func` with.
10463       * @returns {number} Returns the timer id.
10464       * @example
10465       *
10466       * _.delay(function(text) {
10467       *   console.log(text);
10468       * }, 1000, 'later');
10469       * // => Logs 'later' after one second.
10470       */
10471      var delay = baseRest(function(func, wait, args) {
10472        return baseDelay(func, toNumber(wait) || 0, args);
10473      });
10474  
10475      /**
10476       * Creates a function that invokes `func` with arguments reversed.
10477       *
10478       * @static
10479       * @memberOf _
10480       * @since 4.0.0
10481       * @category Function
10482       * @param {Function} func The function to flip arguments for.
10483       * @returns {Function} Returns the new flipped function.
10484       * @example
10485       *
10486       * var flipped = _.flip(function() {
10487       *   return _.toArray(arguments);
10488       * });
10489       *
10490       * flipped('a', 'b', 'c', 'd');
10491       * // => ['d', 'c', 'b', 'a']
10492       */
10493      function flip(func) {
10494        return createWrap(func, WRAP_FLIP_FLAG);
10495      }
10496  
10497      /**
10498       * Creates a function that memoizes the result of `func`. If `resolver` is
10499       * provided, it determines the cache key for storing the result based on the
10500       * arguments provided to the memoized function. By default, the first argument
10501       * provided to the memoized function is used as the map cache key. The `func`
10502       * is invoked with the `this` binding of the memoized function.
10503       *
10504       * **Note:** The cache is exposed as the `cache` property on the memoized
10505       * function. Its creation may be customized by replacing the `_.memoize.Cache`
10506       * constructor with one whose instances implement the
10507       * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
10508       * method interface of `clear`, `delete`, `get`, `has`, and `set`.
10509       *
10510       * @static
10511       * @memberOf _
10512       * @since 0.1.0
10513       * @category Function
10514       * @param {Function} func The function to have its output memoized.
10515       * @param {Function} [resolver] The function to resolve the cache key.
10516       * @returns {Function} Returns the new memoized function.
10517       * @example
10518       *
10519       * var object = { 'a': 1, 'b': 2 };
10520       * var other = { 'c': 3, 'd': 4 };
10521       *
10522       * var values = _.memoize(_.values);
10523       * values(object);
10524       * // => [1, 2]
10525       *
10526       * values(other);
10527       * // => [3, 4]
10528       *
10529       * object.a = 2;
10530       * values(object);
10531       * // => [1, 2]
10532       *
10533       * // Modify the result cache.
10534       * values.cache.set(object, ['a', 'b']);
10535       * values(object);
10536       * // => ['a', 'b']
10537       *
10538       * // Replace `_.memoize.Cache`.
10539       * _.memoize.Cache = WeakMap;
10540       */
10541      function memoize(func, resolver) {
10542        if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
10543          throw new TypeError(FUNC_ERROR_TEXT);
10544        }
10545        var memoized = function() {
10546          var args = arguments,
10547              key = resolver ? resolver.apply(this, args) : args[0],
10548              cache = memoized.cache;
10549  
10550          if (cache.has(key)) {
10551            return cache.get(key);
10552          }
10553          var result = func.apply(this, args);
10554          memoized.cache = cache.set(key, result) || cache;
10555          return result;
10556        };
10557        memoized.cache = new (memoize.Cache || MapCache);
10558        return memoized;
10559      }
10560  
10561      // Expose `MapCache`.
10562      memoize.Cache = MapCache;
10563  
10564      /**
10565       * Creates a function that negates the result of the predicate `func`. The
10566       * `func` predicate is invoked with the `this` binding and arguments of the
10567       * created function.
10568       *
10569       * @static
10570       * @memberOf _
10571       * @since 3.0.0
10572       * @category Function
10573       * @param {Function} predicate The predicate to negate.
10574       * @returns {Function} Returns the new negated function.
10575       * @example
10576       *
10577       * function isEven(n) {
10578       *   return n % 2 == 0;
10579       * }
10580       *
10581       * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
10582       * // => [1, 3, 5]
10583       */
10584      function negate(predicate) {
10585        if (typeof predicate != 'function') {
10586          throw new TypeError(FUNC_ERROR_TEXT);
10587        }
10588        return function() {
10589          var args = arguments;
10590          switch (args.length) {
10591            case 0: return !predicate.call(this);
10592            case 1: return !predicate.call(this, args[0]);
10593            case 2: return !predicate.call(this, args[0], args[1]);
10594            case 3: return !predicate.call(this, args[0], args[1], args[2]);
10595          }
10596          return !predicate.apply(this, args);
10597        };
10598      }
10599  
10600      /**
10601       * Creates a function that is restricted to invoking `func` once. Repeat calls
10602       * to the function return the value of the first invocation. The `func` is
10603       * invoked with the `this` binding and arguments of the created function.
10604       *
10605       * @static
10606       * @memberOf _
10607       * @since 0.1.0
10608       * @category Function
10609       * @param {Function} func The function to restrict.
10610       * @returns {Function} Returns the new restricted function.
10611       * @example
10612       *
10613       * var initialize = _.once(createApplication);
10614       * initialize();
10615       * initialize();
10616       * // => `createApplication` is invoked once
10617       */
10618      function once(func) {
10619        return before(2, func);
10620      }
10621  
10622      /**
10623       * Creates a function that invokes `func` with its arguments transformed.
10624       *
10625       * @static
10626       * @since 4.0.0
10627       * @memberOf _
10628       * @category Function
10629       * @param {Function} func The function to wrap.
10630       * @param {...(Function|Function[])} [transforms=[_.identity]]
10631       *  The argument transforms.
10632       * @returns {Function} Returns the new function.
10633       * @example
10634       *
10635       * function doubled(n) {
10636       *   return n * 2;
10637       * }
10638       *
10639       * function square(n) {
10640       *   return n * n;
10641       * }
10642       *
10643       * var func = _.overArgs(function(x, y) {
10644       *   return [x, y];
10645       * }, [square, doubled]);
10646       *
10647       * func(9, 3);
10648       * // => [81, 6]
10649       *
10650       * func(10, 5);
10651       * // => [100, 10]
10652       */
10653      var overArgs = castRest(function(func, transforms) {
10654        transforms = (transforms.length == 1 && isArray(transforms[0]))
10655          ? arrayMap(transforms[0], baseUnary(getIteratee()))
10656          : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
10657  
10658        var funcsLength = transforms.length;
10659        return baseRest(function(args) {
10660          var index = -1,
10661              length = nativeMin(args.length, funcsLength);
10662  
10663          while (++index < length) {
10664            args[index] = transforms[index].call(this, args[index]);
10665          }
10666          return apply(func, this, args);
10667        });
10668      });
10669  
10670      /**
10671       * Creates a function that invokes `func` with `partials` prepended to the
10672       * arguments it receives. This method is like `_.bind` except it does **not**
10673       * alter the `this` binding.
10674       *
10675       * The `_.partial.placeholder` value, which defaults to `_` in monolithic
10676       * builds, may be used as a placeholder for partially applied arguments.
10677       *
10678       * **Note:** This method doesn't set the "length" property of partially
10679       * applied functions.
10680       *
10681       * @static
10682       * @memberOf _
10683       * @since 0.2.0
10684       * @category Function
10685       * @param {Function} func The function to partially apply arguments to.
10686       * @param {...*} [partials] The arguments to be partially applied.
10687       * @returns {Function} Returns the new partially applied function.
10688       * @example
10689       *
10690       * function greet(greeting, name) {
10691       *   return greeting + ' ' + name;
10692       * }
10693       *
10694       * var sayHelloTo = _.partial(greet, 'hello');
10695       * sayHelloTo('fred');
10696       * // => 'hello fred'
10697       *
10698       * // Partially applied with placeholders.
10699       * var greetFred = _.partial(greet, _, 'fred');
10700       * greetFred('hi');
10701       * // => 'hi fred'
10702       */
10703      var partial = baseRest(function(func, partials) {
10704        var holders = replaceHolders(partials, getHolder(partial));
10705        return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
10706      });
10707  
10708      /**
10709       * This method is like `_.partial` except that partially applied arguments
10710       * are appended to the arguments it receives.
10711       *
10712       * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
10713       * builds, may be used as a placeholder for partially applied arguments.
10714       *
10715       * **Note:** This method doesn't set the "length" property of partially
10716       * applied functions.
10717       *
10718       * @static
10719       * @memberOf _
10720       * @since 1.0.0
10721       * @category Function
10722       * @param {Function} func The function to partially apply arguments to.
10723       * @param {...*} [partials] The arguments to be partially applied.
10724       * @returns {Function} Returns the new partially applied function.
10725       * @example
10726       *
10727       * function greet(greeting, name) {
10728       *   return greeting + ' ' + name;
10729       * }
10730       *
10731       * var greetFred = _.partialRight(greet, 'fred');
10732       * greetFred('hi');
10733       * // => 'hi fred'
10734       *
10735       * // Partially applied with placeholders.
10736       * var sayHelloTo = _.partialRight(greet, 'hello', _);
10737       * sayHelloTo('fred');
10738       * // => 'hello fred'
10739       */
10740      var partialRight = baseRest(function(func, partials) {
10741        var holders = replaceHolders(partials, getHolder(partialRight));
10742        return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
10743      });
10744  
10745      /**
10746       * Creates a function that invokes `func` with arguments arranged according
10747       * to the specified `indexes` where the argument value at the first index is
10748       * provided as the first argument, the argument value at the second index is
10749       * provided as the second argument, and so on.
10750       *
10751       * @static
10752       * @memberOf _
10753       * @since 3.0.0
10754       * @category Function
10755       * @param {Function} func The function to rearrange arguments for.
10756       * @param {...(number|number[])} indexes The arranged argument indexes.
10757       * @returns {Function} Returns the new function.
10758       * @example
10759       *
10760       * var rearged = _.rearg(function(a, b, c) {
10761       *   return [a, b, c];
10762       * }, [2, 0, 1]);
10763       *
10764       * rearged('b', 'c', 'a')
10765       * // => ['a', 'b', 'c']
10766       */
10767      var rearg = flatRest(function(func, indexes) {
10768        return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
10769      });
10770  
10771      /**
10772       * Creates a function that invokes `func` with the `this` binding of the
10773       * created function and arguments from `start` and beyond provided as
10774       * an array.
10775       *
10776       * **Note:** This method is based on the
10777       * [rest parameter](https://mdn.io/rest_parameters).
10778       *
10779       * @static
10780       * @memberOf _
10781       * @since 4.0.0
10782       * @category Function
10783       * @param {Function} func The function to apply a rest parameter to.
10784       * @param {number} [start=func.length-1] The start position of the rest parameter.
10785       * @returns {Function} Returns the new function.
10786       * @example
10787       *
10788       * var say = _.rest(function(what, names) {
10789       *   return what + ' ' + _.initial(names).join(', ') +
10790       *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
10791       * });
10792       *
10793       * say('hello', 'fred', 'barney', 'pebbles');
10794       * // => 'hello fred, barney, & pebbles'
10795       */
10796      function rest(func, start) {
10797        if (typeof func != 'function') {
10798          throw new TypeError(FUNC_ERROR_TEXT);
10799        }
10800        start = start === undefined ? start : toInteger(start);
10801        return baseRest(func, start);
10802      }
10803  
10804      /**
10805       * Creates a function that invokes `func` with the `this` binding of the
10806       * create function and an array of arguments much like
10807       * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
10808       *
10809       * **Note:** This method is based on the
10810       * [spread operator](https://mdn.io/spread_operator).
10811       *
10812       * @static
10813       * @memberOf _
10814       * @since 3.2.0
10815       * @category Function
10816       * @param {Function} func The function to spread arguments over.
10817       * @param {number} [start=0] The start position of the spread.
10818       * @returns {Function} Returns the new function.
10819       * @example
10820       *
10821       * var say = _.spread(function(who, what) {
10822       *   return who + ' says ' + what;
10823       * });
10824       *
10825       * say(['fred', 'hello']);
10826       * // => 'fred says hello'
10827       *
10828       * var numbers = Promise.all([
10829       *   Promise.resolve(40),
10830       *   Promise.resolve(36)
10831       * ]);
10832       *
10833       * numbers.then(_.spread(function(x, y) {
10834       *   return x + y;
10835       * }));
10836       * // => a Promise of 76
10837       */
10838      function spread(func, start) {
10839        if (typeof func != 'function') {
10840          throw new TypeError(FUNC_ERROR_TEXT);
10841        }
10842        start = start == null ? 0 : nativeMax(toInteger(start), 0);
10843        return baseRest(function(args) {
10844          var array = args[start],
10845              otherArgs = castSlice(args, 0, start);
10846  
10847          if (array) {
10848            arrayPush(otherArgs, array);
10849          }
10850          return apply(func, this, otherArgs);
10851        });
10852      }
10853  
10854      /**
10855       * Creates a throttled function that only invokes `func` at most once per
10856       * every `wait` milliseconds. The throttled function comes with a `cancel`
10857       * method to cancel delayed `func` invocations and a `flush` method to
10858       * immediately invoke them. Provide `options` to indicate whether `func`
10859       * should be invoked on the leading and/or trailing edge of the `wait`
10860       * timeout. The `func` is invoked with the last arguments provided to the
10861       * throttled function. Subsequent calls to the throttled function return the
10862       * result of the last `func` invocation.
10863       *
10864       * **Note:** If `leading` and `trailing` options are `true`, `func` is
10865       * invoked on the trailing edge of the timeout only if the throttled function
10866       * is invoked more than once during the `wait` timeout.
10867       *
10868       * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
10869       * until to the next tick, similar to `setTimeout` with a timeout of `0`.
10870       *
10871       * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
10872       * for details over the differences between `_.throttle` and `_.debounce`.
10873       *
10874       * @static
10875       * @memberOf _
10876       * @since 0.1.0
10877       * @category Function
10878       * @param {Function} func The function to throttle.
10879       * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
10880       * @param {Object} [options={}] The options object.
10881       * @param {boolean} [options.leading=true]
10882       *  Specify invoking on the leading edge of the timeout.
10883       * @param {boolean} [options.trailing=true]
10884       *  Specify invoking on the trailing edge of the timeout.
10885       * @returns {Function} Returns the new throttled function.
10886       * @example
10887       *
10888       * // Avoid excessively updating the position while scrolling.
10889       * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
10890       *
10891       * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
10892       * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
10893       * jQuery(element).on('click', throttled);
10894       *
10895       * // Cancel the trailing throttled invocation.
10896       * jQuery(window).on('popstate', throttled.cancel);
10897       */
10898      function throttle(func, wait, options) {
10899        var leading = true,
10900            trailing = true;
10901  
10902        if (typeof func != 'function') {
10903          throw new TypeError(FUNC_ERROR_TEXT);
10904        }
10905        if (isObject(options)) {
10906          leading = 'leading' in options ? !!options.leading : leading;
10907          trailing = 'trailing' in options ? !!options.trailing : trailing;
10908        }
10909        return debounce(func, wait, {
10910          'leading': leading,
10911          'maxWait': wait,
10912          'trailing': trailing
10913        });
10914      }
10915  
10916      /**
10917       * Creates a function that accepts up to one argument, ignoring any
10918       * additional arguments.
10919       *
10920       * @static
10921       * @memberOf _
10922       * @since 4.0.0
10923       * @category Function
10924       * @param {Function} func The function to cap arguments for.
10925       * @returns {Function} Returns the new capped function.
10926       * @example
10927       *
10928       * _.map(['6', '8', '10'], _.unary(parseInt));
10929       * // => [6, 8, 10]
10930       */
10931      function unary(func) {
10932        return ary(func, 1);
10933      }
10934  
10935      /**
10936       * Creates a function that provides `value` to `wrapper` as its first
10937       * argument. Any additional arguments provided to the function are appended
10938       * to those provided to the `wrapper`. The wrapper is invoked with the `this`
10939       * binding of the created function.
10940       *
10941       * @static
10942       * @memberOf _
10943       * @since 0.1.0
10944       * @category Function
10945       * @param {*} value The value to wrap.
10946       * @param {Function} [wrapper=identity] The wrapper function.
10947       * @returns {Function} Returns the new function.
10948       * @example
10949       *
10950       * var p = _.wrap(_.escape, function(func, text) {
10951       *   return '<p>' + func(text) + '</p>';
10952       * });
10953       *
10954       * p('fred, barney, & pebbles');
10955       * // => '<p>fred, barney, &amp; pebbles</p>'
10956       */
10957      function wrap(value, wrapper) {
10958        return partial(castFunction(wrapper), value);
10959      }
10960  
10961      /*------------------------------------------------------------------------*/
10962  
10963      /**
10964       * Casts `value` as an array if it's not one.
10965       *
10966       * @static
10967       * @memberOf _
10968       * @since 4.4.0
10969       * @category Lang
10970       * @param {*} value The value to inspect.
10971       * @returns {Array} Returns the cast array.
10972       * @example
10973       *
10974       * _.castArray(1);
10975       * // => [1]
10976       *
10977       * _.castArray({ 'a': 1 });
10978       * // => [{ 'a': 1 }]
10979       *
10980       * _.castArray('abc');
10981       * // => ['abc']
10982       *
10983       * _.castArray(null);
10984       * // => [null]
10985       *
10986       * _.castArray(undefined);
10987       * // => [undefined]
10988       *
10989       * _.castArray();
10990       * // => []
10991       *
10992       * var array = [1, 2, 3];
10993       * console.log(_.castArray(array) === array);
10994       * // => true
10995       */
10996      function castArray() {
10997        if (!arguments.length) {
10998          return [];
10999        }
11000        var value = arguments[0];
11001        return isArray(value) ? value : [value];
11002      }
11003  
11004      /**
11005       * Creates a shallow clone of `value`.
11006       *
11007       * **Note:** This method is loosely based on the
11008       * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
11009       * and supports cloning arrays, array buffers, booleans, date objects, maps,
11010       * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
11011       * arrays. The own enumerable properties of `arguments` objects are cloned
11012       * as plain objects. An empty object is returned for uncloneable values such
11013       * as error objects, functions, DOM nodes, and WeakMaps.
11014       *
11015       * @static
11016       * @memberOf _
11017       * @since 0.1.0
11018       * @category Lang
11019       * @param {*} value The value to clone.
11020       * @returns {*} Returns the cloned value.
11021       * @see _.cloneDeep
11022       * @example
11023       *
11024       * var objects = [{ 'a': 1 }, { 'b': 2 }];
11025       *
11026       * var shallow = _.clone(objects);
11027       * console.log(shallow[0] === objects[0]);
11028       * // => true
11029       */
11030      function clone(value) {
11031        return baseClone(value, CLONE_SYMBOLS_FLAG);
11032      }
11033  
11034      /**
11035       * This method is like `_.clone` except that it accepts `customizer` which
11036       * is invoked to produce the cloned value. If `customizer` returns `undefined`,
11037       * cloning is handled by the method instead. The `customizer` is invoked with
11038       * up to four arguments; (value [, index|key, object, stack]).
11039       *
11040       * @static
11041       * @memberOf _
11042       * @since 4.0.0
11043       * @category Lang
11044       * @param {*} value The value to clone.
11045       * @param {Function} [customizer] The function to customize cloning.
11046       * @returns {*} Returns the cloned value.
11047       * @see _.cloneDeepWith
11048       * @example
11049       *
11050       * function customizer(value) {
11051       *   if (_.isElement(value)) {
11052       *     return value.cloneNode(false);
11053       *   }
11054       * }
11055       *
11056       * var el = _.cloneWith(document.body, customizer);
11057       *
11058       * console.log(el === document.body);
11059       * // => false
11060       * console.log(el.nodeName);
11061       * // => 'BODY'
11062       * console.log(el.childNodes.length);
11063       * // => 0
11064       */
11065      function cloneWith(value, customizer) {
11066        customizer = typeof customizer == 'function' ? customizer : undefined;
11067        return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
11068      }
11069  
11070      /**
11071       * This method is like `_.clone` except that it recursively clones `value`.
11072       *
11073       * @static
11074       * @memberOf _
11075       * @since 1.0.0
11076       * @category Lang
11077       * @param {*} value The value to recursively clone.
11078       * @returns {*} Returns the deep cloned value.
11079       * @see _.clone
11080       * @example
11081       *
11082       * var objects = [{ 'a': 1 }, { 'b': 2 }];
11083       *
11084       * var deep = _.cloneDeep(objects);
11085       * console.log(deep[0] === objects[0]);
11086       * // => false
11087       */
11088      function cloneDeep(value) {
11089        return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
11090      }
11091  
11092      /**
11093       * This method is like `_.cloneWith` except that it recursively clones `value`.
11094       *
11095       * @static
11096       * @memberOf _
11097       * @since 4.0.0
11098       * @category Lang
11099       * @param {*} value The value to recursively clone.
11100       * @param {Function} [customizer] The function to customize cloning.
11101       * @returns {*} Returns the deep cloned value.
11102       * @see _.cloneWith
11103       * @example
11104       *
11105       * function customizer(value) {
11106       *   if (_.isElement(value)) {
11107       *     return value.cloneNode(true);
11108       *   }
11109       * }
11110       *
11111       * var el = _.cloneDeepWith(document.body, customizer);
11112       *
11113       * console.log(el === document.body);
11114       * // => false
11115       * console.log(el.nodeName);
11116       * // => 'BODY'
11117       * console.log(el.childNodes.length);
11118       * // => 20
11119       */
11120      function cloneDeepWith(value, customizer) {
11121        customizer = typeof customizer == 'function' ? customizer : undefined;
11122        return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
11123      }
11124  
11125      /**
11126       * Checks if `object` conforms to `source` by invoking the predicate
11127       * properties of `source` with the corresponding property values of `object`.
11128       *
11129       * **Note:** This method is equivalent to `_.conforms` when `source` is
11130       * partially applied.
11131       *
11132       * @static
11133       * @memberOf _
11134       * @since 4.14.0
11135       * @category Lang
11136       * @param {Object} object The object to inspect.
11137       * @param {Object} source The object of property predicates to conform to.
11138       * @returns {boolean} Returns `true` if `object` conforms, else `false`.
11139       * @example
11140       *
11141       * var object = { 'a': 1, 'b': 2 };
11142       *
11143       * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
11144       * // => true
11145       *
11146       * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
11147       * // => false
11148       */
11149      function conformsTo(object, source) {
11150        return source == null || baseConformsTo(object, source, keys(source));
11151      }
11152  
11153      /**
11154       * Performs a
11155       * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11156       * comparison between two values to determine if they are equivalent.
11157       *
11158       * @static
11159       * @memberOf _
11160       * @since 4.0.0
11161       * @category Lang
11162       * @param {*} value The value to compare.
11163       * @param {*} other The other value to compare.
11164       * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11165       * @example
11166       *
11167       * var object = { 'a': 1 };
11168       * var other = { 'a': 1 };
11169       *
11170       * _.eq(object, object);
11171       * // => true
11172       *
11173       * _.eq(object, other);
11174       * // => false
11175       *
11176       * _.eq('a', 'a');
11177       * // => true
11178       *
11179       * _.eq('a', Object('a'));
11180       * // => false
11181       *
11182       * _.eq(NaN, NaN);
11183       * // => true
11184       */
11185      function eq(value, other) {
11186        return value === other || (value !== value && other !== other);
11187      }
11188  
11189      /**
11190       * Checks if `value` is greater than `other`.
11191       *
11192       * @static
11193       * @memberOf _
11194       * @since 3.9.0
11195       * @category Lang
11196       * @param {*} value The value to compare.
11197       * @param {*} other The other value to compare.
11198       * @returns {boolean} Returns `true` if `value` is greater than `other`,
11199       *  else `false`.
11200       * @see _.lt
11201       * @example
11202       *
11203       * _.gt(3, 1);
11204       * // => true
11205       *
11206       * _.gt(3, 3);
11207       * // => false
11208       *
11209       * _.gt(1, 3);
11210       * // => false
11211       */
11212      var gt = createRelationalOperation(baseGt);
11213  
11214      /**
11215       * Checks if `value` is greater than or equal to `other`.
11216       *
11217       * @static
11218       * @memberOf _
11219       * @since 3.9.0
11220       * @category Lang
11221       * @param {*} value The value to compare.
11222       * @param {*} other The other value to compare.
11223       * @returns {boolean} Returns `true` if `value` is greater than or equal to
11224       *  `other`, else `false`.
11225       * @see _.lte
11226       * @example
11227       *
11228       * _.gte(3, 1);
11229       * // => true
11230       *
11231       * _.gte(3, 3);
11232       * // => true
11233       *
11234       * _.gte(1, 3);
11235       * // => false
11236       */
11237      var gte = createRelationalOperation(function(value, other) {
11238        return value >= other;
11239      });
11240  
11241      /**
11242       * Checks if `value` is likely an `arguments` object.
11243       *
11244       * @static
11245       * @memberOf _
11246       * @since 0.1.0
11247       * @category Lang
11248       * @param {*} value The value to check.
11249       * @returns {boolean} Returns `true` if `value` is an `arguments` object,
11250       *  else `false`.
11251       * @example
11252       *
11253       * _.isArguments(function() { return arguments; }());
11254       * // => true
11255       *
11256       * _.isArguments([1, 2, 3]);
11257       * // => false
11258       */
11259      var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
11260        return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
11261          !propertyIsEnumerable.call(value, 'callee');
11262      };
11263  
11264      /**
11265       * Checks if `value` is classified as an `Array` object.
11266       *
11267       * @static
11268       * @memberOf _
11269       * @since 0.1.0
11270       * @category Lang
11271       * @param {*} value The value to check.
11272       * @returns {boolean} Returns `true` if `value` is an array, else `false`.
11273       * @example
11274       *
11275       * _.isArray([1, 2, 3]);
11276       * // => true
11277       *
11278       * _.isArray(document.body.children);
11279       * // => false
11280       *
11281       * _.isArray('abc');
11282       * // => false
11283       *
11284       * _.isArray(_.noop);
11285       * // => false
11286       */
11287      var isArray = Array.isArray;
11288  
11289      /**
11290       * Checks if `value` is classified as an `ArrayBuffer` object.
11291       *
11292       * @static
11293       * @memberOf _
11294       * @since 4.3.0
11295       * @category Lang
11296       * @param {*} value The value to check.
11297       * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
11298       * @example
11299       *
11300       * _.isArrayBuffer(new ArrayBuffer(2));
11301       * // => true
11302       *
11303       * _.isArrayBuffer(new Array(2));
11304       * // => false
11305       */
11306      var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
11307  
11308      /**
11309       * Checks if `value` is array-like. A value is considered array-like if it's
11310       * not a function and has a `value.length` that's an integer greater than or
11311       * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
11312       *
11313       * @static
11314       * @memberOf _
11315       * @since 4.0.0
11316       * @category Lang
11317       * @param {*} value The value to check.
11318       * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
11319       * @example
11320       *
11321       * _.isArrayLike([1, 2, 3]);
11322       * // => true
11323       *
11324       * _.isArrayLike(document.body.children);
11325       * // => true
11326       *
11327       * _.isArrayLike('abc');
11328       * // => true
11329       *
11330       * _.isArrayLike(_.noop);
11331       * // => false
11332       */
11333      function isArrayLike(value) {
11334        return value != null && isLength(value.length) && !isFunction(value);
11335      }
11336  
11337      /**
11338       * This method is like `_.isArrayLike` except that it also checks if `value`
11339       * is an object.
11340       *
11341       * @static
11342       * @memberOf _
11343       * @since 4.0.0
11344       * @category Lang
11345       * @param {*} value The value to check.
11346       * @returns {boolean} Returns `true` if `value` is an array-like object,
11347       *  else `false`.
11348       * @example
11349       *
11350       * _.isArrayLikeObject([1, 2, 3]);
11351       * // => true
11352       *
11353       * _.isArrayLikeObject(document.body.children);
11354       * // => true
11355       *
11356       * _.isArrayLikeObject('abc');
11357       * // => false
11358       *
11359       * _.isArrayLikeObject(_.noop);
11360       * // => false
11361       */
11362      function isArrayLikeObject(value) {
11363        return isObjectLike(value) && isArrayLike(value);
11364      }
11365  
11366      /**
11367       * Checks if `value` is classified as a boolean primitive or object.
11368       *
11369       * @static
11370       * @memberOf _
11371       * @since 0.1.0
11372       * @category Lang
11373       * @param {*} value The value to check.
11374       * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
11375       * @example
11376       *
11377       * _.isBoolean(false);
11378       * // => true
11379       *
11380       * _.isBoolean(null);
11381       * // => false
11382       */
11383      function isBoolean(value) {
11384        return value === true || value === false ||
11385          (isObjectLike(value) && baseGetTag(value) == boolTag);
11386      }
11387  
11388      /**
11389       * Checks if `value` is a buffer.
11390       *
11391       * @static
11392       * @memberOf _
11393       * @since 4.3.0
11394       * @category Lang
11395       * @param {*} value The value to check.
11396       * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
11397       * @example
11398       *
11399       * _.isBuffer(new Buffer(2));
11400       * // => true
11401       *
11402       * _.isBuffer(new Uint8Array(2));
11403       * // => false
11404       */
11405      var isBuffer = nativeIsBuffer || stubFalse;
11406  
11407      /**
11408       * Checks if `value` is classified as a `Date` object.
11409       *
11410       * @static
11411       * @memberOf _
11412       * @since 0.1.0
11413       * @category Lang
11414       * @param {*} value The value to check.
11415       * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
11416       * @example
11417       *
11418       * _.isDate(new Date);
11419       * // => true
11420       *
11421       * _.isDate('Mon April 23 2012');
11422       * // => false
11423       */
11424      var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
11425  
11426      /**
11427       * Checks if `value` is likely a DOM element.
11428       *
11429       * @static
11430       * @memberOf _
11431       * @since 0.1.0
11432       * @category Lang
11433       * @param {*} value The value to check.
11434       * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
11435       * @example
11436       *
11437       * _.isElement(document.body);
11438       * // => true
11439       *
11440       * _.isElement('<body>');
11441       * // => false
11442       */
11443      function isElement(value) {
11444        return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
11445      }
11446  
11447      /**
11448       * Checks if `value` is an empty object, collection, map, or set.
11449       *
11450       * Objects are considered empty if they have no own enumerable string keyed
11451       * properties.
11452       *
11453       * Array-like values such as `arguments` objects, arrays, buffers, strings, or
11454       * jQuery-like collections are considered empty if they have a `length` of `0`.
11455       * Similarly, maps and sets are considered empty if they have a `size` of `0`.
11456       *
11457       * @static
11458       * @memberOf _
11459       * @since 0.1.0
11460       * @category Lang
11461       * @param {*} value The value to check.
11462       * @returns {boolean} Returns `true` if `value` is empty, else `false`.
11463       * @example
11464       *
11465       * _.isEmpty(null);
11466       * // => true
11467       *
11468       * _.isEmpty(true);
11469       * // => true
11470       *
11471       * _.isEmpty(1);
11472       * // => true
11473       *
11474       * _.isEmpty([1, 2, 3]);
11475       * // => false
11476       *
11477       * _.isEmpty({ 'a': 1 });
11478       * // => false
11479       */
11480      function isEmpty(value) {
11481        if (value == null) {
11482          return true;
11483        }
11484        if (isArrayLike(value) &&
11485            (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
11486              isBuffer(value) || isTypedArray(value) || isArguments(value))) {
11487          return !value.length;
11488        }
11489        var tag = getTag(value);
11490        if (tag == mapTag || tag == setTag) {
11491          return !value.size;
11492        }
11493        if (isPrototype(value)) {
11494          return !baseKeys(value).length;
11495        }
11496        for (var key in value) {
11497          if (hasOwnProperty.call(value, key)) {
11498            return false;
11499          }
11500        }
11501        return true;
11502      }
11503  
11504      /**
11505       * Performs a deep comparison between two values to determine if they are
11506       * equivalent.
11507       *
11508       * **Note:** This method supports comparing arrays, array buffers, booleans,
11509       * date objects, error objects, maps, numbers, `Object` objects, regexes,
11510       * sets, strings, symbols, and typed arrays. `Object` objects are compared
11511       * by their own, not inherited, enumerable properties. Functions and DOM
11512       * nodes are compared by strict equality, i.e. `===`.
11513       *
11514       * @static
11515       * @memberOf _
11516       * @since 0.1.0
11517       * @category Lang
11518       * @param {*} value The value to compare.
11519       * @param {*} other The other value to compare.
11520       * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11521       * @example
11522       *
11523       * var object = { 'a': 1 };
11524       * var other = { 'a': 1 };
11525       *
11526       * _.isEqual(object, other);
11527       * // => true
11528       *
11529       * object === other;
11530       * // => false
11531       */
11532      function isEqual(value, other) {
11533        return baseIsEqual(value, other);
11534      }
11535  
11536      /**
11537       * This method is like `_.isEqual` except that it accepts `customizer` which
11538       * is invoked to compare values. If `customizer` returns `undefined`, comparisons
11539       * are handled by the method instead. The `customizer` is invoked with up to
11540       * six arguments: (objValue, othValue [, index|key, object, other, stack]).
11541       *
11542       * @static
11543       * @memberOf _
11544       * @since 4.0.0
11545       * @category Lang
11546       * @param {*} value The value to compare.
11547       * @param {*} other The other value to compare.
11548       * @param {Function} [customizer] The function to customize comparisons.
11549       * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11550       * @example
11551       *
11552       * function isGreeting(value) {
11553       *   return /^h(?:i|ello)$/.test(value);
11554       * }
11555       *
11556       * function customizer(objValue, othValue) {
11557       *   if (isGreeting(objValue) && isGreeting(othValue)) {
11558       *     return true;
11559       *   }
11560       * }
11561       *
11562       * var array = ['hello', 'goodbye'];
11563       * var other = ['hi', 'goodbye'];
11564       *
11565       * _.isEqualWith(array, other, customizer);
11566       * // => true
11567       */
11568      function isEqualWith(value, other, customizer) {
11569        customizer = typeof customizer == 'function' ? customizer : undefined;
11570        var result = customizer ? customizer(value, other) : undefined;
11571        return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
11572      }
11573  
11574      /**
11575       * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
11576       * `SyntaxError`, `TypeError`, or `URIError` object.
11577       *
11578       * @static
11579       * @memberOf _
11580       * @since 3.0.0
11581       * @category Lang
11582       * @param {*} value The value to check.
11583       * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
11584       * @example
11585       *
11586       * _.isError(new Error);
11587       * // => true
11588       *
11589       * _.isError(Error);
11590       * // => false
11591       */
11592      function isError(value) {
11593        if (!isObjectLike(value)) {
11594          return false;
11595        }
11596        var tag = baseGetTag(value);
11597        return tag == errorTag || tag == domExcTag ||
11598          (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
11599      }
11600  
11601      /**
11602       * Checks if `value` is a finite primitive number.
11603       *
11604       * **Note:** This method is based on
11605       * [`Number.isFinite`](https://mdn.io/Number/isFinite).
11606       *
11607       * @static
11608       * @memberOf _
11609       * @since 0.1.0
11610       * @category Lang
11611       * @param {*} value The value to check.
11612       * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
11613       * @example
11614       *
11615       * _.isFinite(3);
11616       * // => true
11617       *
11618       * _.isFinite(Number.MIN_VALUE);
11619       * // => true
11620       *
11621       * _.isFinite(Infinity);
11622       * // => false
11623       *
11624       * _.isFinite('3');
11625       * // => false
11626       */
11627      function isFinite(value) {
11628        return typeof value == 'number' && nativeIsFinite(value);
11629      }
11630  
11631      /**
11632       * Checks if `value` is classified as a `Function` object.
11633       *
11634       * @static
11635       * @memberOf _
11636       * @since 0.1.0
11637       * @category Lang
11638       * @param {*} value The value to check.
11639       * @returns {boolean} Returns `true` if `value` is a function, else `false`.
11640       * @example
11641       *
11642       * _.isFunction(_);
11643       * // => true
11644       *
11645       * _.isFunction(/abc/);
11646       * // => false
11647       */
11648      function isFunction(value) {
11649        if (!isObject(value)) {
11650          return false;
11651        }
11652        // The use of `Object#toString` avoids issues with the `typeof` operator
11653        // in Safari 9 which returns 'object' for typed arrays and other constructors.
11654        var tag = baseGetTag(value);
11655        return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
11656      }
11657  
11658      /**
11659       * Checks if `value` is an integer.
11660       *
11661       * **Note:** This method is based on
11662       * [`Number.isInteger`](https://mdn.io/Number/isInteger).
11663       *
11664       * @static
11665       * @memberOf _
11666       * @since 4.0.0
11667       * @category Lang
11668       * @param {*} value The value to check.
11669       * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
11670       * @example
11671       *
11672       * _.isInteger(3);
11673       * // => true
11674       *
11675       * _.isInteger(Number.MIN_VALUE);
11676       * // => false
11677       *
11678       * _.isInteger(Infinity);
11679       * // => false
11680       *
11681       * _.isInteger('3');
11682       * // => false
11683       */
11684      function isInteger(value) {
11685        return typeof value == 'number' && value == toInteger(value);
11686      }
11687  
11688      /**
11689       * Checks if `value` is a valid array-like length.
11690       *
11691       * **Note:** This method is loosely based on
11692       * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
11693       *
11694       * @static
11695       * @memberOf _
11696       * @since 4.0.0
11697       * @category Lang
11698       * @param {*} value The value to check.
11699       * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
11700       * @example
11701       *
11702       * _.isLength(3);
11703       * // => true
11704       *
11705       * _.isLength(Number.MIN_VALUE);
11706       * // => false
11707       *
11708       * _.isLength(Infinity);
11709       * // => false
11710       *
11711       * _.isLength('3');
11712       * // => false
11713       */
11714      function isLength(value) {
11715        return typeof value == 'number' &&
11716          value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
11717      }
11718  
11719      /**
11720       * Checks if `value` is the
11721       * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
11722       * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
11723       *
11724       * @static
11725       * @memberOf _
11726       * @since 0.1.0
11727       * @category Lang
11728       * @param {*} value The value to check.
11729       * @returns {boolean} Returns `true` if `value` is an object, else `false`.
11730       * @example
11731       *
11732       * _.isObject({});
11733       * // => true
11734       *
11735       * _.isObject([1, 2, 3]);
11736       * // => true
11737       *
11738       * _.isObject(_.noop);
11739       * // => true
11740       *
11741       * _.isObject(null);
11742       * // => false
11743       */
11744      function isObject(value) {
11745        var type = typeof value;
11746        return value != null && (type == 'object' || type == 'function');
11747      }
11748  
11749      /**
11750       * Checks if `value` is object-like. A value is object-like if it's not `null`
11751       * and has a `typeof` result of "object".
11752       *
11753       * @static
11754       * @memberOf _
11755       * @since 4.0.0
11756       * @category Lang
11757       * @param {*} value The value to check.
11758       * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
11759       * @example
11760       *
11761       * _.isObjectLike({});
11762       * // => true
11763       *
11764       * _.isObjectLike([1, 2, 3]);
11765       * // => true
11766       *
11767       * _.isObjectLike(_.noop);
11768       * // => false
11769       *
11770       * _.isObjectLike(null);
11771       * // => false
11772       */
11773      function isObjectLike(value) {
11774        return value != null && typeof value == 'object';
11775      }
11776  
11777      /**
11778       * Checks if `value` is classified as a `Map` object.
11779       *
11780       * @static
11781       * @memberOf _
11782       * @since 4.3.0
11783       * @category Lang
11784       * @param {*} value The value to check.
11785       * @returns {boolean} Returns `true` if `value` is a map, else `false`.
11786       * @example
11787       *
11788       * _.isMap(new Map);
11789       * // => true
11790       *
11791       * _.isMap(new WeakMap);
11792       * // => false
11793       */
11794      var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
11795  
11796      /**
11797       * Performs a partial deep comparison between `object` and `source` to
11798       * determine if `object` contains equivalent property values.
11799       *
11800       * **Note:** This method is equivalent to `_.matches` when `source` is
11801       * partially applied.
11802       *
11803       * Partial comparisons will match empty array and empty object `source`
11804       * values against any array or object value, respectively. See `_.isEqual`
11805       * for a list of supported value comparisons.
11806       *
11807       * @static
11808       * @memberOf _
11809       * @since 3.0.0
11810       * @category Lang
11811       * @param {Object} object The object to inspect.
11812       * @param {Object} source The object of property values to match.
11813       * @returns {boolean} Returns `true` if `object` is a match, else `false`.
11814       * @example
11815       *
11816       * var object = { 'a': 1, 'b': 2 };
11817       *
11818       * _.isMatch(object, { 'b': 2 });
11819       * // => true
11820       *
11821       * _.isMatch(object, { 'b': 1 });
11822       * // => false
11823       */
11824      function isMatch(object, source) {
11825        return object === source || baseIsMatch(object, source, getMatchData(source));
11826      }
11827  
11828      /**
11829       * This method is like `_.isMatch` except that it accepts `customizer` which
11830       * is invoked to compare values. If `customizer` returns `undefined`, comparisons
11831       * are handled by the method instead. The `customizer` is invoked with five
11832       * arguments: (objValue, srcValue, index|key, object, source).
11833       *
11834       * @static
11835       * @memberOf _
11836       * @since 4.0.0
11837       * @category Lang
11838       * @param {Object} object The object to inspect.
11839       * @param {Object} source The object of property values to match.
11840       * @param {Function} [customizer] The function to customize comparisons.
11841       * @returns {boolean} Returns `true` if `object` is a match, else `false`.
11842       * @example
11843       *
11844       * function isGreeting(value) {
11845       *   return /^h(?:i|ello)$/.test(value);
11846       * }
11847       *
11848       * function customizer(objValue, srcValue) {
11849       *   if (isGreeting(objValue) && isGreeting(srcValue)) {
11850       *     return true;
11851       *   }
11852       * }
11853       *
11854       * var object = { 'greeting': 'hello' };
11855       * var source = { 'greeting': 'hi' };
11856       *
11857       * _.isMatchWith(object, source, customizer);
11858       * // => true
11859       */
11860      function isMatchWith(object, source, customizer) {
11861        customizer = typeof customizer == 'function' ? customizer : undefined;
11862        return baseIsMatch(object, source, getMatchData(source), customizer);
11863      }
11864  
11865      /**
11866       * Checks if `value` is `NaN`.
11867       *
11868       * **Note:** This method is based on
11869       * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
11870       * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
11871       * `undefined` and other non-number values.
11872       *
11873       * @static
11874       * @memberOf _
11875       * @since 0.1.0
11876       * @category Lang
11877       * @param {*} value The value to check.
11878       * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
11879       * @example
11880       *
11881       * _.isNaN(NaN);
11882       * // => true
11883       *
11884       * _.isNaN(new Number(NaN));
11885       * // => true
11886       *
11887       * isNaN(undefined);
11888       * // => true
11889       *
11890       * _.isNaN(undefined);
11891       * // => false
11892       */
11893      function isNaN(value) {
11894        // An `NaN` primitive is the only value that is not equal to itself.
11895        // Perform the `toStringTag` check first to avoid errors with some
11896        // ActiveX objects in IE.
11897        return isNumber(value) && value != +value;
11898      }
11899  
11900      /**
11901       * Checks if `value` is a pristine native function.
11902       *
11903       * **Note:** This method can't reliably detect native functions in the presence
11904       * of the core-js package because core-js circumvents this kind of detection.
11905       * Despite multiple requests, the core-js maintainer has made it clear: any
11906       * attempt to fix the detection will be obstructed. As a result, we're left
11907       * with little choice but to throw an error. Unfortunately, this also affects
11908       * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
11909       * which rely on core-js.
11910       *
11911       * @static
11912       * @memberOf _
11913       * @since 3.0.0
11914       * @category Lang
11915       * @param {*} value The value to check.
11916       * @returns {boolean} Returns `true` if `value` is a native function,
11917       *  else `false`.
11918       * @example
11919       *
11920       * _.isNative(Array.prototype.push);
11921       * // => true
11922       *
11923       * _.isNative(_);
11924       * // => false
11925       */
11926      function isNative(value) {
11927        if (isMaskable(value)) {
11928          throw new Error(CORE_ERROR_TEXT);
11929        }
11930        return baseIsNative(value);
11931      }
11932  
11933      /**
11934       * Checks if `value` is `null`.
11935       *
11936       * @static
11937       * @memberOf _
11938       * @since 0.1.0
11939       * @category Lang
11940       * @param {*} value The value to check.
11941       * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
11942       * @example
11943       *
11944       * _.isNull(null);
11945       * // => true
11946       *
11947       * _.isNull(void 0);
11948       * // => false
11949       */
11950      function isNull(value) {
11951        return value === null;
11952      }
11953  
11954      /**
11955       * Checks if `value` is `null` or `undefined`.
11956       *
11957       * @static
11958       * @memberOf _
11959       * @since 4.0.0
11960       * @category Lang
11961       * @param {*} value The value to check.
11962       * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
11963       * @example
11964       *
11965       * _.isNil(null);
11966       * // => true
11967       *
11968       * _.isNil(void 0);
11969       * // => true
11970       *
11971       * _.isNil(NaN);
11972       * // => false
11973       */
11974      function isNil(value) {
11975        return value == null;
11976      }
11977  
11978      /**
11979       * Checks if `value` is classified as a `Number` primitive or object.
11980       *
11981       * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
11982       * classified as numbers, use the `_.isFinite` method.
11983       *
11984       * @static
11985       * @memberOf _
11986       * @since 0.1.0
11987       * @category Lang
11988       * @param {*} value The value to check.
11989       * @returns {boolean} Returns `true` if `value` is a number, else `false`.
11990       * @example
11991       *
11992       * _.isNumber(3);
11993       * // => true
11994       *
11995       * _.isNumber(Number.MIN_VALUE);
11996       * // => true
11997       *
11998       * _.isNumber(Infinity);
11999       * // => true
12000       *
12001       * _.isNumber('3');
12002       * // => false
12003       */
12004      function isNumber(value) {
12005        return typeof value == 'number' ||
12006          (isObjectLike(value) && baseGetTag(value) == numberTag);
12007      }
12008  
12009      /**
12010       * Checks if `value` is a plain object, that is, an object created by the
12011       * `Object` constructor or one with a `[[Prototype]]` of `null`.
12012       *
12013       * @static
12014       * @memberOf _
12015       * @since 0.8.0
12016       * @category Lang
12017       * @param {*} value The value to check.
12018       * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
12019       * @example
12020       *
12021       * function Foo() {
12022       *   this.a = 1;
12023       * }
12024       *
12025       * _.isPlainObject(new Foo);
12026       * // => false
12027       *
12028       * _.isPlainObject([1, 2, 3]);
12029       * // => false
12030       *
12031       * _.isPlainObject({ 'x': 0, 'y': 0 });
12032       * // => true
12033       *
12034       * _.isPlainObject(Object.create(null));
12035       * // => true
12036       */
12037      function isPlainObject(value) {
12038        if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
12039          return false;
12040        }
12041        var proto = getPrototype(value);
12042        if (proto === null) {
12043          return true;
12044        }
12045        var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
12046        return typeof Ctor == 'function' && Ctor instanceof Ctor &&
12047          funcToString.call(Ctor) == objectCtorString;
12048      }
12049  
12050      /**
12051       * Checks if `value` is classified as a `RegExp` object.
12052       *
12053       * @static
12054       * @memberOf _
12055       * @since 0.1.0
12056       * @category Lang
12057       * @param {*} value The value to check.
12058       * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
12059       * @example
12060       *
12061       * _.isRegExp(/abc/);
12062       * // => true
12063       *
12064       * _.isRegExp('/abc/');
12065       * // => false
12066       */
12067      var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
12068  
12069      /**
12070       * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
12071       * double precision number which isn't the result of a rounded unsafe integer.
12072       *
12073       * **Note:** This method is based on
12074       * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
12075       *
12076       * @static
12077       * @memberOf _
12078       * @since 4.0.0
12079       * @category Lang
12080       * @param {*} value The value to check.
12081       * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
12082       * @example
12083       *
12084       * _.isSafeInteger(3);
12085       * // => true
12086       *
12087       * _.isSafeInteger(Number.MIN_VALUE);
12088       * // => false
12089       *
12090       * _.isSafeInteger(Infinity);
12091       * // => false
12092       *
12093       * _.isSafeInteger('3');
12094       * // => false
12095       */
12096      function isSafeInteger(value) {
12097        return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
12098      }
12099  
12100      /**
12101       * Checks if `value` is classified as a `Set` object.
12102       *
12103       * @static
12104       * @memberOf _
12105       * @since 4.3.0
12106       * @category Lang
12107       * @param {*} value The value to check.
12108       * @returns {boolean} Returns `true` if `value` is a set, else `false`.
12109       * @example
12110       *
12111       * _.isSet(new Set);
12112       * // => true
12113       *
12114       * _.isSet(new WeakSet);
12115       * // => false
12116       */
12117      var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
12118  
12119      /**
12120       * Checks if `value` is classified as a `String` primitive or object.
12121       *
12122       * @static
12123       * @since 0.1.0
12124       * @memberOf _
12125       * @category Lang
12126       * @param {*} value The value to check.
12127       * @returns {boolean} Returns `true` if `value` is a string, else `false`.
12128       * @example
12129       *
12130       * _.isString('abc');
12131       * // => true
12132       *
12133       * _.isString(1);
12134       * // => false
12135       */
12136      function isString(value) {
12137        return typeof value == 'string' ||
12138          (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
12139      }
12140  
12141      /**
12142       * Checks if `value` is classified as a `Symbol` primitive or object.
12143       *
12144       * @static
12145       * @memberOf _
12146       * @since 4.0.0
12147       * @category Lang
12148       * @param {*} value The value to check.
12149       * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
12150       * @example
12151       *
12152       * _.isSymbol(Symbol.iterator);
12153       * // => true
12154       *
12155       * _.isSymbol('abc');
12156       * // => false
12157       */
12158      function isSymbol(value) {
12159        return typeof value == 'symbol' ||
12160          (isObjectLike(value) && baseGetTag(value) == symbolTag);
12161      }
12162  
12163      /**
12164       * Checks if `value` is classified as a typed array.
12165       *
12166       * @static
12167       * @memberOf _
12168       * @since 3.0.0
12169       * @category Lang
12170       * @param {*} value The value to check.
12171       * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
12172       * @example
12173       *
12174       * _.isTypedArray(new Uint8Array);
12175       * // => true
12176       *
12177       * _.isTypedArray([]);
12178       * // => false
12179       */
12180      var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
12181  
12182      /**
12183       * Checks if `value` is `undefined`.
12184       *
12185       * @static
12186       * @since 0.1.0
12187       * @memberOf _
12188       * @category Lang
12189       * @param {*} value The value to check.
12190       * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
12191       * @example
12192       *
12193       * _.isUndefined(void 0);
12194       * // => true
12195       *
12196       * _.isUndefined(null);
12197       * // => false
12198       */
12199      function isUndefined(value) {
12200        return value === undefined;
12201      }
12202  
12203      /**
12204       * Checks if `value` is classified as a `WeakMap` object.
12205       *
12206       * @static
12207       * @memberOf _
12208       * @since 4.3.0
12209       * @category Lang
12210       * @param {*} value The value to check.
12211       * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
12212       * @example
12213       *
12214       * _.isWeakMap(new WeakMap);
12215       * // => true
12216       *
12217       * _.isWeakMap(new Map);
12218       * // => false
12219       */
12220      function isWeakMap(value) {
12221        return isObjectLike(value) && getTag(value) == weakMapTag;
12222      }
12223  
12224      /**
12225       * Checks if `value` is classified as a `WeakSet` object.
12226       *
12227       * @static
12228       * @memberOf _
12229       * @since 4.3.0
12230       * @category Lang
12231       * @param {*} value The value to check.
12232       * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
12233       * @example
12234       *
12235       * _.isWeakSet(new WeakSet);
12236       * // => true
12237       *
12238       * _.isWeakSet(new Set);
12239       * // => false
12240       */
12241      function isWeakSet(value) {
12242        return isObjectLike(value) && baseGetTag(value) == weakSetTag;
12243      }
12244  
12245      /**
12246       * Checks if `value` is less than `other`.
12247       *
12248       * @static
12249       * @memberOf _
12250       * @since 3.9.0
12251       * @category Lang
12252       * @param {*} value The value to compare.
12253       * @param {*} other The other value to compare.
12254       * @returns {boolean} Returns `true` if `value` is less than `other`,
12255       *  else `false`.
12256       * @see _.gt
12257       * @example
12258       *
12259       * _.lt(1, 3);
12260       * // => true
12261       *
12262       * _.lt(3, 3);
12263       * // => false
12264       *
12265       * _.lt(3, 1);
12266       * // => false
12267       */
12268      var lt = createRelationalOperation(baseLt);
12269  
12270      /**
12271       * Checks if `value` is less than or equal to `other`.
12272       *
12273       * @static
12274       * @memberOf _
12275       * @since 3.9.0
12276       * @category Lang
12277       * @param {*} value The value to compare.
12278       * @param {*} other The other value to compare.
12279       * @returns {boolean} Returns `true` if `value` is less than or equal to
12280       *  `other`, else `false`.
12281       * @see _.gte
12282       * @example
12283       *
12284       * _.lte(1, 3);
12285       * // => true
12286       *
12287       * _.lte(3, 3);
12288       * // => true
12289       *
12290       * _.lte(3, 1);
12291       * // => false
12292       */
12293      var lte = createRelationalOperation(function(value, other) {
12294        return value <= other;
12295      });
12296  
12297      /**
12298       * Converts `value` to an array.
12299       *
12300       * @static
12301       * @since 0.1.0
12302       * @memberOf _
12303       * @category Lang
12304       * @param {*} value The value to convert.
12305       * @returns {Array} Returns the converted array.
12306       * @example
12307       *
12308       * _.toArray({ 'a': 1, 'b': 2 });
12309       * // => [1, 2]
12310       *
12311       * _.toArray('abc');
12312       * // => ['a', 'b', 'c']
12313       *
12314       * _.toArray(1);
12315       * // => []
12316       *
12317       * _.toArray(null);
12318       * // => []
12319       */
12320      function toArray(value) {
12321        if (!value) {
12322          return [];
12323        }
12324        if (isArrayLike(value)) {
12325          return isString(value) ? stringToArray(value) : copyArray(value);
12326        }
12327        if (symIterator && value[symIterator]) {
12328          return iteratorToArray(value[symIterator]());
12329        }
12330        var tag = getTag(value),
12331            func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
12332  
12333        return func(value);
12334      }
12335  
12336      /**
12337       * Converts `value` to a finite number.
12338       *
12339       * @static
12340       * @memberOf _
12341       * @since 4.12.0
12342       * @category Lang
12343       * @param {*} value The value to convert.
12344       * @returns {number} Returns the converted number.
12345       * @example
12346       *
12347       * _.toFinite(3.2);
12348       * // => 3.2
12349       *
12350       * _.toFinite(Number.MIN_VALUE);
12351       * // => 5e-324
12352       *
12353       * _.toFinite(Infinity);
12354       * // => 1.7976931348623157e+308
12355       *
12356       * _.toFinite('3.2');
12357       * // => 3.2
12358       */
12359      function toFinite(value) {
12360        if (!value) {
12361          return value === 0 ? value : 0;
12362        }
12363        value = toNumber(value);
12364        if (value === INFINITY || value === -INFINITY) {
12365          var sign = (value < 0 ? -1 : 1);
12366          return sign * MAX_INTEGER;
12367        }
12368        return value === value ? value : 0;
12369      }
12370  
12371      /**
12372       * Converts `value` to an integer.
12373       *
12374       * **Note:** This method is loosely based on
12375       * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
12376       *
12377       * @static
12378       * @memberOf _
12379       * @since 4.0.0
12380       * @category Lang
12381       * @param {*} value The value to convert.
12382       * @returns {number} Returns the converted integer.
12383       * @example
12384       *
12385       * _.toInteger(3.2);
12386       * // => 3
12387       *
12388       * _.toInteger(Number.MIN_VALUE);
12389       * // => 0
12390       *
12391       * _.toInteger(Infinity);
12392       * // => 1.7976931348623157e+308
12393       *
12394       * _.toInteger('3.2');
12395       * // => 3
12396       */
12397      function toInteger(value) {
12398        var result = toFinite(value),
12399            remainder = result % 1;
12400  
12401        return result === result ? (remainder ? result - remainder : result) : 0;
12402      }
12403  
12404      /**
12405       * Converts `value` to an integer suitable for use as the length of an
12406       * array-like object.
12407       *
12408       * **Note:** This method is based on
12409       * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12410       *
12411       * @static
12412       * @memberOf _
12413       * @since 4.0.0
12414       * @category Lang
12415       * @param {*} value The value to convert.
12416       * @returns {number} Returns the converted integer.
12417       * @example
12418       *
12419       * _.toLength(3.2);
12420       * // => 3
12421       *
12422       * _.toLength(Number.MIN_VALUE);
12423       * // => 0
12424       *
12425       * _.toLength(Infinity);
12426       * // => 4294967295
12427       *
12428       * _.toLength('3.2');
12429       * // => 3
12430       */
12431      function toLength(value) {
12432        return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
12433      }
12434  
12435      /**
12436       * Converts `value` to a number.
12437       *
12438       * @static
12439       * @memberOf _
12440       * @since 4.0.0
12441       * @category Lang
12442       * @param {*} value The value to process.
12443       * @returns {number} Returns the number.
12444       * @example
12445       *
12446       * _.toNumber(3.2);
12447       * // => 3.2
12448       *
12449       * _.toNumber(Number.MIN_VALUE);
12450       * // => 5e-324
12451       *
12452       * _.toNumber(Infinity);
12453       * // => Infinity
12454       *
12455       * _.toNumber('3.2');
12456       * // => 3.2
12457       */
12458      function toNumber(value) {
12459        if (typeof value == 'number') {
12460          return value;
12461        }
12462        if (isSymbol(value)) {
12463          return NAN;
12464        }
12465        if (isObject(value)) {
12466          var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
12467          value = isObject(other) ? (other + '') : other;
12468        }
12469        if (typeof value != 'string') {
12470          return value === 0 ? value : +value;
12471        }
12472        value = value.replace(reTrim, '');
12473        var isBinary = reIsBinary.test(value);
12474        return (isBinary || reIsOctal.test(value))
12475          ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
12476          : (reIsBadHex.test(value) ? NAN : +value);
12477      }
12478  
12479      /**
12480       * Converts `value` to a plain object flattening inherited enumerable string
12481       * keyed properties of `value` to own properties of the plain object.
12482       *
12483       * @static
12484       * @memberOf _
12485       * @since 3.0.0
12486       * @category Lang
12487       * @param {*} value The value to convert.
12488       * @returns {Object} Returns the converted plain object.
12489       * @example
12490       *
12491       * function Foo() {
12492       *   this.b = 2;
12493       * }
12494       *
12495       * Foo.prototype.c = 3;
12496       *
12497       * _.assign({ 'a': 1 }, new Foo);
12498       * // => { 'a': 1, 'b': 2 }
12499       *
12500       * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
12501       * // => { 'a': 1, 'b': 2, 'c': 3 }
12502       */
12503      function toPlainObject(value) {
12504        return copyObject(value, keysIn(value));
12505      }
12506  
12507      /**
12508       * Converts `value` to a safe integer. A safe integer can be compared and
12509       * represented correctly.
12510       *
12511       * @static
12512       * @memberOf _
12513       * @since 4.0.0
12514       * @category Lang
12515       * @param {*} value The value to convert.
12516       * @returns {number} Returns the converted integer.
12517       * @example
12518       *
12519       * _.toSafeInteger(3.2);
12520       * // => 3
12521       *
12522       * _.toSafeInteger(Number.MIN_VALUE);
12523       * // => 0
12524       *
12525       * _.toSafeInteger(Infinity);
12526       * // => 9007199254740991
12527       *
12528       * _.toSafeInteger('3.2');
12529       * // => 3
12530       */
12531      function toSafeInteger(value) {
12532        return value
12533          ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
12534          : (value === 0 ? value : 0);
12535      }
12536  
12537      /**
12538       * Converts `value` to a string. An empty string is returned for `null`
12539       * and `undefined` values. The sign of `-0` is preserved.
12540       *
12541       * @static
12542       * @memberOf _
12543       * @since 4.0.0
12544       * @category Lang
12545       * @param {*} value The value to convert.
12546       * @returns {string} Returns the converted string.
12547       * @example
12548       *
12549       * _.toString(null);
12550       * // => ''
12551       *
12552       * _.toString(-0);
12553       * // => '-0'
12554       *
12555       * _.toString([1, 2, 3]);
12556       * // => '1,2,3'
12557       */
12558      function toString(value) {
12559        return value == null ? '' : baseToString(value);
12560      }
12561  
12562      /*------------------------------------------------------------------------*/
12563  
12564      /**
12565       * Assigns own enumerable string keyed properties of source objects to the
12566       * destination object. Source objects are applied from left to right.
12567       * Subsequent sources overwrite property assignments of previous sources.
12568       *
12569       * **Note:** This method mutates `object` and is loosely based on
12570       * [`Object.assign`](https://mdn.io/Object/assign).
12571       *
12572       * @static
12573       * @memberOf _
12574       * @since 0.10.0
12575       * @category Object
12576       * @param {Object} object The destination object.
12577       * @param {...Object} [sources] The source objects.
12578       * @returns {Object} Returns `object`.
12579       * @see _.assignIn
12580       * @example
12581       *
12582       * function Foo() {
12583       *   this.a = 1;
12584       * }
12585       *
12586       * function Bar() {
12587       *   this.c = 3;
12588       * }
12589       *
12590       * Foo.prototype.b = 2;
12591       * Bar.prototype.d = 4;
12592       *
12593       * _.assign({ 'a': 0 }, new Foo, new Bar);
12594       * // => { 'a': 1, 'c': 3 }
12595       */
12596      var assign = createAssigner(function(object, source) {
12597        if (isPrototype(source) || isArrayLike(source)) {
12598          copyObject(source, keys(source), object);
12599          return;
12600        }
12601        for (var key in source) {
12602          if (hasOwnProperty.call(source, key)) {
12603            assignValue(object, key, source[key]);
12604          }
12605        }
12606      });
12607  
12608      /**
12609       * This method is like `_.assign` except that it iterates over own and
12610       * inherited source properties.
12611       *
12612       * **Note:** This method mutates `object`.
12613       *
12614       * @static
12615       * @memberOf _
12616       * @since 4.0.0
12617       * @alias extend
12618       * @category Object
12619       * @param {Object} object The destination object.
12620       * @param {...Object} [sources] The source objects.
12621       * @returns {Object} Returns `object`.
12622       * @see _.assign
12623       * @example
12624       *
12625       * function Foo() {
12626       *   this.a = 1;
12627       * }
12628       *
12629       * function Bar() {
12630       *   this.c = 3;
12631       * }
12632       *
12633       * Foo.prototype.b = 2;
12634       * Bar.prototype.d = 4;
12635       *
12636       * _.assignIn({ 'a': 0 }, new Foo, new Bar);
12637       * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
12638       */
12639      var assignIn = createAssigner(function(object, source) {
12640        copyObject(source, keysIn(source), object);
12641      });
12642  
12643      /**
12644       * This method is like `_.assignIn` except that it accepts `customizer`
12645       * which is invoked to produce the assigned values. If `customizer` returns
12646       * `undefined`, assignment is handled by the method instead. The `customizer`
12647       * is invoked with five arguments: (objValue, srcValue, key, object, source).
12648       *
12649       * **Note:** This method mutates `object`.
12650       *
12651       * @static
12652       * @memberOf _
12653       * @since 4.0.0
12654       * @alias extendWith
12655       * @category Object
12656       * @param {Object} object The destination object.
12657       * @param {...Object} sources The source objects.
12658       * @param {Function} [customizer] The function to customize assigned values.
12659       * @returns {Object} Returns `object`.
12660       * @see _.assignWith
12661       * @example
12662       *
12663       * function customizer(objValue, srcValue) {
12664       *   return _.isUndefined(objValue) ? srcValue : objValue;
12665       * }
12666       *
12667       * var defaults = _.partialRight(_.assignInWith, customizer);
12668       *
12669       * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12670       * // => { 'a': 1, 'b': 2 }
12671       */
12672      var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
12673        copyObject(source, keysIn(source), object, customizer);
12674      });
12675  
12676      /**
12677       * This method is like `_.assign` except that it accepts `customizer`
12678       * which is invoked to produce the assigned values. If `customizer` returns
12679       * `undefined`, assignment is handled by the method instead. The `customizer`
12680       * is invoked with five arguments: (objValue, srcValue, key, object, source).
12681       *
12682       * **Note:** This method mutates `object`.
12683       *
12684       * @static
12685       * @memberOf _
12686       * @since 4.0.0
12687       * @category Object
12688       * @param {Object} object The destination object.
12689       * @param {...Object} sources The source objects.
12690       * @param {Function} [customizer] The function to customize assigned values.
12691       * @returns {Object} Returns `object`.
12692       * @see _.assignInWith
12693       * @example
12694       *
12695       * function customizer(objValue, srcValue) {
12696       *   return _.isUndefined(objValue) ? srcValue : objValue;
12697       * }
12698       *
12699       * var defaults = _.partialRight(_.assignWith, customizer);
12700       *
12701       * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12702       * // => { 'a': 1, 'b': 2 }
12703       */
12704      var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
12705        copyObject(source, keys(source), object, customizer);
12706      });
12707  
12708      /**
12709       * Creates an array of values corresponding to `paths` of `object`.
12710       *
12711       * @static
12712       * @memberOf _
12713       * @since 1.0.0
12714       * @category Object
12715       * @param {Object} object The object to iterate over.
12716       * @param {...(string|string[])} [paths] The property paths to pick.
12717       * @returns {Array} Returns the picked values.
12718       * @example
12719       *
12720       * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
12721       *
12722       * _.at(object, ['a[0].b.c', 'a[1]']);
12723       * // => [3, 4]
12724       */
12725      var at = flatRest(baseAt);
12726  
12727      /**
12728       * Creates an object that inherits from the `prototype` object. If a
12729       * `properties` object is given, its own enumerable string keyed properties
12730       * are assigned to the created object.
12731       *
12732       * @static
12733       * @memberOf _
12734       * @since 2.3.0
12735       * @category Object
12736       * @param {Object} prototype The object to inherit from.
12737       * @param {Object} [properties] The properties to assign to the object.
12738       * @returns {Object} Returns the new object.
12739       * @example
12740       *
12741       * function Shape() {
12742       *   this.x = 0;
12743       *   this.y = 0;
12744       * }
12745       *
12746       * function Circle() {
12747       *   Shape.call(this);
12748       * }
12749       *
12750       * Circle.prototype = _.create(Shape.prototype, {
12751       *   'constructor': Circle
12752       * });
12753       *
12754       * var circle = new Circle;
12755       * circle instanceof Circle;
12756       * // => true
12757       *
12758       * circle instanceof Shape;
12759       * // => true
12760       */
12761      function create(prototype, properties) {
12762        var result = baseCreate(prototype);
12763        return properties == null ? result : baseAssign(result, properties);
12764      }
12765  
12766      /**
12767       * Assigns own and inherited enumerable string keyed properties of source
12768       * objects to the destination object for all destination properties that
12769       * resolve to `undefined`. Source objects are applied from left to right.
12770       * Once a property is set, additional values of the same property are ignored.
12771       *
12772       * **Note:** This method mutates `object`.
12773       *
12774       * @static
12775       * @since 0.1.0
12776       * @memberOf _
12777       * @category Object
12778       * @param {Object} object The destination object.
12779       * @param {...Object} [sources] The source objects.
12780       * @returns {Object} Returns `object`.
12781       * @see _.defaultsDeep
12782       * @example
12783       *
12784       * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
12785       * // => { 'a': 1, 'b': 2 }
12786       */
12787      var defaults = baseRest(function(object, sources) {
12788        object = Object(object);
12789  
12790        var index = -1;
12791        var length = sources.length;
12792        var guard = length > 2 ? sources[2] : undefined;
12793  
12794        if (guard && isIterateeCall(sources[0], sources[1], guard)) {
12795          length = 1;
12796        }
12797  
12798        while (++index < length) {
12799          var source = sources[index];
12800          var props = keysIn(source);
12801          var propsIndex = -1;
12802          var propsLength = props.length;
12803  
12804          while (++propsIndex < propsLength) {
12805            var key = props[propsIndex];
12806            var value = object[key];
12807  
12808            if (value === undefined ||
12809                (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
12810              object[key] = source[key];
12811            }
12812          }
12813        }
12814  
12815        return object;
12816      });
12817  
12818      /**
12819       * This method is like `_.defaults` except that it recursively assigns
12820       * default properties.
12821       *
12822       * **Note:** This method mutates `object`.
12823       *
12824       * @static
12825       * @memberOf _
12826       * @since 3.10.0
12827       * @category Object
12828       * @param {Object} object The destination object.
12829       * @param {...Object} [sources] The source objects.
12830       * @returns {Object} Returns `object`.
12831       * @see _.defaults
12832       * @example
12833       *
12834       * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
12835       * // => { 'a': { 'b': 2, 'c': 3 } }
12836       */
12837      var defaultsDeep = baseRest(function(args) {
12838        args.push(undefined, customDefaultsMerge);
12839        return apply(mergeWith, undefined, args);
12840      });
12841  
12842      /**
12843       * This method is like `_.find` except that it returns the key of the first
12844       * element `predicate` returns truthy for instead of the element itself.
12845       *
12846       * @static
12847       * @memberOf _
12848       * @since 1.1.0
12849       * @category Object
12850       * @param {Object} object The object to inspect.
12851       * @param {Function} [predicate=_.identity] The function invoked per iteration.
12852       * @returns {string|undefined} Returns the key of the matched element,
12853       *  else `undefined`.
12854       * @example
12855       *
12856       * var users = {
12857       *   'barney':  { 'age': 36, 'active': true },
12858       *   'fred':    { 'age': 40, 'active': false },
12859       *   'pebbles': { 'age': 1,  'active': true }
12860       * };
12861       *
12862       * _.findKey(users, function(o) { return o.age < 40; });
12863       * // => 'barney' (iteration order is not guaranteed)
12864       *
12865       * // The `_.matches` iteratee shorthand.
12866       * _.findKey(users, { 'age': 1, 'active': true });
12867       * // => 'pebbles'
12868       *
12869       * // The `_.matchesProperty` iteratee shorthand.
12870       * _.findKey(users, ['active', false]);
12871       * // => 'fred'
12872       *
12873       * // The `_.property` iteratee shorthand.
12874       * _.findKey(users, 'active');
12875       * // => 'barney'
12876       */
12877      function findKey(object, predicate) {
12878        return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
12879      }
12880  
12881      /**
12882       * This method is like `_.findKey` except that it iterates over elements of
12883       * a collection in the opposite order.
12884       *
12885       * @static
12886       * @memberOf _
12887       * @since 2.0.0
12888       * @category Object
12889       * @param {Object} object The object to inspect.
12890       * @param {Function} [predicate=_.identity] The function invoked per iteration.
12891       * @returns {string|undefined} Returns the key of the matched element,
12892       *  else `undefined`.
12893       * @example
12894       *
12895       * var users = {
12896       *   'barney':  { 'age': 36, 'active': true },
12897       *   'fred':    { 'age': 40, 'active': false },
12898       *   'pebbles': { 'age': 1,  'active': true }
12899       * };
12900       *
12901       * _.findLastKey(users, function(o) { return o.age < 40; });
12902       * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
12903       *
12904       * // The `_.matches` iteratee shorthand.
12905       * _.findLastKey(users, { 'age': 36, 'active': true });
12906       * // => 'barney'
12907       *
12908       * // The `_.matchesProperty` iteratee shorthand.
12909       * _.findLastKey(users, ['active', false]);
12910       * // => 'fred'
12911       *
12912       * // The `_.property` iteratee shorthand.
12913       * _.findLastKey(users, 'active');
12914       * // => 'pebbles'
12915       */
12916      function findLastKey(object, predicate) {
12917        return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
12918      }
12919  
12920      /**
12921       * Iterates over own and inherited enumerable string keyed properties of an
12922       * object and invokes `iteratee` for each property. The iteratee is invoked
12923       * with three arguments: (value, key, object). Iteratee functions may exit
12924       * iteration early by explicitly returning `false`.
12925       *
12926       * @static
12927       * @memberOf _
12928       * @since 0.3.0
12929       * @category Object
12930       * @param {Object} object The object to iterate over.
12931       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
12932       * @returns {Object} Returns `object`.
12933       * @see _.forInRight
12934       * @example
12935       *
12936       * function Foo() {
12937       *   this.a = 1;
12938       *   this.b = 2;
12939       * }
12940       *
12941       * Foo.prototype.c = 3;
12942       *
12943       * _.forIn(new Foo, function(value, key) {
12944       *   console.log(key);
12945       * });
12946       * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
12947       */
12948      function forIn(object, iteratee) {
12949        return object == null
12950          ? object
12951          : baseFor(object, getIteratee(iteratee, 3), keysIn);
12952      }
12953  
12954      /**
12955       * This method is like `_.forIn` except that it iterates over properties of
12956       * `object` in the opposite order.
12957       *
12958       * @static
12959       * @memberOf _
12960       * @since 2.0.0
12961       * @category Object
12962       * @param {Object} object The object to iterate over.
12963       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
12964       * @returns {Object} Returns `object`.
12965       * @see _.forIn
12966       * @example
12967       *
12968       * function Foo() {
12969       *   this.a = 1;
12970       *   this.b = 2;
12971       * }
12972       *
12973       * Foo.prototype.c = 3;
12974       *
12975       * _.forInRight(new Foo, function(value, key) {
12976       *   console.log(key);
12977       * });
12978       * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
12979       */
12980      function forInRight(object, iteratee) {
12981        return object == null
12982          ? object
12983          : baseForRight(object, getIteratee(iteratee, 3), keysIn);
12984      }
12985  
12986      /**
12987       * Iterates over own enumerable string keyed properties of an object and
12988       * invokes `iteratee` for each property. The iteratee is invoked with three
12989       * arguments: (value, key, object). Iteratee functions may exit iteration
12990       * early by explicitly returning `false`.
12991       *
12992       * @static
12993       * @memberOf _
12994       * @since 0.3.0
12995       * @category Object
12996       * @param {Object} object The object to iterate over.
12997       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
12998       * @returns {Object} Returns `object`.
12999       * @see _.forOwnRight
13000       * @example
13001       *
13002       * function Foo() {
13003       *   this.a = 1;
13004       *   this.b = 2;
13005       * }
13006       *
13007       * Foo.prototype.c = 3;
13008       *
13009       * _.forOwn(new Foo, function(value, key) {
13010       *   console.log(key);
13011       * });
13012       * // => Logs 'a' then 'b' (iteration order is not guaranteed).
13013       */
13014      function forOwn(object, iteratee) {
13015        return object && baseForOwn(object, getIteratee(iteratee, 3));
13016      }
13017  
13018      /**
13019       * This method is like `_.forOwn` except that it iterates over properties of
13020       * `object` in the opposite order.
13021       *
13022       * @static
13023       * @memberOf _
13024       * @since 2.0.0
13025       * @category Object
13026       * @param {Object} object The object to iterate over.
13027       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13028       * @returns {Object} Returns `object`.
13029       * @see _.forOwn
13030       * @example
13031       *
13032       * function Foo() {
13033       *   this.a = 1;
13034       *   this.b = 2;
13035       * }
13036       *
13037       * Foo.prototype.c = 3;
13038       *
13039       * _.forOwnRight(new Foo, function(value, key) {
13040       *   console.log(key);
13041       * });
13042       * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
13043       */
13044      function forOwnRight(object, iteratee) {
13045        return object && baseForOwnRight(object, getIteratee(iteratee, 3));
13046      }
13047  
13048      /**
13049       * Creates an array of function property names from own enumerable properties
13050       * of `object`.
13051       *
13052       * @static
13053       * @since 0.1.0
13054       * @memberOf _
13055       * @category Object
13056       * @param {Object} object The object to inspect.
13057       * @returns {Array} Returns the function names.
13058       * @see _.functionsIn
13059       * @example
13060       *
13061       * function Foo() {
13062       *   this.a = _.constant('a');
13063       *   this.b = _.constant('b');
13064       * }
13065       *
13066       * Foo.prototype.c = _.constant('c');
13067       *
13068       * _.functions(new Foo);
13069       * // => ['a', 'b']
13070       */
13071      function functions(object) {
13072        return object == null ? [] : baseFunctions(object, keys(object));
13073      }
13074  
13075      /**
13076       * Creates an array of function property names from own and inherited
13077       * enumerable properties of `object`.
13078       *
13079       * @static
13080       * @memberOf _
13081       * @since 4.0.0
13082       * @category Object
13083       * @param {Object} object The object to inspect.
13084       * @returns {Array} Returns the function names.
13085       * @see _.functions
13086       * @example
13087       *
13088       * function Foo() {
13089       *   this.a = _.constant('a');
13090       *   this.b = _.constant('b');
13091       * }
13092       *
13093       * Foo.prototype.c = _.constant('c');
13094       *
13095       * _.functionsIn(new Foo);
13096       * // => ['a', 'b', 'c']
13097       */
13098      function functionsIn(object) {
13099        return object == null ? [] : baseFunctions(object, keysIn(object));
13100      }
13101  
13102      /**
13103       * Gets the value at `path` of `object`. If the resolved value is
13104       * `undefined`, the `defaultValue` is returned in its place.
13105       *
13106       * @static
13107       * @memberOf _
13108       * @since 3.7.0
13109       * @category Object
13110       * @param {Object} object The object to query.
13111       * @param {Array|string} path The path of the property to get.
13112       * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13113       * @returns {*} Returns the resolved value.
13114       * @example
13115       *
13116       * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13117       *
13118       * _.get(object, 'a[0].b.c');
13119       * // => 3
13120       *
13121       * _.get(object, ['a', '0', 'b', 'c']);
13122       * // => 3
13123       *
13124       * _.get(object, 'a.b.c', 'default');
13125       * // => 'default'
13126       */
13127      function get(object, path, defaultValue) {
13128        var result = object == null ? undefined : baseGet(object, path);
13129        return result === undefined ? defaultValue : result;
13130      }
13131  
13132      /**
13133       * Checks if `path` is a direct property of `object`.
13134       *
13135       * @static
13136       * @since 0.1.0
13137       * @memberOf _
13138       * @category Object
13139       * @param {Object} object The object to query.
13140       * @param {Array|string} path The path to check.
13141       * @returns {boolean} Returns `true` if `path` exists, else `false`.
13142       * @example
13143       *
13144       * var object = { 'a': { 'b': 2 } };
13145       * var other = _.create({ 'a': _.create({ 'b': 2 }) });
13146       *
13147       * _.has(object, 'a');
13148       * // => true
13149       *
13150       * _.has(object, 'a.b');
13151       * // => true
13152       *
13153       * _.has(object, ['a', 'b']);
13154       * // => true
13155       *
13156       * _.has(other, 'a');
13157       * // => false
13158       */
13159      function has(object, path) {
13160        return object != null && hasPath(object, path, baseHas);
13161      }
13162  
13163      /**
13164       * Checks if `path` is a direct or inherited property of `object`.
13165       *
13166       * @static
13167       * @memberOf _
13168       * @since 4.0.0
13169       * @category Object
13170       * @param {Object} object The object to query.
13171       * @param {Array|string} path The path to check.
13172       * @returns {boolean} Returns `true` if `path` exists, else `false`.
13173       * @example
13174       *
13175       * var object = _.create({ 'a': _.create({ 'b': 2 }) });
13176       *
13177       * _.hasIn(object, 'a');
13178       * // => true
13179       *
13180       * _.hasIn(object, 'a.b');
13181       * // => true
13182       *
13183       * _.hasIn(object, ['a', 'b']);
13184       * // => true
13185       *
13186       * _.hasIn(object, 'b');
13187       * // => false
13188       */
13189      function hasIn(object, path) {
13190        return object != null && hasPath(object, path, baseHasIn);
13191      }
13192  
13193      /**
13194       * Creates an object composed of the inverted keys and values of `object`.
13195       * If `object` contains duplicate values, subsequent values overwrite
13196       * property assignments of previous values.
13197       *
13198       * @static
13199       * @memberOf _
13200       * @since 0.7.0
13201       * @category Object
13202       * @param {Object} object The object to invert.
13203       * @returns {Object} Returns the new inverted object.
13204       * @example
13205       *
13206       * var object = { 'a': 1, 'b': 2, 'c': 1 };
13207       *
13208       * _.invert(object);
13209       * // => { '1': 'c', '2': 'b' }
13210       */
13211      var invert = createInverter(function(result, value, key) {
13212        if (value != null &&
13213            typeof value.toString != 'function') {
13214          value = nativeObjectToString.call(value);
13215        }
13216  
13217        result[value] = key;
13218      }, constant(identity));
13219  
13220      /**
13221       * This method is like `_.invert` except that the inverted object is generated
13222       * from the results of running each element of `object` thru `iteratee`. The
13223       * corresponding inverted value of each inverted key is an array of keys
13224       * responsible for generating the inverted value. The iteratee is invoked
13225       * with one argument: (value).
13226       *
13227       * @static
13228       * @memberOf _
13229       * @since 4.1.0
13230       * @category Object
13231       * @param {Object} object The object to invert.
13232       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
13233       * @returns {Object} Returns the new inverted object.
13234       * @example
13235       *
13236       * var object = { 'a': 1, 'b': 2, 'c': 1 };
13237       *
13238       * _.invertBy(object);
13239       * // => { '1': ['a', 'c'], '2': ['b'] }
13240       *
13241       * _.invertBy(object, function(value) {
13242       *   return 'group' + value;
13243       * });
13244       * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
13245       */
13246      var invertBy = createInverter(function(result, value, key) {
13247        if (value != null &&
13248            typeof value.toString != 'function') {
13249          value = nativeObjectToString.call(value);
13250        }
13251  
13252        if (hasOwnProperty.call(result, value)) {
13253          result[value].push(key);
13254        } else {
13255          result[value] = [key];
13256        }
13257      }, getIteratee);
13258  
13259      /**
13260       * Invokes the method at `path` of `object`.
13261       *
13262       * @static
13263       * @memberOf _
13264       * @since 4.0.0
13265       * @category Object
13266       * @param {Object} object The object to query.
13267       * @param {Array|string} path The path of the method to invoke.
13268       * @param {...*} [args] The arguments to invoke the method with.
13269       * @returns {*} Returns the result of the invoked method.
13270       * @example
13271       *
13272       * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
13273       *
13274       * _.invoke(object, 'a[0].b.c.slice', 1, 3);
13275       * // => [2, 3]
13276       */
13277      var invoke = baseRest(baseInvoke);
13278  
13279      /**
13280       * Creates an array of the own enumerable property names of `object`.
13281       *
13282       * **Note:** Non-object values are coerced to objects. See the
13283       * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
13284       * for more details.
13285       *
13286       * @static
13287       * @since 0.1.0
13288       * @memberOf _
13289       * @category Object
13290       * @param {Object} object The object to query.
13291       * @returns {Array} Returns the array of property names.
13292       * @example
13293       *
13294       * function Foo() {
13295       *   this.a = 1;
13296       *   this.b = 2;
13297       * }
13298       *
13299       * Foo.prototype.c = 3;
13300       *
13301       * _.keys(new Foo);
13302       * // => ['a', 'b'] (iteration order is not guaranteed)
13303       *
13304       * _.keys('hi');
13305       * // => ['0', '1']
13306       */
13307      function keys(object) {
13308        return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
13309      }
13310  
13311      /**
13312       * Creates an array of the own and inherited enumerable property names of `object`.
13313       *
13314       * **Note:** Non-object values are coerced to objects.
13315       *
13316       * @static
13317       * @memberOf _
13318       * @since 3.0.0
13319       * @category Object
13320       * @param {Object} object The object to query.
13321       * @returns {Array} Returns the array of property names.
13322       * @example
13323       *
13324       * function Foo() {
13325       *   this.a = 1;
13326       *   this.b = 2;
13327       * }
13328       *
13329       * Foo.prototype.c = 3;
13330       *
13331       * _.keysIn(new Foo);
13332       * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
13333       */
13334      function keysIn(object) {
13335        return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
13336      }
13337  
13338      /**
13339       * The opposite of `_.mapValues`; this method creates an object with the
13340       * same values as `object` and keys generated by running each own enumerable
13341       * string keyed property of `object` thru `iteratee`. The iteratee is invoked
13342       * with three arguments: (value, key, object).
13343       *
13344       * @static
13345       * @memberOf _
13346       * @since 3.8.0
13347       * @category Object
13348       * @param {Object} object The object to iterate over.
13349       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13350       * @returns {Object} Returns the new mapped object.
13351       * @see _.mapValues
13352       * @example
13353       *
13354       * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
13355       *   return key + value;
13356       * });
13357       * // => { 'a1': 1, 'b2': 2 }
13358       */
13359      function mapKeys(object, iteratee) {
13360        var result = {};
13361        iteratee = getIteratee(iteratee, 3);
13362  
13363        baseForOwn(object, function(value, key, object) {
13364          baseAssignValue(result, iteratee(value, key, object), value);
13365        });
13366        return result;
13367      }
13368  
13369      /**
13370       * Creates an object with the same keys as `object` and values generated
13371       * by running each own enumerable string keyed property of `object` thru
13372       * `iteratee`. The iteratee is invoked with three arguments:
13373       * (value, key, object).
13374       *
13375       * @static
13376       * @memberOf _
13377       * @since 2.4.0
13378       * @category Object
13379       * @param {Object} object The object to iterate over.
13380       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13381       * @returns {Object} Returns the new mapped object.
13382       * @see _.mapKeys
13383       * @example
13384       *
13385       * var users = {
13386       *   'fred':    { 'user': 'fred',    'age': 40 },
13387       *   'pebbles': { 'user': 'pebbles', 'age': 1 }
13388       * };
13389       *
13390       * _.mapValues(users, function(o) { return o.age; });
13391       * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13392       *
13393       * // The `_.property` iteratee shorthand.
13394       * _.mapValues(users, 'age');
13395       * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13396       */
13397      function mapValues(object, iteratee) {
13398        var result = {};
13399        iteratee = getIteratee(iteratee, 3);
13400  
13401        baseForOwn(object, function(value, key, object) {
13402          baseAssignValue(result, key, iteratee(value, key, object));
13403        });
13404        return result;
13405      }
13406  
13407      /**
13408       * This method is like `_.assign` except that it recursively merges own and
13409       * inherited enumerable string keyed properties of source objects into the
13410       * destination object. Source properties that resolve to `undefined` are
13411       * skipped if a destination value exists. Array and plain object properties
13412       * are merged recursively. Other objects and value types are overridden by
13413       * assignment. Source objects are applied from left to right. Subsequent
13414       * sources overwrite property assignments of previous sources.
13415       *
13416       * **Note:** This method mutates `object`.
13417       *
13418       * @static
13419       * @memberOf _
13420       * @since 0.5.0
13421       * @category Object
13422       * @param {Object} object The destination object.
13423       * @param {...Object} [sources] The source objects.
13424       * @returns {Object} Returns `object`.
13425       * @example
13426       *
13427       * var object = {
13428       *   'a': [{ 'b': 2 }, { 'd': 4 }]
13429       * };
13430       *
13431       * var other = {
13432       *   'a': [{ 'c': 3 }, { 'e': 5 }]
13433       * };
13434       *
13435       * _.merge(object, other);
13436       * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
13437       */
13438      var merge = createAssigner(function(object, source, srcIndex) {
13439        baseMerge(object, source, srcIndex);
13440      });
13441  
13442      /**
13443       * This method is like `_.merge` except that it accepts `customizer` which
13444       * is invoked to produce the merged values of the destination and source
13445       * properties. If `customizer` returns `undefined`, merging is handled by the
13446       * method instead. The `customizer` is invoked with six arguments:
13447       * (objValue, srcValue, key, object, source, stack).
13448       *
13449       * **Note:** This method mutates `object`.
13450       *
13451       * @static
13452       * @memberOf _
13453       * @since 4.0.0
13454       * @category Object
13455       * @param {Object} object The destination object.
13456       * @param {...Object} sources The source objects.
13457       * @param {Function} customizer The function to customize assigned values.
13458       * @returns {Object} Returns `object`.
13459       * @example
13460       *
13461       * function customizer(objValue, srcValue) {
13462       *   if (_.isArray(objValue)) {
13463       *     return objValue.concat(srcValue);
13464       *   }
13465       * }
13466       *
13467       * var object = { 'a': [1], 'b': [2] };
13468       * var other = { 'a': [3], 'b': [4] };
13469       *
13470       * _.mergeWith(object, other, customizer);
13471       * // => { 'a': [1, 3], 'b': [2, 4] }
13472       */
13473      var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
13474        baseMerge(object, source, srcIndex, customizer);
13475      });
13476  
13477      /**
13478       * The opposite of `_.pick`; this method creates an object composed of the
13479       * own and inherited enumerable property paths of `object` that are not omitted.
13480       *
13481       * **Note:** This method is considerably slower than `_.pick`.
13482       *
13483       * @static
13484       * @since 0.1.0
13485       * @memberOf _
13486       * @category Object
13487       * @param {Object} object The source object.
13488       * @param {...(string|string[])} [paths] The property paths to omit.
13489       * @returns {Object} Returns the new object.
13490       * @example
13491       *
13492       * var object = { 'a': 1, 'b': '2', 'c': 3 };
13493       *
13494       * _.omit(object, ['a', 'c']);
13495       * // => { 'b': '2' }
13496       */
13497      var omit = flatRest(function(object, paths) {
13498        var result = {};
13499        if (object == null) {
13500          return result;
13501        }
13502        var isDeep = false;
13503        paths = arrayMap(paths, function(path) {
13504          path = castPath(path, object);
13505          isDeep || (isDeep = path.length > 1);
13506          return path;
13507        });
13508        copyObject(object, getAllKeysIn(object), result);
13509        if (isDeep) {
13510          result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
13511        }
13512        var length = paths.length;
13513        while (length--) {
13514          baseUnset(result, paths[length]);
13515        }
13516        return result;
13517      });
13518  
13519      /**
13520       * The opposite of `_.pickBy`; this method creates an object composed of
13521       * the own and inherited enumerable string keyed properties of `object` that
13522       * `predicate` doesn't return truthy for. The predicate is invoked with two
13523       * arguments: (value, key).
13524       *
13525       * @static
13526       * @memberOf _
13527       * @since 4.0.0
13528       * @category Object
13529       * @param {Object} object The source object.
13530       * @param {Function} [predicate=_.identity] The function invoked per property.
13531       * @returns {Object} Returns the new object.
13532       * @example
13533       *
13534       * var object = { 'a': 1, 'b': '2', 'c': 3 };
13535       *
13536       * _.omitBy(object, _.isNumber);
13537       * // => { 'b': '2' }
13538       */
13539      function omitBy(object, predicate) {
13540        return pickBy(object, negate(getIteratee(predicate)));
13541      }
13542  
13543      /**
13544       * Creates an object composed of the picked `object` properties.
13545       *
13546       * @static
13547       * @since 0.1.0
13548       * @memberOf _
13549       * @category Object
13550       * @param {Object} object The source object.
13551       * @param {...(string|string[])} [paths] The property paths to pick.
13552       * @returns {Object} Returns the new object.
13553       * @example
13554       *
13555       * var object = { 'a': 1, 'b': '2', 'c': 3 };
13556       *
13557       * _.pick(object, ['a', 'c']);
13558       * // => { 'a': 1, 'c': 3 }
13559       */
13560      var pick = flatRest(function(object, paths) {
13561        return object == null ? {} : basePick(object, paths);
13562      });
13563  
13564      /**
13565       * Creates an object composed of the `object` properties `predicate` returns
13566       * truthy for. The predicate is invoked with two arguments: (value, key).
13567       *
13568       * @static
13569       * @memberOf _
13570       * @since 4.0.0
13571       * @category Object
13572       * @param {Object} object The source object.
13573       * @param {Function} [predicate=_.identity] The function invoked per property.
13574       * @returns {Object} Returns the new object.
13575       * @example
13576       *
13577       * var object = { 'a': 1, 'b': '2', 'c': 3 };
13578       *
13579       * _.pickBy(object, _.isNumber);
13580       * // => { 'a': 1, 'c': 3 }
13581       */
13582      function pickBy(object, predicate) {
13583        if (object == null) {
13584          return {};
13585        }
13586        var props = arrayMap(getAllKeysIn(object), function(prop) {
13587          return [prop];
13588        });
13589        predicate = getIteratee(predicate);
13590        return basePickBy(object, props, function(value, path) {
13591          return predicate(value, path[0]);
13592        });
13593      }
13594  
13595      /**
13596       * This method is like `_.get` except that if the resolved value is a
13597       * function it's invoked with the `this` binding of its parent object and
13598       * its result is returned.
13599       *
13600       * @static
13601       * @since 0.1.0
13602       * @memberOf _
13603       * @category Object
13604       * @param {Object} object The object to query.
13605       * @param {Array|string} path The path of the property to resolve.
13606       * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13607       * @returns {*} Returns the resolved value.
13608       * @example
13609       *
13610       * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
13611       *
13612       * _.result(object, 'a[0].b.c1');
13613       * // => 3
13614       *
13615       * _.result(object, 'a[0].b.c2');
13616       * // => 4
13617       *
13618       * _.result(object, 'a[0].b.c3', 'default');
13619       * // => 'default'
13620       *
13621       * _.result(object, 'a[0].b.c3', _.constant('default'));
13622       * // => 'default'
13623       */
13624      function result(object, path, defaultValue) {
13625        path = castPath(path, object);
13626  
13627        var index = -1,
13628            length = path.length;
13629  
13630        // Ensure the loop is entered when path is empty.
13631        if (!length) {
13632          length = 1;
13633          object = undefined;
13634        }
13635        while (++index < length) {
13636          var value = object == null ? undefined : object[toKey(path[index])];
13637          if (value === undefined) {
13638            index = length;
13639            value = defaultValue;
13640          }
13641          object = isFunction(value) ? value.call(object) : value;
13642        }
13643        return object;
13644      }
13645  
13646      /**
13647       * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
13648       * it's created. Arrays are created for missing index properties while objects
13649       * are created for all other missing properties. Use `_.setWith` to customize
13650       * `path` creation.
13651       *
13652       * **Note:** This method mutates `object`.
13653       *
13654       * @static
13655       * @memberOf _
13656       * @since 3.7.0
13657       * @category Object
13658       * @param {Object} object The object to modify.
13659       * @param {Array|string} path The path of the property to set.
13660       * @param {*} value The value to set.
13661       * @returns {Object} Returns `object`.
13662       * @example
13663       *
13664       * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13665       *
13666       * _.set(object, 'a[0].b.c', 4);
13667       * console.log(object.a[0].b.c);
13668       * // => 4
13669       *
13670       * _.set(object, ['x', '0', 'y', 'z'], 5);
13671       * console.log(object.x[0].y.z);
13672       * // => 5
13673       */
13674      function set(object, path, value) {
13675        return object == null ? object : baseSet(object, path, value);
13676      }
13677  
13678      /**
13679       * This method is like `_.set` except that it accepts `customizer` which is
13680       * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
13681       * path creation is handled by the method instead. The `customizer` is invoked
13682       * with three arguments: (nsValue, key, nsObject).
13683       *
13684       * **Note:** This method mutates `object`.
13685       *
13686       * @static
13687       * @memberOf _
13688       * @since 4.0.0
13689       * @category Object
13690       * @param {Object} object The object to modify.
13691       * @param {Array|string} path The path of the property to set.
13692       * @param {*} value The value to set.
13693       * @param {Function} [customizer] The function to customize assigned values.
13694       * @returns {Object} Returns `object`.
13695       * @example
13696       *
13697       * var object = {};
13698       *
13699       * _.setWith(object, '[0][1]', 'a', Object);
13700       * // => { '0': { '1': 'a' } }
13701       */
13702      function setWith(object, path, value, customizer) {
13703        customizer = typeof customizer == 'function' ? customizer : undefined;
13704        return object == null ? object : baseSet(object, path, value, customizer);
13705      }
13706  
13707      /**
13708       * Creates an array of own enumerable string keyed-value pairs for `object`
13709       * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
13710       * entries are returned.
13711       *
13712       * @static
13713       * @memberOf _
13714       * @since 4.0.0
13715       * @alias entries
13716       * @category Object
13717       * @param {Object} object The object to query.
13718       * @returns {Array} Returns the key-value pairs.
13719       * @example
13720       *
13721       * function Foo() {
13722       *   this.a = 1;
13723       *   this.b = 2;
13724       * }
13725       *
13726       * Foo.prototype.c = 3;
13727       *
13728       * _.toPairs(new Foo);
13729       * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
13730       */
13731      var toPairs = createToPairs(keys);
13732  
13733      /**
13734       * Creates an array of own and inherited enumerable string keyed-value pairs
13735       * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
13736       * or set, its entries are returned.
13737       *
13738       * @static
13739       * @memberOf _
13740       * @since 4.0.0
13741       * @alias entriesIn
13742       * @category Object
13743       * @param {Object} object The object to query.
13744       * @returns {Array} Returns the key-value pairs.
13745       * @example
13746       *
13747       * function Foo() {
13748       *   this.a = 1;
13749       *   this.b = 2;
13750       * }
13751       *
13752       * Foo.prototype.c = 3;
13753       *
13754       * _.toPairsIn(new Foo);
13755       * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
13756       */
13757      var toPairsIn = createToPairs(keysIn);
13758  
13759      /**
13760       * An alternative to `_.reduce`; this method transforms `object` to a new
13761       * `accumulator` object which is the result of running each of its own
13762       * enumerable string keyed properties thru `iteratee`, with each invocation
13763       * potentially mutating the `accumulator` object. If `accumulator` is not
13764       * provided, a new object with the same `[[Prototype]]` will be used. The
13765       * iteratee is invoked with four arguments: (accumulator, value, key, object).
13766       * Iteratee functions may exit iteration early by explicitly returning `false`.
13767       *
13768       * @static
13769       * @memberOf _
13770       * @since 1.3.0
13771       * @category Object
13772       * @param {Object} object The object to iterate over.
13773       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13774       * @param {*} [accumulator] The custom accumulator value.
13775       * @returns {*} Returns the accumulated value.
13776       * @example
13777       *
13778       * _.transform([2, 3, 4], function(result, n) {
13779       *   result.push(n *= n);
13780       *   return n % 2 == 0;
13781       * }, []);
13782       * // => [4, 9]
13783       *
13784       * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
13785       *   (result[value] || (result[value] = [])).push(key);
13786       * }, {});
13787       * // => { '1': ['a', 'c'], '2': ['b'] }
13788       */
13789      function transform(object, iteratee, accumulator) {
13790        var isArr = isArray(object),
13791            isArrLike = isArr || isBuffer(object) || isTypedArray(object);
13792  
13793        iteratee = getIteratee(iteratee, 4);
13794        if (accumulator == null) {
13795          var Ctor = object && object.constructor;
13796          if (isArrLike) {
13797            accumulator = isArr ? new Ctor : [];
13798          }
13799          else if (isObject(object)) {
13800            accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
13801          }
13802          else {
13803            accumulator = {};
13804          }
13805        }
13806        (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
13807          return iteratee(accumulator, value, index, object);
13808        });
13809        return accumulator;
13810      }
13811  
13812      /**
13813       * Removes the property at `path` of `object`.
13814       *
13815       * **Note:** This method mutates `object`.
13816       *
13817       * @static
13818       * @memberOf _
13819       * @since 4.0.0
13820       * @category Object
13821       * @param {Object} object The object to modify.
13822       * @param {Array|string} path The path of the property to unset.
13823       * @returns {boolean} Returns `true` if the property is deleted, else `false`.
13824       * @example
13825       *
13826       * var object = { 'a': [{ 'b': { 'c': 7 } }] };
13827       * _.unset(object, 'a[0].b.c');
13828       * // => true
13829       *
13830       * console.log(object);
13831       * // => { 'a': [{ 'b': {} }] };
13832       *
13833       * _.unset(object, ['a', '0', 'b', 'c']);
13834       * // => true
13835       *
13836       * console.log(object);
13837       * // => { 'a': [{ 'b': {} }] };
13838       */
13839      function unset(object, path) {
13840        return object == null ? true : baseUnset(object, path);
13841      }
13842  
13843      /**
13844       * This method is like `_.set` except that accepts `updater` to produce the
13845       * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
13846       * is invoked with one argument: (value).
13847       *
13848       * **Note:** This method mutates `object`.
13849       *
13850       * @static
13851       * @memberOf _
13852       * @since 4.6.0
13853       * @category Object
13854       * @param {Object} object The object to modify.
13855       * @param {Array|string} path The path of the property to set.
13856       * @param {Function} updater The function to produce the updated value.
13857       * @returns {Object} Returns `object`.
13858       * @example
13859       *
13860       * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13861       *
13862       * _.update(object, 'a[0].b.c', function(n) { return n * n; });
13863       * console.log(object.a[0].b.c);
13864       * // => 9
13865       *
13866       * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
13867       * console.log(object.x[0].y.z);
13868       * // => 0
13869       */
13870      function update(object, path, updater) {
13871        return object == null ? object : baseUpdate(object, path, castFunction(updater));
13872      }
13873  
13874      /**
13875       * This method is like `_.update` except that it accepts `customizer` which is
13876       * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
13877       * path creation is handled by the method instead. The `customizer` is invoked
13878       * with three arguments: (nsValue, key, nsObject).
13879       *
13880       * **Note:** This method mutates `object`.
13881       *
13882       * @static
13883       * @memberOf _
13884       * @since 4.6.0
13885       * @category Object
13886       * @param {Object} object The object to modify.
13887       * @param {Array|string} path The path of the property to set.
13888       * @param {Function} updater The function to produce the updated value.
13889       * @param {Function} [customizer] The function to customize assigned values.
13890       * @returns {Object} Returns `object`.
13891       * @example
13892       *
13893       * var object = {};
13894       *
13895       * _.updateWith(object, '[0][1]', _.constant('a'), Object);
13896       * // => { '0': { '1': 'a' } }
13897       */
13898      function updateWith(object, path, updater, customizer) {
13899        customizer = typeof customizer == 'function' ? customizer : undefined;
13900        return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
13901      }
13902  
13903      /**
13904       * Creates an array of the own enumerable string keyed property values of `object`.
13905       *
13906       * **Note:** Non-object values are coerced to objects.
13907       *
13908       * @static
13909       * @since 0.1.0
13910       * @memberOf _
13911       * @category Object
13912       * @param {Object} object The object to query.
13913       * @returns {Array} Returns the array of property values.
13914       * @example
13915       *
13916       * function Foo() {
13917       *   this.a = 1;
13918       *   this.b = 2;
13919       * }
13920       *
13921       * Foo.prototype.c = 3;
13922       *
13923       * _.values(new Foo);
13924       * // => [1, 2] (iteration order is not guaranteed)
13925       *
13926       * _.values('hi');
13927       * // => ['h', 'i']
13928       */
13929      function values(object) {
13930        return object == null ? [] : baseValues(object, keys(object));
13931      }
13932  
13933      /**
13934       * Creates an array of the own and inherited enumerable string keyed property
13935       * values of `object`.
13936       *
13937       * **Note:** Non-object values are coerced to objects.
13938       *
13939       * @static
13940       * @memberOf _
13941       * @since 3.0.0
13942       * @category Object
13943       * @param {Object} object The object to query.
13944       * @returns {Array} Returns the array of property values.
13945       * @example
13946       *
13947       * function Foo() {
13948       *   this.a = 1;
13949       *   this.b = 2;
13950       * }
13951       *
13952       * Foo.prototype.c = 3;
13953       *
13954       * _.valuesIn(new Foo);
13955       * // => [1, 2, 3] (iteration order is not guaranteed)
13956       */
13957      function valuesIn(object) {
13958        return object == null ? [] : baseValues(object, keysIn(object));
13959      }
13960  
13961      /*------------------------------------------------------------------------*/
13962  
13963      /**
13964       * Clamps `number` within the inclusive `lower` and `upper` bounds.
13965       *
13966       * @static
13967       * @memberOf _
13968       * @since 4.0.0
13969       * @category Number
13970       * @param {number} number The number to clamp.
13971       * @param {number} [lower] The lower bound.
13972       * @param {number} upper The upper bound.
13973       * @returns {number} Returns the clamped number.
13974       * @example
13975       *
13976       * _.clamp(-10, -5, 5);
13977       * // => -5
13978       *
13979       * _.clamp(10, -5, 5);
13980       * // => 5
13981       */
13982      function clamp(number, lower, upper) {
13983        if (upper === undefined) {
13984          upper = lower;
13985          lower = undefined;
13986        }
13987        if (upper !== undefined) {
13988          upper = toNumber(upper);
13989          upper = upper === upper ? upper : 0;
13990        }
13991        if (lower !== undefined) {
13992          lower = toNumber(lower);
13993          lower = lower === lower ? lower : 0;
13994        }
13995        return baseClamp(toNumber(number), lower, upper);
13996      }
13997  
13998      /**
13999       * Checks if `n` is between `start` and up to, but not including, `end`. If
14000       * `end` is not specified, it's set to `start` with `start` then set to `0`.
14001       * If `start` is greater than `end` the params are swapped to support
14002       * negative ranges.
14003       *
14004       * @static
14005       * @memberOf _
14006       * @since 3.3.0
14007       * @category Number
14008       * @param {number} number The number to check.
14009       * @param {number} [start=0] The start of the range.
14010       * @param {number} end The end of the range.
14011       * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
14012       * @see _.range, _.rangeRight
14013       * @example
14014       *
14015       * _.inRange(3, 2, 4);
14016       * // => true
14017       *
14018       * _.inRange(4, 8);
14019       * // => true
14020       *
14021       * _.inRange(4, 2);
14022       * // => false
14023       *
14024       * _.inRange(2, 2);
14025       * // => false
14026       *
14027       * _.inRange(1.2, 2);
14028       * // => true
14029       *
14030       * _.inRange(5.2, 4);
14031       * // => false
14032       *
14033       * _.inRange(-3, -2, -6);
14034       * // => true
14035       */
14036      function inRange(number, start, end) {
14037        start = toFinite(start);
14038        if (end === undefined) {
14039          end = start;
14040          start = 0;
14041        } else {
14042          end = toFinite(end);
14043        }
14044        number = toNumber(number);
14045        return baseInRange(number, start, end);
14046      }
14047  
14048      /**
14049       * Produces a random number between the inclusive `lower` and `upper` bounds.
14050       * If only one argument is provided a number between `0` and the given number
14051       * is returned. If `floating` is `true`, or either `lower` or `upper` are
14052       * floats, a floating-point number is returned instead of an integer.
14053       *
14054       * **Note:** JavaScript follows the IEEE-754 standard for resolving
14055       * floating-point values which can produce unexpected results.
14056       *
14057       * @static
14058       * @memberOf _
14059       * @since 0.7.0
14060       * @category Number
14061       * @param {number} [lower=0] The lower bound.
14062       * @param {number} [upper=1] The upper bound.
14063       * @param {boolean} [floating] Specify returning a floating-point number.
14064       * @returns {number} Returns the random number.
14065       * @example
14066       *
14067       * _.random(0, 5);
14068       * // => an integer between 0 and 5
14069       *
14070       * _.random(5);
14071       * // => also an integer between 0 and 5
14072       *
14073       * _.random(5, true);
14074       * // => a floating-point number between 0 and 5
14075       *
14076       * _.random(1.2, 5.2);
14077       * // => a floating-point number between 1.2 and 5.2
14078       */
14079      function random(lower, upper, floating) {
14080        if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
14081          upper = floating = undefined;
14082        }
14083        if (floating === undefined) {
14084          if (typeof upper == 'boolean') {
14085            floating = upper;
14086            upper = undefined;
14087          }
14088          else if (typeof lower == 'boolean') {
14089            floating = lower;
14090            lower = undefined;
14091          }
14092        }
14093        if (lower === undefined && upper === undefined) {
14094          lower = 0;
14095          upper = 1;
14096        }
14097        else {
14098          lower = toFinite(lower);
14099          if (upper === undefined) {
14100            upper = lower;
14101            lower = 0;
14102          } else {
14103            upper = toFinite(upper);
14104          }
14105        }
14106        if (lower > upper) {
14107          var temp = lower;
14108          lower = upper;
14109          upper = temp;
14110        }
14111        if (floating || lower % 1 || upper % 1) {
14112          var rand = nativeRandom();
14113          return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
14114        }
14115        return baseRandom(lower, upper);
14116      }
14117  
14118      /*------------------------------------------------------------------------*/
14119  
14120      /**
14121       * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
14122       *
14123       * @static
14124       * @memberOf _
14125       * @since 3.0.0
14126       * @category String
14127       * @param {string} [string=''] The string to convert.
14128       * @returns {string} Returns the camel cased string.
14129       * @example
14130       *
14131       * _.camelCase('Foo Bar');
14132       * // => 'fooBar'
14133       *
14134       * _.camelCase('--foo-bar--');
14135       * // => 'fooBar'
14136       *
14137       * _.camelCase('__FOO_BAR__');
14138       * // => 'fooBar'
14139       */
14140      var camelCase = createCompounder(function(result, word, index) {
14141        word = word.toLowerCase();
14142        return result + (index ? capitalize(word) : word);
14143      });
14144  
14145      /**
14146       * Converts the first character of `string` to upper case and the remaining
14147       * to lower case.
14148       *
14149       * @static
14150       * @memberOf _
14151       * @since 3.0.0
14152       * @category String
14153       * @param {string} [string=''] The string to capitalize.
14154       * @returns {string} Returns the capitalized string.
14155       * @example
14156       *
14157       * _.capitalize('FRED');
14158       * // => 'Fred'
14159       */
14160      function capitalize(string) {
14161        return upperFirst(toString(string).toLowerCase());
14162      }
14163  
14164      /**
14165       * Deburrs `string` by converting
14166       * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
14167       * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
14168       * letters to basic Latin letters and removing
14169       * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
14170       *
14171       * @static
14172       * @memberOf _
14173       * @since 3.0.0
14174       * @category String
14175       * @param {string} [string=''] The string to deburr.
14176       * @returns {string} Returns the deburred string.
14177       * @example
14178       *
14179       * _.deburr('déjà vu');
14180       * // => 'deja vu'
14181       */
14182      function deburr(string) {
14183        string = toString(string);
14184        return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
14185      }
14186  
14187      /**
14188       * Checks if `string` ends with the given target string.
14189       *
14190       * @static
14191       * @memberOf _
14192       * @since 3.0.0
14193       * @category String
14194       * @param {string} [string=''] The string to inspect.
14195       * @param {string} [target] The string to search for.
14196       * @param {number} [position=string.length] The position to search up to.
14197       * @returns {boolean} Returns `true` if `string` ends with `target`,
14198       *  else `false`.
14199       * @example
14200       *
14201       * _.endsWith('abc', 'c');
14202       * // => true
14203       *
14204       * _.endsWith('abc', 'b');
14205       * // => false
14206       *
14207       * _.endsWith('abc', 'b', 2);
14208       * // => true
14209       */
14210      function endsWith(string, target, position) {
14211        string = toString(string);
14212        target = baseToString(target);
14213  
14214        var length = string.length;
14215        position = position === undefined
14216          ? length
14217          : baseClamp(toInteger(position), 0, length);
14218  
14219        var end = position;
14220        position -= target.length;
14221        return position >= 0 && string.slice(position, end) == target;
14222      }
14223  
14224      /**
14225       * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
14226       * corresponding HTML entities.
14227       *
14228       * **Note:** No other characters are escaped. To escape additional
14229       * characters use a third-party library like [_he_](https://mths.be/he).
14230       *
14231       * Though the ">" character is escaped for symmetry, characters like
14232       * ">" and "/" don't need escaping in HTML and have no special meaning
14233       * unless they're part of a tag or unquoted attribute value. See
14234       * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
14235       * (under "semi-related fun fact") for more details.
14236       *
14237       * When working with HTML you should always
14238       * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
14239       * XSS vectors.
14240       *
14241       * @static
14242       * @since 0.1.0
14243       * @memberOf _
14244       * @category String
14245       * @param {string} [string=''] The string to escape.
14246       * @returns {string} Returns the escaped string.
14247       * @example
14248       *
14249       * _.escape('fred, barney, & pebbles');
14250       * // => 'fred, barney, &amp; pebbles'
14251       */
14252      function escape(string) {
14253        string = toString(string);
14254        return (string && reHasUnescapedHtml.test(string))
14255          ? string.replace(reUnescapedHtml, escapeHtmlChar)
14256          : string;
14257      }
14258  
14259      /**
14260       * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
14261       * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
14262       *
14263       * @static
14264       * @memberOf _
14265       * @since 3.0.0
14266       * @category String
14267       * @param {string} [string=''] The string to escape.
14268       * @returns {string} Returns the escaped string.
14269       * @example
14270       *
14271       * _.escapeRegExp('[lodash](https://lodash.com/)');
14272       * // => '\[lodash\]\(https://lodash\.com/\)'
14273       */
14274      function escapeRegExp(string) {
14275        string = toString(string);
14276        return (string && reHasRegExpChar.test(string))
14277          ? string.replace(reRegExpChar, '\\$&')
14278          : string;
14279      }
14280  
14281      /**
14282       * Converts `string` to
14283       * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
14284       *
14285       * @static
14286       * @memberOf _
14287       * @since 3.0.0
14288       * @category String
14289       * @param {string} [string=''] The string to convert.
14290       * @returns {string} Returns the kebab cased string.
14291       * @example
14292       *
14293       * _.kebabCase('Foo Bar');
14294       * // => 'foo-bar'
14295       *
14296       * _.kebabCase('fooBar');
14297       * // => 'foo-bar'
14298       *
14299       * _.kebabCase('__FOO_BAR__');
14300       * // => 'foo-bar'
14301       */
14302      var kebabCase = createCompounder(function(result, word, index) {
14303        return result + (index ? '-' : '') + word.toLowerCase();
14304      });
14305  
14306      /**
14307       * Converts `string`, as space separated words, to lower case.
14308       *
14309       * @static
14310       * @memberOf _
14311       * @since 4.0.0
14312       * @category String
14313       * @param {string} [string=''] The string to convert.
14314       * @returns {string} Returns the lower cased string.
14315       * @example
14316       *
14317       * _.lowerCase('--Foo-Bar--');
14318       * // => 'foo bar'
14319       *
14320       * _.lowerCase('fooBar');
14321       * // => 'foo bar'
14322       *
14323       * _.lowerCase('__FOO_BAR__');
14324       * // => 'foo bar'
14325       */
14326      var lowerCase = createCompounder(function(result, word, index) {
14327        return result + (index ? ' ' : '') + word.toLowerCase();
14328      });
14329  
14330      /**
14331       * Converts the first character of `string` to lower case.
14332       *
14333       * @static
14334       * @memberOf _
14335       * @since 4.0.0
14336       * @category String
14337       * @param {string} [string=''] The string to convert.
14338       * @returns {string} Returns the converted string.
14339       * @example
14340       *
14341       * _.lowerFirst('Fred');
14342       * // => 'fred'
14343       *
14344       * _.lowerFirst('FRED');
14345       * // => 'fRED'
14346       */
14347      var lowerFirst = createCaseFirst('toLowerCase');
14348  
14349      /**
14350       * Pads `string` on the left and right sides if it's shorter than `length`.
14351       * Padding characters are truncated if they can't be evenly divided by `length`.
14352       *
14353       * @static
14354       * @memberOf _
14355       * @since 3.0.0
14356       * @category String
14357       * @param {string} [string=''] The string to pad.
14358       * @param {number} [length=0] The padding length.
14359       * @param {string} [chars=' '] The string used as padding.
14360       * @returns {string} Returns the padded string.
14361       * @example
14362       *
14363       * _.pad('abc', 8);
14364       * // => '  abc   '
14365       *
14366       * _.pad('abc', 8, '_-');
14367       * // => '_-abc_-_'
14368       *
14369       * _.pad('abc', 3);
14370       * // => 'abc'
14371       */
14372      function pad(string, length, chars) {
14373        string = toString(string);
14374        length = toInteger(length);
14375  
14376        var strLength = length ? stringSize(string) : 0;
14377        if (!length || strLength >= length) {
14378          return string;
14379        }
14380        var mid = (length - strLength) / 2;
14381        return (
14382          createPadding(nativeFloor(mid), chars) +
14383          string +
14384          createPadding(nativeCeil(mid), chars)
14385        );
14386      }
14387  
14388      /**
14389       * Pads `string` on the right side if it's shorter than `length`. Padding
14390       * characters are truncated if they exceed `length`.
14391       *
14392       * @static
14393       * @memberOf _
14394       * @since 4.0.0
14395       * @category String
14396       * @param {string} [string=''] The string to pad.
14397       * @param {number} [length=0] The padding length.
14398       * @param {string} [chars=' '] The string used as padding.
14399       * @returns {string} Returns the padded string.
14400       * @example
14401       *
14402       * _.padEnd('abc', 6);
14403       * // => 'abc   '
14404       *
14405       * _.padEnd('abc', 6, '_-');
14406       * // => 'abc_-_'
14407       *
14408       * _.padEnd('abc', 3);
14409       * // => 'abc'
14410       */
14411      function padEnd(string, length, chars) {
14412        string = toString(string);
14413        length = toInteger(length);
14414  
14415        var strLength = length ? stringSize(string) : 0;
14416        return (length && strLength < length)
14417          ? (string + createPadding(length - strLength, chars))
14418          : string;
14419      }
14420  
14421      /**
14422       * Pads `string` on the left side if it's shorter than `length`. Padding
14423       * characters are truncated if they exceed `length`.
14424       *
14425       * @static
14426       * @memberOf _
14427       * @since 4.0.0
14428       * @category String
14429       * @param {string} [string=''] The string to pad.
14430       * @param {number} [length=0] The padding length.
14431       * @param {string} [chars=' '] The string used as padding.
14432       * @returns {string} Returns the padded string.
14433       * @example
14434       *
14435       * _.padStart('abc', 6);
14436       * // => '   abc'
14437       *
14438       * _.padStart('abc', 6, '_-');
14439       * // => '_-_abc'
14440       *
14441       * _.padStart('abc', 3);
14442       * // => 'abc'
14443       */
14444      function padStart(string, length, chars) {
14445        string = toString(string);
14446        length = toInteger(length);
14447  
14448        var strLength = length ? stringSize(string) : 0;
14449        return (length && strLength < length)
14450          ? (createPadding(length - strLength, chars) + string)
14451          : string;
14452      }
14453  
14454      /**
14455       * Converts `string` to an integer of the specified radix. If `radix` is
14456       * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
14457       * hexadecimal, in which case a `radix` of `16` is used.
14458       *
14459       * **Note:** This method aligns with the
14460       * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
14461       *
14462       * @static
14463       * @memberOf _
14464       * @since 1.1.0
14465       * @category String
14466       * @param {string} string The string to convert.
14467       * @param {number} [radix=10] The radix to interpret `value` by.
14468       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14469       * @returns {number} Returns the converted integer.
14470       * @example
14471       *
14472       * _.parseInt('08');
14473       * // => 8
14474       *
14475       * _.map(['6', '08', '10'], _.parseInt);
14476       * // => [6, 8, 10]
14477       */
14478      function parseInt(string, radix, guard) {
14479        if (guard || radix == null) {
14480          radix = 0;
14481        } else if (radix) {
14482          radix = +radix;
14483        }
14484        return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
14485      }
14486  
14487      /**
14488       * Repeats the given string `n` times.
14489       *
14490       * @static
14491       * @memberOf _
14492       * @since 3.0.0
14493       * @category String
14494       * @param {string} [string=''] The string to repeat.
14495       * @param {number} [n=1] The number of times to repeat the string.
14496       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14497       * @returns {string} Returns the repeated string.
14498       * @example
14499       *
14500       * _.repeat('*', 3);
14501       * // => '***'
14502       *
14503       * _.repeat('abc', 2);
14504       * // => 'abcabc'
14505       *
14506       * _.repeat('abc', 0);
14507       * // => ''
14508       */
14509      function repeat(string, n, guard) {
14510        if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
14511          n = 1;
14512        } else {
14513          n = toInteger(n);
14514        }
14515        return baseRepeat(toString(string), n);
14516      }
14517  
14518      /**
14519       * Replaces matches for `pattern` in `string` with `replacement`.
14520       *
14521       * **Note:** This method is based on
14522       * [`String#replace`](https://mdn.io/String/replace).
14523       *
14524       * @static
14525       * @memberOf _
14526       * @since 4.0.0
14527       * @category String
14528       * @param {string} [string=''] The string to modify.
14529       * @param {RegExp|string} pattern The pattern to replace.
14530       * @param {Function|string} replacement The match replacement.
14531       * @returns {string} Returns the modified string.
14532       * @example
14533       *
14534       * _.replace('Hi Fred', 'Fred', 'Barney');
14535       * // => 'Hi Barney'
14536       */
14537      function replace() {
14538        var args = arguments,
14539            string = toString(args[0]);
14540  
14541        return args.length < 3 ? string : string.replace(args[1], args[2]);
14542      }
14543  
14544      /**
14545       * Converts `string` to
14546       * [snake case](https://en.wikipedia.org/wiki/Snake_case).
14547       *
14548       * @static
14549       * @memberOf _
14550       * @since 3.0.0
14551       * @category String
14552       * @param {string} [string=''] The string to convert.
14553       * @returns {string} Returns the snake cased string.
14554       * @example
14555       *
14556       * _.snakeCase('Foo Bar');
14557       * // => 'foo_bar'
14558       *
14559       * _.snakeCase('fooBar');
14560       * // => 'foo_bar'
14561       *
14562       * _.snakeCase('--FOO-BAR--');
14563       * // => 'foo_bar'
14564       */
14565      var snakeCase = createCompounder(function(result, word, index) {
14566        return result + (index ? '_' : '') + word.toLowerCase();
14567      });
14568  
14569      /**
14570       * Splits `string` by `separator`.
14571       *
14572       * **Note:** This method is based on
14573       * [`String#split`](https://mdn.io/String/split).
14574       *
14575       * @static
14576       * @memberOf _
14577       * @since 4.0.0
14578       * @category String
14579       * @param {string} [string=''] The string to split.
14580       * @param {RegExp|string} separator The separator pattern to split by.
14581       * @param {number} [limit] The length to truncate results to.
14582       * @returns {Array} Returns the string segments.
14583       * @example
14584       *
14585       * _.split('a-b-c', '-', 2);
14586       * // => ['a', 'b']
14587       */
14588      function split(string, separator, limit) {
14589        if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
14590          separator = limit = undefined;
14591        }
14592        limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
14593        if (!limit) {
14594          return [];
14595        }
14596        string = toString(string);
14597        if (string && (
14598              typeof separator == 'string' ||
14599              (separator != null && !isRegExp(separator))
14600            )) {
14601          separator = baseToString(separator);
14602          if (!separator && hasUnicode(string)) {
14603            return castSlice(stringToArray(string), 0, limit);
14604          }
14605        }
14606        return string.split(separator, limit);
14607      }
14608  
14609      /**
14610       * Converts `string` to
14611       * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
14612       *
14613       * @static
14614       * @memberOf _
14615       * @since 3.1.0
14616       * @category String
14617       * @param {string} [string=''] The string to convert.
14618       * @returns {string} Returns the start cased string.
14619       * @example
14620       *
14621       * _.startCase('--foo-bar--');
14622       * // => 'Foo Bar'
14623       *
14624       * _.startCase('fooBar');
14625       * // => 'Foo Bar'
14626       *
14627       * _.startCase('__FOO_BAR__');
14628       * // => 'FOO BAR'
14629       */
14630      var startCase = createCompounder(function(result, word, index) {
14631        return result + (index ? ' ' : '') + upperFirst(word);
14632      });
14633  
14634      /**
14635       * Checks if `string` starts with the given target string.
14636       *
14637       * @static
14638       * @memberOf _
14639       * @since 3.0.0
14640       * @category String
14641       * @param {string} [string=''] The string to inspect.
14642       * @param {string} [target] The string to search for.
14643       * @param {number} [position=0] The position to search from.
14644       * @returns {boolean} Returns `true` if `string` starts with `target`,
14645       *  else `false`.
14646       * @example
14647       *
14648       * _.startsWith('abc', 'a');
14649       * // => true
14650       *
14651       * _.startsWith('abc', 'b');
14652       * // => false
14653       *
14654       * _.startsWith('abc', 'b', 1);
14655       * // => true
14656       */
14657      function startsWith(string, target, position) {
14658        string = toString(string);
14659        position = position == null
14660          ? 0
14661          : baseClamp(toInteger(position), 0, string.length);
14662  
14663        target = baseToString(target);
14664        return string.slice(position, position + target.length) == target;
14665      }
14666  
14667      /**
14668       * Creates a compiled template function that can interpolate data properties
14669       * in "interpolate" delimiters, HTML-escape interpolated data properties in
14670       * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
14671       * properties may be accessed as free variables in the template. If a setting
14672       * object is given, it takes precedence over `_.templateSettings` values.
14673       *
14674       * **Note:** In the development build `_.template` utilizes
14675       * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
14676       * for easier debugging.
14677       *
14678       * For more information on precompiling templates see
14679       * [lodash's custom builds documentation](https://lodash.com/custom-builds).
14680       *
14681       * For more information on Chrome extension sandboxes see
14682       * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
14683       *
14684       * @static
14685       * @since 0.1.0
14686       * @memberOf _
14687       * @category String
14688       * @param {string} [string=''] The template string.
14689       * @param {Object} [options={}] The options object.
14690       * @param {RegExp} [options.escape=_.templateSettings.escape]
14691       *  The HTML "escape" delimiter.
14692       * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
14693       *  The "evaluate" delimiter.
14694       * @param {Object} [options.imports=_.templateSettings.imports]
14695       *  An object to import into the template as free variables.
14696       * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
14697       *  The "interpolate" delimiter.
14698       * @param {string} [options.sourceURL='lodash.templateSources[n]']
14699       *  The sourceURL of the compiled template.
14700       * @param {string} [options.variable='obj']
14701       *  The data object variable name.
14702       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14703       * @returns {Function} Returns the compiled template function.
14704       * @example
14705       *
14706       * // Use the "interpolate" delimiter to create a compiled template.
14707       * var compiled = _.template('hello <%= user %>!');
14708       * compiled({ 'user': 'fred' });
14709       * // => 'hello fred!'
14710       *
14711       * // Use the HTML "escape" delimiter to escape data property values.
14712       * var compiled = _.template('<b><%- value %></b>');
14713       * compiled({ 'value': '<script>' });
14714       * // => '<b>&lt;script&gt;</b>'
14715       *
14716       * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
14717       * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
14718       * compiled({ 'users': ['fred', 'barney'] });
14719       * // => '<li>fred</li><li>barney</li>'
14720       *
14721       * // Use the internal `print` function in "evaluate" delimiters.
14722       * var compiled = _.template('<% print("hello " + user); %>!');
14723       * compiled({ 'user': 'barney' });
14724       * // => 'hello barney!'
14725       *
14726       * // Use the ES template literal delimiter as an "interpolate" delimiter.
14727       * // Disable support by replacing the "interpolate" delimiter.
14728       * var compiled = _.template('hello ${ user }!');
14729       * compiled({ 'user': 'pebbles' });
14730       * // => 'hello pebbles!'
14731       *
14732       * // Use backslashes to treat delimiters as plain text.
14733       * var compiled = _.template('<%= "\\<%- value %\\>" %>');
14734       * compiled({ 'value': 'ignored' });
14735       * // => '<%- value %>'
14736       *
14737       * // Use the `imports` option to import `jQuery` as `jq`.
14738       * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
14739       * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
14740       * compiled({ 'users': ['fred', 'barney'] });
14741       * // => '<li>fred</li><li>barney</li>'
14742       *
14743       * // Use the `sourceURL` option to specify a custom sourceURL for the template.
14744       * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
14745       * compiled(data);
14746       * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
14747       *
14748       * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
14749       * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
14750       * compiled.source;
14751       * // => function(data) {
14752       * //   var __t, __p = '';
14753       * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
14754       * //   return __p;
14755       * // }
14756       *
14757       * // Use custom template delimiters.
14758       * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
14759       * var compiled = _.template('hello {{ user }}!');
14760       * compiled({ 'user': 'mustache' });
14761       * // => 'hello mustache!'
14762       *
14763       * // Use the `source` property to inline compiled templates for meaningful
14764       * // line numbers in error messages and stack traces.
14765       * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
14766       *   var JST = {\
14767       *     "main": ' + _.template(mainText).source + '\
14768       *   };\
14769       * ');
14770       */
14771      function template(string, options, guard) {
14772        // Based on John Resig's `tmpl` implementation
14773        // (http://ejohn.org/blog/javascript-micro-templating/)
14774        // and Laura Doktorova's doT.js (https://github.com/olado/doT).
14775        var settings = lodash.templateSettings;
14776  
14777        if (guard && isIterateeCall(string, options, guard)) {
14778          options = undefined;
14779        }
14780        string = toString(string);
14781        options = assignInWith({}, options, settings, customDefaultsAssignIn);
14782  
14783        var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
14784            importsKeys = keys(imports),
14785            importsValues = baseValues(imports, importsKeys);
14786  
14787        var isEscaping,
14788            isEvaluating,
14789            index = 0,
14790            interpolate = options.interpolate || reNoMatch,
14791            source = "__p += '";
14792  
14793        // Compile the regexp to match each delimiter.
14794        var reDelimiters = RegExp(
14795          (options.escape || reNoMatch).source + '|' +
14796          interpolate.source + '|' +
14797          (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
14798          (options.evaluate || reNoMatch).source + '|$'
14799        , 'g');
14800  
14801        // Use a sourceURL for easier debugging.
14802        var sourceURL = '//# sourceURL=' +
14803          ('sourceURL' in options
14804            ? options.sourceURL
14805            : ('lodash.templateSources[' + (++templateCounter) + ']')
14806          ) + '\n';
14807  
14808        string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
14809          interpolateValue || (interpolateValue = esTemplateValue);
14810  
14811          // Escape characters that can't be included in string literals.
14812          source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
14813  
14814          // Replace delimiters with snippets.
14815          if (escapeValue) {
14816            isEscaping = true;
14817            source += "' +\n__e(" + escapeValue + ") +\n'";
14818          }
14819          if (evaluateValue) {
14820            isEvaluating = true;
14821            source += "';\n" + evaluateValue + ";\n__p += '";
14822          }
14823          if (interpolateValue) {
14824            source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
14825          }
14826          index = offset + match.length;
14827  
14828          // The JS engine embedded in Adobe products needs `match` returned in
14829          // order to produce the correct `offset` value.
14830          return match;
14831        });
14832  
14833        source += "';\n";
14834  
14835        // If `variable` is not specified wrap a with-statement around the generated
14836        // code to add the data object to the top of the scope chain.
14837        var variable = options.variable;
14838        if (!variable) {
14839          source = 'with (obj) {\n' + source + '\n}\n';
14840        }
14841        // Cleanup code by stripping empty strings.
14842        source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
14843          .replace(reEmptyStringMiddle, '$1')
14844          .replace(reEmptyStringTrailing, '$1;');
14845  
14846        // Frame code as the function body.
14847        source = 'function(' + (variable || 'obj') + ') {\n' +
14848          (variable
14849            ? ''
14850            : 'obj || (obj = {});\n'
14851          ) +
14852          "var __t, __p = ''" +
14853          (isEscaping
14854             ? ', __e = _.escape'
14855             : ''
14856          ) +
14857          (isEvaluating
14858            ? ', __j = Array.prototype.join;\n' +
14859              "function print() { __p += __j.call(arguments, '') }\n"
14860            : ';\n'
14861          ) +
14862          source +
14863          'return __p\n}';
14864  
14865        var result = attempt(function() {
14866          return Function(importsKeys, sourceURL + 'return ' + source)
14867            .apply(undefined, importsValues);
14868        });
14869  
14870        // Provide the compiled function's source by its `toString` method or
14871        // the `source` property as a convenience for inlining compiled templates.
14872        result.source = source;
14873        if (isError(result)) {
14874          throw result;
14875        }
14876        return result;
14877      }
14878  
14879      /**
14880       * Converts `string`, as a whole, to lower case just like
14881       * [String#toLowerCase](https://mdn.io/toLowerCase).
14882       *
14883       * @static
14884       * @memberOf _
14885       * @since 4.0.0
14886       * @category String
14887       * @param {string} [string=''] The string to convert.
14888       * @returns {string} Returns the lower cased string.
14889       * @example
14890       *
14891       * _.toLower('--Foo-Bar--');
14892       * // => '--foo-bar--'
14893       *
14894       * _.toLower('fooBar');
14895       * // => 'foobar'
14896       *
14897       * _.toLower('__FOO_BAR__');
14898       * // => '__foo_bar__'
14899       */
14900      function toLower(value) {
14901        return toString(value).toLowerCase();
14902      }
14903  
14904      /**
14905       * Converts `string`, as a whole, to upper case just like
14906       * [String#toUpperCase](https://mdn.io/toUpperCase).
14907       *
14908       * @static
14909       * @memberOf _
14910       * @since 4.0.0
14911       * @category String
14912       * @param {string} [string=''] The string to convert.
14913       * @returns {string} Returns the upper cased string.
14914       * @example
14915       *
14916       * _.toUpper('--foo-bar--');
14917       * // => '--FOO-BAR--'
14918       *
14919       * _.toUpper('fooBar');
14920       * // => 'FOOBAR'
14921       *
14922       * _.toUpper('__foo_bar__');
14923       * // => '__FOO_BAR__'
14924       */
14925      function toUpper(value) {
14926        return toString(value).toUpperCase();
14927      }
14928  
14929      /**
14930       * Removes leading and trailing whitespace or specified characters from `string`.
14931       *
14932       * @static
14933       * @memberOf _
14934       * @since 3.0.0
14935       * @category String
14936       * @param {string} [string=''] The string to trim.
14937       * @param {string} [chars=whitespace] The characters to trim.
14938       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14939       * @returns {string} Returns the trimmed string.
14940       * @example
14941       *
14942       * _.trim('  abc  ');
14943       * // => 'abc'
14944       *
14945       * _.trim('-_-abc-_-', '_-');
14946       * // => 'abc'
14947       *
14948       * _.map(['  foo  ', '  bar  '], _.trim);
14949       * // => ['foo', 'bar']
14950       */
14951      function trim(string, chars, guard) {
14952        string = toString(string);
14953        if (string && (guard || chars === undefined)) {
14954          return string.replace(reTrim, '');
14955        }
14956        if (!string || !(chars = baseToString(chars))) {
14957          return string;
14958        }
14959        var strSymbols = stringToArray(string),
14960            chrSymbols = stringToArray(chars),
14961            start = charsStartIndex(strSymbols, chrSymbols),
14962            end = charsEndIndex(strSymbols, chrSymbols) + 1;
14963  
14964        return castSlice(strSymbols, start, end).join('');
14965      }
14966  
14967      /**
14968       * Removes trailing whitespace or specified characters from `string`.
14969       *
14970       * @static
14971       * @memberOf _
14972       * @since 4.0.0
14973       * @category String
14974       * @param {string} [string=''] The string to trim.
14975       * @param {string} [chars=whitespace] The characters to trim.
14976       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14977       * @returns {string} Returns the trimmed string.
14978       * @example
14979       *
14980       * _.trimEnd('  abc  ');
14981       * // => '  abc'
14982       *
14983       * _.trimEnd('-_-abc-_-', '_-');
14984       * // => '-_-abc'
14985       */
14986      function trimEnd(string, chars, guard) {
14987        string = toString(string);
14988        if (string && (guard || chars === undefined)) {
14989          return string.replace(reTrimEnd, '');
14990        }
14991        if (!string || !(chars = baseToString(chars))) {
14992          return string;
14993        }
14994        var strSymbols = stringToArray(string),
14995            end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
14996  
14997        return castSlice(strSymbols, 0, end).join('');
14998      }
14999  
15000      /**
15001       * Removes leading whitespace or specified characters from `string`.
15002       *
15003       * @static
15004       * @memberOf _
15005       * @since 4.0.0
15006       * @category String
15007       * @param {string} [string=''] The string to trim.
15008       * @param {string} [chars=whitespace] The characters to trim.
15009       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15010       * @returns {string} Returns the trimmed string.
15011       * @example
15012       *
15013       * _.trimStart('  abc  ');
15014       * // => 'abc  '
15015       *
15016       * _.trimStart('-_-abc-_-', '_-');
15017       * // => 'abc-_-'
15018       */
15019      function trimStart(string, chars, guard) {
15020        string = toString(string);
15021        if (string && (guard || chars === undefined)) {
15022          return string.replace(reTrimStart, '');
15023        }
15024        if (!string || !(chars = baseToString(chars))) {
15025          return string;
15026        }
15027        var strSymbols = stringToArray(string),
15028            start = charsStartIndex(strSymbols, stringToArray(chars));
15029  
15030        return castSlice(strSymbols, start).join('');
15031      }
15032  
15033      /**
15034       * Truncates `string` if it's longer than the given maximum string length.
15035       * The last characters of the truncated string are replaced with the omission
15036       * string which defaults to "...".
15037       *
15038       * @static
15039       * @memberOf _
15040       * @since 4.0.0
15041       * @category String
15042       * @param {string} [string=''] The string to truncate.
15043       * @param {Object} [options={}] The options object.
15044       * @param {number} [options.length=30] The maximum string length.
15045       * @param {string} [options.omission='...'] The string to indicate text is omitted.
15046       * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
15047       * @returns {string} Returns the truncated string.
15048       * @example
15049       *
15050       * _.truncate('hi-diddly-ho there, neighborino');
15051       * // => 'hi-diddly-ho there, neighbo...'
15052       *
15053       * _.truncate('hi-diddly-ho there, neighborino', {
15054       *   'length': 24,
15055       *   'separator': ' '
15056       * });
15057       * // => 'hi-diddly-ho there,...'
15058       *
15059       * _.truncate('hi-diddly-ho there, neighborino', {
15060       *   'length': 24,
15061       *   'separator': /,? +/
15062       * });
15063       * // => 'hi-diddly-ho there...'
15064       *
15065       * _.truncate('hi-diddly-ho there, neighborino', {
15066       *   'omission': ' [...]'
15067       * });
15068       * // => 'hi-diddly-ho there, neig [...]'
15069       */
15070      function truncate(string, options) {
15071        var length = DEFAULT_TRUNC_LENGTH,
15072            omission = DEFAULT_TRUNC_OMISSION;
15073  
15074        if (isObject(options)) {
15075          var separator = 'separator' in options ? options.separator : separator;
15076          length = 'length' in options ? toInteger(options.length) : length;
15077          omission = 'omission' in options ? baseToString(options.omission) : omission;
15078        }
15079        string = toString(string);
15080  
15081        var strLength = string.length;
15082        if (hasUnicode(string)) {
15083          var strSymbols = stringToArray(string);
15084          strLength = strSymbols.length;
15085        }
15086        if (length >= strLength) {
15087          return string;
15088        }
15089        var end = length - stringSize(omission);
15090        if (end < 1) {
15091          return omission;
15092        }
15093        var result = strSymbols
15094          ? castSlice(strSymbols, 0, end).join('')
15095          : string.slice(0, end);
15096  
15097        if (separator === undefined) {
15098          return result + omission;
15099        }
15100        if (strSymbols) {
15101          end += (result.length - end);
15102        }
15103        if (isRegExp(separator)) {
15104          if (string.slice(end).search(separator)) {
15105            var match,
15106                substring = result;
15107  
15108            if (!separator.global) {
15109              separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
15110            }
15111            separator.lastIndex = 0;
15112            while ((match = separator.exec(substring))) {
15113              var newEnd = match.index;
15114            }
15115            result = result.slice(0, newEnd === undefined ? end : newEnd);
15116          }
15117        } else if (string.indexOf(baseToString(separator), end) != end) {
15118          var index = result.lastIndexOf(separator);
15119          if (index > -1) {
15120            result = result.slice(0, index);
15121          }
15122        }
15123        return result + omission;
15124      }
15125  
15126      /**
15127       * The inverse of `_.escape`; this method converts the HTML entities
15128       * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
15129       * their corresponding characters.
15130       *
15131       * **Note:** No other HTML entities are unescaped. To unescape additional
15132       * HTML entities use a third-party library like [_he_](https://mths.be/he).
15133       *
15134       * @static
15135       * @memberOf _
15136       * @since 0.6.0
15137       * @category String
15138       * @param {string} [string=''] The string to unescape.
15139       * @returns {string} Returns the unescaped string.
15140       * @example
15141       *
15142       * _.unescape('fred, barney, &amp; pebbles');
15143       * // => 'fred, barney, & pebbles'
15144       */
15145      function unescape(string) {
15146        string = toString(string);
15147        return (string && reHasEscapedHtml.test(string))
15148          ? string.replace(reEscapedHtml, unescapeHtmlChar)
15149          : string;
15150      }
15151  
15152      /**
15153       * Converts `string`, as space separated words, to upper case.
15154       *
15155       * @static
15156       * @memberOf _
15157       * @since 4.0.0
15158       * @category String
15159       * @param {string} [string=''] The string to convert.
15160       * @returns {string} Returns the upper cased string.
15161       * @example
15162       *
15163       * _.upperCase('--foo-bar');
15164       * // => 'FOO BAR'
15165       *
15166       * _.upperCase('fooBar');
15167       * // => 'FOO BAR'
15168       *
15169       * _.upperCase('__foo_bar__');
15170       * // => 'FOO BAR'
15171       */
15172      var upperCase = createCompounder(function(result, word, index) {
15173        return result + (index ? ' ' : '') + word.toUpperCase();
15174      });
15175  
15176      /**
15177       * Converts the first character of `string` to upper case.
15178       *
15179       * @static
15180       * @memberOf _
15181       * @since 4.0.0
15182       * @category String
15183       * @param {string} [string=''] The string to convert.
15184       * @returns {string} Returns the converted string.
15185       * @example
15186       *
15187       * _.upperFirst('fred');
15188       * // => 'Fred'
15189       *
15190       * _.upperFirst('FRED');
15191       * // => 'FRED'
15192       */
15193      var upperFirst = createCaseFirst('toUpperCase');
15194  
15195      /**
15196       * Splits `string` into an array of its words.
15197       *
15198       * @static
15199       * @memberOf _
15200       * @since 3.0.0
15201       * @category String
15202       * @param {string} [string=''] The string to inspect.
15203       * @param {RegExp|string} [pattern] The pattern to match words.
15204       * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15205       * @returns {Array} Returns the words of `string`.
15206       * @example
15207       *
15208       * _.words('fred, barney, & pebbles');
15209       * // => ['fred', 'barney', 'pebbles']
15210       *
15211       * _.words('fred, barney, & pebbles', /[^, ]+/g);
15212       * // => ['fred', 'barney', '&', 'pebbles']
15213       */
15214      function words(string, pattern, guard) {
15215        string = toString(string);
15216        pattern = guard ? undefined : pattern;
15217  
15218        if (pattern === undefined) {
15219          return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
15220        }
15221        return string.match(pattern) || [];
15222      }
15223  
15224      /*------------------------------------------------------------------------*/
15225  
15226      /**
15227       * Attempts to invoke `func`, returning either the result or the caught error
15228       * object. Any additional arguments are provided to `func` when it's invoked.
15229       *
15230       * @static
15231       * @memberOf _
15232       * @since 3.0.0
15233       * @category Util
15234       * @param {Function} func The function to attempt.
15235       * @param {...*} [args] The arguments to invoke `func` with.
15236       * @returns {*} Returns the `func` result or error object.
15237       * @example
15238       *
15239       * // Avoid throwing errors for invalid selectors.
15240       * var elements = _.attempt(function(selector) {
15241       *   return document.querySelectorAll(selector);
15242       * }, '>_>');
15243       *
15244       * if (_.isError(elements)) {
15245       *   elements = [];
15246       * }
15247       */
15248      var attempt = baseRest(function(func, args) {
15249        try {
15250          return apply(func, undefined, args);
15251        } catch (e) {
15252          return isError(e) ? e : new Error(e);
15253        }
15254      });
15255  
15256      /**
15257       * Binds methods of an object to the object itself, overwriting the existing
15258       * method.
15259       *
15260       * **Note:** This method doesn't set the "length" property of bound functions.
15261       *
15262       * @static
15263       * @since 0.1.0
15264       * @memberOf _
15265       * @category Util
15266       * @param {Object} object The object to bind and assign the bound methods to.
15267       * @param {...(string|string[])} methodNames The object method names to bind.
15268       * @returns {Object} Returns `object`.
15269       * @example
15270       *
15271       * var view = {
15272       *   'label': 'docs',
15273       *   'click': function() {
15274       *     console.log('clicked ' + this.label);
15275       *   }
15276       * };
15277       *
15278       * _.bindAll(view, ['click']);
15279       * jQuery(element).on('click', view.click);
15280       * // => Logs 'clicked docs' when clicked.
15281       */
15282      var bindAll = flatRest(function(object, methodNames) {
15283        arrayEach(methodNames, function(key) {
15284          key = toKey(key);
15285          baseAssignValue(object, key, bind(object[key], object));
15286        });
15287        return object;
15288      });
15289  
15290      /**
15291       * Creates a function that iterates over `pairs` and invokes the corresponding
15292       * function of the first predicate to return truthy. The predicate-function
15293       * pairs are invoked with the `this` binding and arguments of the created
15294       * function.
15295       *
15296       * @static
15297       * @memberOf _
15298       * @since 4.0.0
15299       * @category Util
15300       * @param {Array} pairs The predicate-function pairs.
15301       * @returns {Function} Returns the new composite function.
15302       * @example
15303       *
15304       * var func = _.cond([
15305       *   [_.matches({ 'a': 1 }),           _.constant('matches A')],
15306       *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
15307       *   [_.stubTrue,                      _.constant('no match')]
15308       * ]);
15309       *
15310       * func({ 'a': 1, 'b': 2 });
15311       * // => 'matches A'
15312       *
15313       * func({ 'a': 0, 'b': 1 });
15314       * // => 'matches B'
15315       *
15316       * func({ 'a': '1', 'b': '2' });
15317       * // => 'no match'
15318       */
15319      function cond(pairs) {
15320        var length = pairs == null ? 0 : pairs.length,
15321            toIteratee = getIteratee();
15322  
15323        pairs = !length ? [] : arrayMap(pairs, function(pair) {
15324          if (typeof pair[1] != 'function') {
15325            throw new TypeError(FUNC_ERROR_TEXT);
15326          }
15327          return [toIteratee(pair[0]), pair[1]];
15328        });
15329  
15330        return baseRest(function(args) {
15331          var index = -1;
15332          while (++index < length) {
15333            var pair = pairs[index];
15334            if (apply(pair[0], this, args)) {
15335              return apply(pair[1], this, args);
15336            }
15337          }
15338        });
15339      }
15340  
15341      /**
15342       * Creates a function that invokes the predicate properties of `source` with
15343       * the corresponding property values of a given object, returning `true` if
15344       * all predicates return truthy, else `false`.
15345       *
15346       * **Note:** The created function is equivalent to `_.conformsTo` with
15347       * `source` partially applied.
15348       *
15349       * @static
15350       * @memberOf _
15351       * @since 4.0.0
15352       * @category Util
15353       * @param {Object} source The object of property predicates to conform to.
15354       * @returns {Function} Returns the new spec function.
15355       * @example
15356       *
15357       * var objects = [
15358       *   { 'a': 2, 'b': 1 },
15359       *   { 'a': 1, 'b': 2 }
15360       * ];
15361       *
15362       * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
15363       * // => [{ 'a': 1, 'b': 2 }]
15364       */
15365      function conforms(source) {
15366        return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
15367      }
15368  
15369      /**
15370       * Creates a function that returns `value`.
15371       *
15372       * @static
15373       * @memberOf _
15374       * @since 2.4.0
15375       * @category Util
15376       * @param {*} value The value to return from the new function.
15377       * @returns {Function} Returns the new constant function.
15378       * @example
15379       *
15380       * var objects = _.times(2, _.constant({ 'a': 1 }));
15381       *
15382       * console.log(objects);
15383       * // => [{ 'a': 1 }, { 'a': 1 }]
15384       *
15385       * console.log(objects[0] === objects[1]);
15386       * // => true
15387       */
15388      function constant(value) {
15389        return function() {
15390          return value;
15391        };
15392      }
15393  
15394      /**
15395       * Checks `value` to determine whether a default value should be returned in
15396       * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
15397       * or `undefined`.
15398       *
15399       * @static
15400       * @memberOf _
15401       * @since 4.14.0
15402       * @category Util
15403       * @param {*} value The value to check.
15404       * @param {*} defaultValue The default value.
15405       * @returns {*} Returns the resolved value.
15406       * @example
15407       *
15408       * _.defaultTo(1, 10);
15409       * // => 1
15410       *
15411       * _.defaultTo(undefined, 10);
15412       * // => 10
15413       */
15414      function defaultTo(value, defaultValue) {
15415        return (value == null || value !== value) ? defaultValue : value;
15416      }
15417  
15418      /**
15419       * Creates a function that returns the result of invoking the given functions
15420       * with the `this` binding of the created function, where each successive
15421       * invocation is supplied the return value of the previous.
15422       *
15423       * @static
15424       * @memberOf _
15425       * @since 3.0.0
15426       * @category Util
15427       * @param {...(Function|Function[])} [funcs] The functions to invoke.
15428       * @returns {Function} Returns the new composite function.
15429       * @see _.flowRight
15430       * @example
15431       *
15432       * function square(n) {
15433       *   return n * n;
15434       * }
15435       *
15436       * var addSquare = _.flow([_.add, square]);
15437       * addSquare(1, 2);
15438       * // => 9
15439       */
15440      var flow = createFlow();
15441  
15442      /**
15443       * This method is like `_.flow` except that it creates a function that
15444       * invokes the given functions from right to left.
15445       *
15446       * @static
15447       * @since 3.0.0
15448       * @memberOf _
15449       * @category Util
15450       * @param {...(Function|Function[])} [funcs] The functions to invoke.
15451       * @returns {Function} Returns the new composite function.
15452       * @see _.flow
15453       * @example
15454       *
15455       * function square(n) {
15456       *   return n * n;
15457       * }
15458       *
15459       * var addSquare = _.flowRight([square, _.add]);
15460       * addSquare(1, 2);
15461       * // => 9
15462       */
15463      var flowRight = createFlow(true);
15464  
15465      /**
15466       * This method returns the first argument it receives.
15467       *
15468       * @static
15469       * @since 0.1.0
15470       * @memberOf _
15471       * @category Util
15472       * @param {*} value Any value.
15473       * @returns {*} Returns `value`.
15474       * @example
15475       *
15476       * var object = { 'a': 1 };
15477       *
15478       * console.log(_.identity(object) === object);
15479       * // => true
15480       */
15481      function identity(value) {
15482        return value;
15483      }
15484  
15485      /**
15486       * Creates a function that invokes `func` with the arguments of the created
15487       * function. If `func` is a property name, the created function returns the
15488       * property value for a given element. If `func` is an array or object, the
15489       * created function returns `true` for elements that contain the equivalent
15490       * source properties, otherwise it returns `false`.
15491       *
15492       * @static
15493       * @since 4.0.0
15494       * @memberOf _
15495       * @category Util
15496       * @param {*} [func=_.identity] The value to convert to a callback.
15497       * @returns {Function} Returns the callback.
15498       * @example
15499       *
15500       * var users = [
15501       *   { 'user': 'barney', 'age': 36, 'active': true },
15502       *   { 'user': 'fred',   'age': 40, 'active': false }
15503       * ];
15504       *
15505       * // The `_.matches` iteratee shorthand.
15506       * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
15507       * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
15508       *
15509       * // The `_.matchesProperty` iteratee shorthand.
15510       * _.filter(users, _.iteratee(['user', 'fred']));
15511       * // => [{ 'user': 'fred', 'age': 40 }]
15512       *
15513       * // The `_.property` iteratee shorthand.
15514       * _.map(users, _.iteratee('user'));
15515       * // => ['barney', 'fred']
15516       *
15517       * // Create custom iteratee shorthands.
15518       * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
15519       *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
15520       *     return func.test(string);
15521       *   };
15522       * });
15523       *
15524       * _.filter(['abc', 'def'], /ef/);
15525       * // => ['def']
15526       */
15527      function iteratee(func) {
15528        return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
15529      }
15530  
15531      /**
15532       * Creates a function that performs a partial deep comparison between a given
15533       * object and `source`, returning `true` if the given object has equivalent
15534       * property values, else `false`.
15535       *
15536       * **Note:** The created function is equivalent to `_.isMatch` with `source`
15537       * partially applied.
15538       *
15539       * Partial comparisons will match empty array and empty object `source`
15540       * values against any array or object value, respectively. See `_.isEqual`
15541       * for a list of supported value comparisons.
15542       *
15543       * @static
15544       * @memberOf _
15545       * @since 3.0.0
15546       * @category Util
15547       * @param {Object} source The object of property values to match.
15548       * @returns {Function} Returns the new spec function.
15549       * @example
15550       *
15551       * var objects = [
15552       *   { 'a': 1, 'b': 2, 'c': 3 },
15553       *   { 'a': 4, 'b': 5, 'c': 6 }
15554       * ];
15555       *
15556       * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
15557       * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
15558       */
15559      function matches(source) {
15560        return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
15561      }
15562  
15563      /**
15564       * Creates a function that performs a partial deep comparison between the
15565       * value at `path` of a given object to `srcValue`, returning `true` if the
15566       * object value is equivalent, else `false`.
15567       *
15568       * **Note:** Partial comparisons will match empty array and empty object
15569       * `srcValue` values against any array or object value, respectively. See
15570       * `_.isEqual` for a list of supported value comparisons.
15571       *
15572       * @static
15573       * @memberOf _
15574       * @since 3.2.0
15575       * @category Util
15576       * @param {Array|string} path The path of the property to get.
15577       * @param {*} srcValue The value to match.
15578       * @returns {Function} Returns the new spec function.
15579       * @example
15580       *
15581       * var objects = [
15582       *   { 'a': 1, 'b': 2, 'c': 3 },
15583       *   { 'a': 4, 'b': 5, 'c': 6 }
15584       * ];
15585       *
15586       * _.find(objects, _.matchesProperty('a', 4));
15587       * // => { 'a': 4, 'b': 5, 'c': 6 }
15588       */
15589      function matchesProperty(path, srcValue) {
15590        return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
15591      }
15592  
15593      /**
15594       * Creates a function that invokes the method at `path` of a given object.
15595       * Any additional arguments are provided to the invoked method.
15596       *
15597       * @static
15598       * @memberOf _
15599       * @since 3.7.0
15600       * @category Util
15601       * @param {Array|string} path The path of the method to invoke.
15602       * @param {...*} [args] The arguments to invoke the method with.
15603       * @returns {Function} Returns the new invoker function.
15604       * @example
15605       *
15606       * var objects = [
15607       *   { 'a': { 'b': _.constant(2) } },
15608       *   { 'a': { 'b': _.constant(1) } }
15609       * ];
15610       *
15611       * _.map(objects, _.method('a.b'));
15612       * // => [2, 1]
15613       *
15614       * _.map(objects, _.method(['a', 'b']));
15615       * // => [2, 1]
15616       */
15617      var method = baseRest(function(path, args) {
15618        return function(object) {
15619          return baseInvoke(object, path, args);
15620        };
15621      });
15622  
15623      /**
15624       * The opposite of `_.method`; this method creates a function that invokes
15625       * the method at a given path of `object`. Any additional arguments are
15626       * provided to the invoked method.
15627       *
15628       * @static
15629       * @memberOf _
15630       * @since 3.7.0
15631       * @category Util
15632       * @param {Object} object The object to query.
15633       * @param {...*} [args] The arguments to invoke the method with.
15634       * @returns {Function} Returns the new invoker function.
15635       * @example
15636       *
15637       * var array = _.times(3, _.constant),
15638       *     object = { 'a': array, 'b': array, 'c': array };
15639       *
15640       * _.map(['a[2]', 'c[0]'], _.methodOf(object));
15641       * // => [2, 0]
15642       *
15643       * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
15644       * // => [2, 0]
15645       */
15646      var methodOf = baseRest(function(object, args) {
15647        return function(path) {
15648          return baseInvoke(object, path, args);
15649        };
15650      });
15651  
15652      /**
15653       * Adds all own enumerable string keyed function properties of a source
15654       * object to the destination object. If `object` is a function, then methods
15655       * are added to its prototype as well.
15656       *
15657       * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
15658       * avoid conflicts caused by modifying the original.
15659       *
15660       * @static
15661       * @since 0.1.0
15662       * @memberOf _
15663       * @category Util
15664       * @param {Function|Object} [object=lodash] The destination object.
15665       * @param {Object} source The object of functions to add.
15666       * @param {Object} [options={}] The options object.
15667       * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
15668       * @returns {Function|Object} Returns `object`.
15669       * @example
15670       *
15671       * function vowels(string) {
15672       *   return _.filter(string, function(v) {
15673       *     return /[aeiou]/i.test(v);
15674       *   });
15675       * }
15676       *
15677       * _.mixin({ 'vowels': vowels });
15678       * _.vowels('fred');
15679       * // => ['e']
15680       *
15681       * _('fred').vowels().value();
15682       * // => ['e']
15683       *
15684       * _.mixin({ 'vowels': vowels }, { 'chain': false });
15685       * _('fred').vowels();
15686       * // => ['e']
15687       */
15688      function mixin(object, source, options) {
15689        var props = keys(source),
15690            methodNames = baseFunctions(source, props);
15691  
15692        if (options == null &&
15693            !(isObject(source) && (methodNames.length || !props.length))) {
15694          options = source;
15695          source = object;
15696          object = this;
15697          methodNames = baseFunctions(source, keys(source));
15698        }
15699        var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
15700            isFunc = isFunction(object);
15701  
15702        arrayEach(methodNames, function(methodName) {
15703          var func = source[methodName];
15704          object[methodName] = func;
15705          if (isFunc) {
15706            object.prototype[methodName] = function() {
15707              var chainAll = this.__chain__;
15708              if (chain || chainAll) {
15709                var result = object(this.__wrapped__),
15710                    actions = result.__actions__ = copyArray(this.__actions__);
15711  
15712                actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
15713                result.__chain__ = chainAll;
15714                return result;
15715              }
15716              return func.apply(object, arrayPush([this.value()], arguments));
15717            };
15718          }
15719        });
15720  
15721        return object;
15722      }
15723  
15724      /**
15725       * Reverts the `_` variable to its previous value and returns a reference to
15726       * the `lodash` function.
15727       *
15728       * @static
15729       * @since 0.1.0
15730       * @memberOf _
15731       * @category Util
15732       * @returns {Function} Returns the `lodash` function.
15733       * @example
15734       *
15735       * var lodash = _.noConflict();
15736       */
15737      function noConflict() {
15738        if (root._ === this) {
15739          root._ = oldDash;
15740        }
15741        return this;
15742      }
15743  
15744      /**
15745       * This method returns `undefined`.
15746       *
15747       * @static
15748       * @memberOf _
15749       * @since 2.3.0
15750       * @category Util
15751       * @example
15752       *
15753       * _.times(2, _.noop);
15754       * // => [undefined, undefined]
15755       */
15756      function noop() {
15757        // No operation performed.
15758      }
15759  
15760      /**
15761       * Creates a function that gets the argument at index `n`. If `n` is negative,
15762       * the nth argument from the end is returned.
15763       *
15764       * @static
15765       * @memberOf _
15766       * @since 4.0.0
15767       * @category Util
15768       * @param {number} [n=0] The index of the argument to return.
15769       * @returns {Function} Returns the new pass-thru function.
15770       * @example
15771       *
15772       * var func = _.nthArg(1);
15773       * func('a', 'b', 'c', 'd');
15774       * // => 'b'
15775       *
15776       * var func = _.nthArg(-2);
15777       * func('a', 'b', 'c', 'd');
15778       * // => 'c'
15779       */
15780      function nthArg(n) {
15781        n = toInteger(n);
15782        return baseRest(function(args) {
15783          return baseNth(args, n);
15784        });
15785      }
15786  
15787      /**
15788       * Creates a function that invokes `iteratees` with the arguments it receives
15789       * and returns their results.
15790       *
15791       * @static
15792       * @memberOf _
15793       * @since 4.0.0
15794       * @category Util
15795       * @param {...(Function|Function[])} [iteratees=[_.identity]]
15796       *  The iteratees to invoke.
15797       * @returns {Function} Returns the new function.
15798       * @example
15799       *
15800       * var func = _.over([Math.max, Math.min]);
15801       *
15802       * func(1, 2, 3, 4);
15803       * // => [4, 1]
15804       */
15805      var over = createOver(arrayMap);
15806  
15807      /**
15808       * Creates a function that checks if **all** of the `predicates` return
15809       * truthy when invoked with the arguments it receives.
15810       *
15811       * @static
15812       * @memberOf _
15813       * @since 4.0.0
15814       * @category Util
15815       * @param {...(Function|Function[])} [predicates=[_.identity]]
15816       *  The predicates to check.
15817       * @returns {Function} Returns the new function.
15818       * @example
15819       *
15820       * var func = _.overEvery([Boolean, isFinite]);
15821       *
15822       * func('1');
15823       * // => true
15824       *
15825       * func(null);
15826       * // => false
15827       *
15828       * func(NaN);
15829       * // => false
15830       */
15831      var overEvery = createOver(arrayEvery);
15832  
15833      /**
15834       * Creates a function that checks if **any** of the `predicates` return
15835       * truthy when invoked with the arguments it receives.
15836       *
15837       * @static
15838       * @memberOf _
15839       * @since 4.0.0
15840       * @category Util
15841       * @param {...(Function|Function[])} [predicates=[_.identity]]
15842       *  The predicates to check.
15843       * @returns {Function} Returns the new function.
15844       * @example
15845       *
15846       * var func = _.overSome([Boolean, isFinite]);
15847       *
15848       * func('1');
15849       * // => true
15850       *
15851       * func(null);
15852       * // => true
15853       *
15854       * func(NaN);
15855       * // => false
15856       */
15857      var overSome = createOver(arraySome);
15858  
15859      /**
15860       * Creates a function that returns the value at `path` of a given object.
15861       *
15862       * @static
15863       * @memberOf _
15864       * @since 2.4.0
15865       * @category Util
15866       * @param {Array|string} path The path of the property to get.
15867       * @returns {Function} Returns the new accessor function.
15868       * @example
15869       *
15870       * var objects = [
15871       *   { 'a': { 'b': 2 } },
15872       *   { 'a': { 'b': 1 } }
15873       * ];
15874       *
15875       * _.map(objects, _.property('a.b'));
15876       * // => [2, 1]
15877       *
15878       * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
15879       * // => [1, 2]
15880       */
15881      function property(path) {
15882        return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
15883      }
15884  
15885      /**
15886       * The opposite of `_.property`; this method creates a function that returns
15887       * the value at a given path of `object`.
15888       *
15889       * @static
15890       * @memberOf _
15891       * @since 3.0.0
15892       * @category Util
15893       * @param {Object} object The object to query.
15894       * @returns {Function} Returns the new accessor function.
15895       * @example
15896       *
15897       * var array = [0, 1, 2],
15898       *     object = { 'a': array, 'b': array, 'c': array };
15899       *
15900       * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
15901       * // => [2, 0]
15902       *
15903       * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
15904       * // => [2, 0]
15905       */
15906      function propertyOf(object) {
15907        return function(path) {
15908          return object == null ? undefined : baseGet(object, path);
15909        };
15910      }
15911  
15912      /**
15913       * Creates an array of numbers (positive and/or negative) progressing from
15914       * `start` up to, but not including, `end`. A step of `-1` is used if a negative
15915       * `start` is specified without an `end` or `step`. If `end` is not specified,
15916       * it's set to `start` with `start` then set to `0`.
15917       *
15918       * **Note:** JavaScript follows the IEEE-754 standard for resolving
15919       * floating-point values which can produce unexpected results.
15920       *
15921       * @static
15922       * @since 0.1.0
15923       * @memberOf _
15924       * @category Util
15925       * @param {number} [start=0] The start of the range.
15926       * @param {number} end The end of the range.
15927       * @param {number} [step=1] The value to increment or decrement by.
15928       * @returns {Array} Returns the range of numbers.
15929       * @see _.inRange, _.rangeRight
15930       * @example
15931       *
15932       * _.range(4);
15933       * // => [0, 1, 2, 3]
15934       *
15935       * _.range(-4);
15936       * // => [0, -1, -2, -3]
15937       *
15938       * _.range(1, 5);
15939       * // => [1, 2, 3, 4]
15940       *
15941       * _.range(0, 20, 5);
15942       * // => [0, 5, 10, 15]
15943       *
15944       * _.range(0, -4, -1);
15945       * // => [0, -1, -2, -3]
15946       *
15947       * _.range(1, 4, 0);
15948       * // => [1, 1, 1]
15949       *
15950       * _.range(0);
15951       * // => []
15952       */
15953      var range = createRange();
15954  
15955      /**
15956       * This method is like `_.range` except that it populates values in
15957       * descending order.
15958       *
15959       * @static
15960       * @memberOf _
15961       * @since 4.0.0
15962       * @category Util
15963       * @param {number} [start=0] The start of the range.
15964       * @param {number} end The end of the range.
15965       * @param {number} [step=1] The value to increment or decrement by.
15966       * @returns {Array} Returns the range of numbers.
15967       * @see _.inRange, _.range
15968       * @example
15969       *
15970       * _.rangeRight(4);
15971       * // => [3, 2, 1, 0]
15972       *
15973       * _.rangeRight(-4);
15974       * // => [-3, -2, -1, 0]
15975       *
15976       * _.rangeRight(1, 5);
15977       * // => [4, 3, 2, 1]
15978       *
15979       * _.rangeRight(0, 20, 5);
15980       * // => [15, 10, 5, 0]
15981       *
15982       * _.rangeRight(0, -4, -1);
15983       * // => [-3, -2, -1, 0]
15984       *
15985       * _.rangeRight(1, 4, 0);
15986       * // => [1, 1, 1]
15987       *
15988       * _.rangeRight(0);
15989       * // => []
15990       */
15991      var rangeRight = createRange(true);
15992  
15993      /**
15994       * This method returns a new empty array.
15995       *
15996       * @static
15997       * @memberOf _
15998       * @since 4.13.0
15999       * @category Util
16000       * @returns {Array} Returns the new empty array.
16001       * @example
16002       *
16003       * var arrays = _.times(2, _.stubArray);
16004       *
16005       * console.log(arrays);
16006       * // => [[], []]
16007       *
16008       * console.log(arrays[0] === arrays[1]);
16009       * // => false
16010       */
16011      function stubArray() {
16012        return [];
16013      }
16014  
16015      /**
16016       * This method returns `false`.
16017       *
16018       * @static
16019       * @memberOf _
16020       * @since 4.13.0
16021       * @category Util
16022       * @returns {boolean} Returns `false`.
16023       * @example
16024       *
16025       * _.times(2, _.stubFalse);
16026       * // => [false, false]
16027       */
16028      function stubFalse() {
16029        return false;
16030      }
16031  
16032      /**
16033       * This method returns a new empty object.
16034       *
16035       * @static
16036       * @memberOf _
16037       * @since 4.13.0
16038       * @category Util
16039       * @returns {Object} Returns the new empty object.
16040       * @example
16041       *
16042       * var objects = _.times(2, _.stubObject);
16043       *
16044       * console.log(objects);
16045       * // => [{}, {}]
16046       *
16047       * console.log(objects[0] === objects[1]);
16048       * // => false
16049       */
16050      function stubObject() {
16051        return {};
16052      }
16053  
16054      /**
16055       * This method returns an empty string.
16056       *
16057       * @static
16058       * @memberOf _
16059       * @since 4.13.0
16060       * @category Util
16061       * @returns {string} Returns the empty string.
16062       * @example
16063       *
16064       * _.times(2, _.stubString);
16065       * // => ['', '']
16066       */
16067      function stubString() {
16068        return '';
16069      }
16070  
16071      /**
16072       * This method returns `true`.
16073       *
16074       * @static
16075       * @memberOf _
16076       * @since 4.13.0
16077       * @category Util
16078       * @returns {boolean} Returns `true`.
16079       * @example
16080       *
16081       * _.times(2, _.stubTrue);
16082       * // => [true, true]
16083       */
16084      function stubTrue() {
16085        return true;
16086      }
16087  
16088      /**
16089       * Invokes the iteratee `n` times, returning an array of the results of
16090       * each invocation. The iteratee is invoked with one argument; (index).
16091       *
16092       * @static
16093       * @since 0.1.0
16094       * @memberOf _
16095       * @category Util
16096       * @param {number} n The number of times to invoke `iteratee`.
16097       * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16098       * @returns {Array} Returns the array of results.
16099       * @example
16100       *
16101       * _.times(3, String);
16102       * // => ['0', '1', '2']
16103       *
16104       *  _.times(4, _.constant(0));
16105       * // => [0, 0, 0, 0]
16106       */
16107      function times(n, iteratee) {
16108        n = toInteger(n);
16109        if (n < 1 || n > MAX_SAFE_INTEGER) {
16110          return [];
16111        }
16112        var index = MAX_ARRAY_LENGTH,
16113            length = nativeMin(n, MAX_ARRAY_LENGTH);
16114  
16115        iteratee = getIteratee(iteratee);
16116        n -= MAX_ARRAY_LENGTH;
16117  
16118        var result = baseTimes(length, iteratee);
16119        while (++index < n) {
16120          iteratee(index);
16121        }
16122        return result;
16123      }
16124  
16125      /**
16126       * Converts `value` to a property path array.
16127       *
16128       * @static
16129       * @memberOf _
16130       * @since 4.0.0
16131       * @category Util
16132       * @param {*} value The value to convert.
16133       * @returns {Array} Returns the new property path array.
16134       * @example
16135       *
16136       * _.toPath('a.b.c');
16137       * // => ['a', 'b', 'c']
16138       *
16139       * _.toPath('a[0].b.c');
16140       * // => ['a', '0', 'b', 'c']
16141       */
16142      function toPath(value) {
16143        if (isArray(value)) {
16144          return arrayMap(value, toKey);
16145        }
16146        return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
16147      }
16148  
16149      /**
16150       * Generates a unique ID. If `prefix` is given, the ID is appended to it.
16151       *
16152       * @static
16153       * @since 0.1.0
16154       * @memberOf _
16155       * @category Util
16156       * @param {string} [prefix=''] The value to prefix the ID with.
16157       * @returns {string} Returns the unique ID.
16158       * @example
16159       *
16160       * _.uniqueId('contact_');
16161       * // => 'contact_104'
16162       *
16163       * _.uniqueId();
16164       * // => '105'
16165       */
16166      function uniqueId(prefix) {
16167        var id = ++idCounter;
16168        return toString(prefix) + id;
16169      }
16170  
16171      /*------------------------------------------------------------------------*/
16172  
16173      /**
16174       * Adds two numbers.
16175       *
16176       * @static
16177       * @memberOf _
16178       * @since 3.4.0
16179       * @category Math
16180       * @param {number} augend The first number in an addition.
16181       * @param {number} addend The second number in an addition.
16182       * @returns {number} Returns the total.
16183       * @example
16184       *
16185       * _.add(6, 4);
16186       * // => 10
16187       */
16188      var add = createMathOperation(function(augend, addend) {
16189        return augend + addend;
16190      }, 0);
16191  
16192      /**
16193       * Computes `number` rounded up to `precision`.
16194       *
16195       * @static
16196       * @memberOf _
16197       * @since 3.10.0
16198       * @category Math
16199       * @param {number} number The number to round up.
16200       * @param {number} [precision=0] The precision to round up to.
16201       * @returns {number} Returns the rounded up number.
16202       * @example
16203       *
16204       * _.ceil(4.006);
16205       * // => 5
16206       *
16207       * _.ceil(6.004, 2);
16208       * // => 6.01
16209       *
16210       * _.ceil(6040, -2);
16211       * // => 6100
16212       */
16213      var ceil = createRound('ceil');
16214  
16215      /**
16216       * Divide two numbers.
16217       *
16218       * @static
16219       * @memberOf _
16220       * @since 4.7.0
16221       * @category Math
16222       * @param {number} dividend The first number in a division.
16223       * @param {number} divisor The second number in a division.
16224       * @returns {number} Returns the quotient.
16225       * @example
16226       *
16227       * _.divide(6, 4);
16228       * // => 1.5
16229       */
16230      var divide = createMathOperation(function(dividend, divisor) {
16231        return dividend / divisor;
16232      }, 1);
16233  
16234      /**
16235       * Computes `number` rounded down to `precision`.
16236       *
16237       * @static
16238       * @memberOf _
16239       * @since 3.10.0
16240       * @category Math
16241       * @param {number} number The number to round down.
16242       * @param {number} [precision=0] The precision to round down to.
16243       * @returns {number} Returns the rounded down number.
16244       * @example
16245       *
16246       * _.floor(4.006);
16247       * // => 4
16248       *
16249       * _.floor(0.046, 2);
16250       * // => 0.04
16251       *
16252       * _.floor(4060, -2);
16253       * // => 4000
16254       */
16255      var floor = createRound('floor');
16256  
16257      /**
16258       * Computes the maximum value of `array`. If `array` is empty or falsey,
16259       * `undefined` is returned.
16260       *
16261       * @static
16262       * @since 0.1.0
16263       * @memberOf _
16264       * @category Math
16265       * @param {Array} array The array to iterate over.
16266       * @returns {*} Returns the maximum value.
16267       * @example
16268       *
16269       * _.max([4, 2, 8, 6]);
16270       * // => 8
16271       *
16272       * _.max([]);
16273       * // => undefined
16274       */
16275      function max(array) {
16276        return (array && array.length)
16277          ? baseExtremum(array, identity, baseGt)
16278          : undefined;
16279      }
16280  
16281      /**
16282       * This method is like `_.max` except that it accepts `iteratee` which is
16283       * invoked for each element in `array` to generate the criterion by which
16284       * the value is ranked. The iteratee is invoked with one argument: (value).
16285       *
16286       * @static
16287       * @memberOf _
16288       * @since 4.0.0
16289       * @category Math
16290       * @param {Array} array The array to iterate over.
16291       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16292       * @returns {*} Returns the maximum value.
16293       * @example
16294       *
16295       * var objects = [{ 'n': 1 }, { 'n': 2 }];
16296       *
16297       * _.maxBy(objects, function(o) { return o.n; });
16298       * // => { 'n': 2 }
16299       *
16300       * // The `_.property` iteratee shorthand.
16301       * _.maxBy(objects, 'n');
16302       * // => { 'n': 2 }
16303       */
16304      function maxBy(array, iteratee) {
16305        return (array && array.length)
16306          ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
16307          : undefined;
16308      }
16309  
16310      /**
16311       * Computes the mean of the values in `array`.
16312       *
16313       * @static
16314       * @memberOf _
16315       * @since 4.0.0
16316       * @category Math
16317       * @param {Array} array The array to iterate over.
16318       * @returns {number} Returns the mean.
16319       * @example
16320       *
16321       * _.mean([4, 2, 8, 6]);
16322       * // => 5
16323       */
16324      function mean(array) {
16325        return baseMean(array, identity);
16326      }
16327  
16328      /**
16329       * This method is like `_.mean` except that it accepts `iteratee` which is
16330       * invoked for each element in `array` to generate the value to be averaged.
16331       * The iteratee is invoked with one argument: (value).
16332       *
16333       * @static
16334       * @memberOf _
16335       * @since 4.7.0
16336       * @category Math
16337       * @param {Array} array The array to iterate over.
16338       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16339       * @returns {number} Returns the mean.
16340       * @example
16341       *
16342       * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16343       *
16344       * _.meanBy(objects, function(o) { return o.n; });
16345       * // => 5
16346       *
16347       * // The `_.property` iteratee shorthand.
16348       * _.meanBy(objects, 'n');
16349       * // => 5
16350       */
16351      function meanBy(array, iteratee) {
16352        return baseMean(array, getIteratee(iteratee, 2));
16353      }
16354  
16355      /**
16356       * Computes the minimum value of `array`. If `array` is empty or falsey,
16357       * `undefined` is returned.
16358       *
16359       * @static
16360       * @since 0.1.0
16361       * @memberOf _
16362       * @category Math
16363       * @param {Array} array The array to iterate over.
16364       * @returns {*} Returns the minimum value.
16365       * @example
16366       *
16367       * _.min([4, 2, 8, 6]);
16368       * // => 2
16369       *
16370       * _.min([]);
16371       * // => undefined
16372       */
16373      function min(array) {
16374        return (array && array.length)
16375          ? baseExtremum(array, identity, baseLt)
16376          : undefined;
16377      }
16378  
16379      /**
16380       * This method is like `_.min` except that it accepts `iteratee` which is
16381       * invoked for each element in `array` to generate the criterion by which
16382       * the value is ranked. The iteratee is invoked with one argument: (value).
16383       *
16384       * @static
16385       * @memberOf _
16386       * @since 4.0.0
16387       * @category Math
16388       * @param {Array} array The array to iterate over.
16389       * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16390       * @returns {*} Returns the minimum value.
16391       * @example
16392       *
16393       * var objects = [{ 'n': 1 }, { 'n': 2 }];
16394       *
16395       * _.minBy(objects, function(o) { return o.n; });
16396       * // => { 'n': 1 }
16397       *
16398       * // The `_.property` iteratee shorthand.
16399       * _.minBy(objects, 'n');
16400       * // => { 'n': 1 }
16401       */
16402      function minBy(array, iteratee) {
16403        return (array && array.length)
16404          ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
16405          : undefined;
16406      }
16407  
16408      /**
16409       * Multiply two numbers.
16410       *
16411       * @static
16412       * @memberOf _
16413       * @since 4.7.0
16414       * @category Math
16415       * @param {number} multiplier The first number in a multiplication.
16416       * @param {number} multiplicand The second number in a multiplication.
16417       * @returns {number} Returns the product.
16418       * @example
16419       *
16420       * _.multiply(6, 4);
16421       * // => 24
16422       */
16423      var multiply = createMathOperation(function(multiplier, multiplicand) {
16424        return multiplier * multiplicand;
16425      }, 1);
16426  
16427      /**
16428       * Computes `number` rounded to `precision`.
16429       *
16430       * @static
16431       * @memberOf _
16432       * @since 3.10.0
16433       * @category Math
16434       * @param {number} number The number to round.
16435       * @param {number} [precision=0] The precision to round to.
16436       * @returns {number} Returns the rounded number.
16437       * @example
16438       *
16439       * _.round(4.006);
16440       * // => 4
16441       *
16442       * _.round(4.006, 2);
16443       * // => 4.01
16444       *
16445       * _.round(4060, -2);
16446       * // => 4100
16447       */
16448      var round = createRound('round');
16449  
16450      /**
16451       * Subtract two numbers.
16452       *
16453       * @static
16454       * @memberOf _
16455       * @since 4.0.0
16456       * @category Math
16457       * @param {number} minuend The first number in a subtraction.
16458       * @param {number} subtrahend The second number in a subtraction.
16459       * @returns {number} Returns the difference.
16460       * @example
16461       *
16462       * _.subtract(6, 4);
16463       * // => 2
16464       */
16465      var subtract = createMathOperation(function(minuend, subtrahend) {
16466        return minuend - subtrahend;
16467      }, 0);
16468  
16469      /**
16470       * Computes the sum of the values in `array`.
16471       *
16472       * @static
16473       * @memberOf _
16474       * @since 3.4.0
16475       * @category Math
16476       * @param {Array} array The array to iterate over.
16477       * @returns {number} Returns the sum.
16478       * @example
16479       *
16480       * _.sum([4, 2, 8, 6]);
16481       * // => 20
16482       */
16483      function sum(array) {
16484        return (array && array.length)
16485          ? baseSum(array, identity)
16486          : 0;
16487      }
16488  
16489      /**
16490       * This method is like `_.sum` except that it accepts `iteratee` which is
16491       * invoked for each element in `array` to generate the value to be summed.
16492       * 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 {number} Returns the sum.
16501       * @example
16502       *
16503       * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16504       *
16505       * _.sumBy(objects, function(o) { return o.n; });
16506       * // => 20
16507       *
16508       * // The `_.property` iteratee shorthand.
16509       * _.sumBy(objects, 'n');
16510       * // => 20
16511       */
16512      function sumBy(array, iteratee) {
16513        return (array && array.length)
16514          ? baseSum(array, getIteratee(iteratee, 2))
16515          : 0;
16516      }
16517  
16518      /*------------------------------------------------------------------------*/
16519  
16520      // Add methods that return wrapped values in chain sequences.
16521      lodash.after = after;
16522      lodash.ary = ary;
16523      lodash.assign = assign;
16524      lodash.assignIn = assignIn;
16525      lodash.assignInWith = assignInWith;
16526      lodash.assignWith = assignWith;
16527      lodash.at = at;
16528      lodash.before = before;
16529      lodash.bind = bind;
16530      lodash.bindAll = bindAll;
16531      lodash.bindKey = bindKey;
16532      lodash.castArray = castArray;
16533      lodash.chain = chain;
16534      lodash.chunk = chunk;
16535      lodash.compact = compact;
16536      lodash.concat = concat;
16537      lodash.cond = cond;
16538      lodash.conforms = conforms;
16539      lodash.constant = constant;
16540      lodash.countBy = countBy;
16541      lodash.create = create;
16542      lodash.curry = curry;
16543      lodash.curryRight = curryRight;
16544      lodash.debounce = debounce;
16545      lodash.defaults = defaults;
16546      lodash.defaultsDeep = defaultsDeep;
16547      lodash.defer = defer;
16548      lodash.delay = delay;
16549      lodash.difference = difference;
16550      lodash.differenceBy = differenceBy;
16551      lodash.differenceWith = differenceWith;
16552      lodash.drop = drop;
16553      lodash.dropRight = dropRight;
16554      lodash.dropRightWhile = dropRightWhile;
16555      lodash.dropWhile = dropWhile;
16556      lodash.fill = fill;
16557      lodash.filter = filter;
16558      lodash.flatMap = flatMap;
16559      lodash.flatMapDeep = flatMapDeep;
16560      lodash.flatMapDepth = flatMapDepth;
16561      lodash.flatten = flatten;
16562      lodash.flattenDeep = flattenDeep;
16563      lodash.flattenDepth = flattenDepth;
16564      lodash.flip = flip;
16565      lodash.flow = flow;
16566      lodash.flowRight = flowRight;
16567      lodash.fromPairs = fromPairs;
16568      lodash.functions = functions;
16569      lodash.functionsIn = functionsIn;
16570      lodash.groupBy = groupBy;
16571      lodash.initial = initial;
16572      lodash.intersection = intersection;
16573      lodash.intersectionBy = intersectionBy;
16574      lodash.intersectionWith = intersectionWith;
16575      lodash.invert = invert;
16576      lodash.invertBy = invertBy;
16577      lodash.invokeMap = invokeMap;
16578      lodash.iteratee = iteratee;
16579      lodash.keyBy = keyBy;
16580      lodash.keys = keys;
16581      lodash.keysIn = keysIn;
16582      lodash.map = map;
16583      lodash.mapKeys = mapKeys;
16584      lodash.mapValues = mapValues;
16585      lodash.matches = matches;
16586      lodash.matchesProperty = matchesProperty;
16587      lodash.memoize = memoize;
16588      lodash.merge = merge;
16589      lodash.mergeWith = mergeWith;
16590      lodash.method = method;
16591      lodash.methodOf = methodOf;
16592      lodash.mixin = mixin;
16593      lodash.negate = negate;
16594      lodash.nthArg = nthArg;
16595      lodash.omit = omit;
16596      lodash.omitBy = omitBy;
16597      lodash.once = once;
16598      lodash.orderBy = orderBy;
16599      lodash.over = over;
16600      lodash.overArgs = overArgs;
16601      lodash.overEvery = overEvery;
16602      lodash.overSome = overSome;
16603      lodash.partial = partial;
16604      lodash.partialRight = partialRight;
16605      lodash.partition = partition;
16606      lodash.pick = pick;
16607      lodash.pickBy = pickBy;
16608      lodash.property = property;
16609      lodash.propertyOf = propertyOf;
16610      lodash.pull = pull;
16611      lodash.pullAll = pullAll;
16612      lodash.pullAllBy = pullAllBy;
16613      lodash.pullAllWith = pullAllWith;
16614      lodash.pullAt = pullAt;
16615      lodash.range = range;
16616      lodash.rangeRight = rangeRight;
16617      lodash.rearg = rearg;
16618      lodash.reject = reject;
16619      lodash.remove = remove;
16620      lodash.rest = rest;
16621      lodash.reverse = reverse;
16622      lodash.sampleSize = sampleSize;
16623      lodash.set = set;
16624      lodash.setWith = setWith;
16625      lodash.shuffle = shuffle;
16626      lodash.slice = slice;
16627      lodash.sortBy = sortBy;
16628      lodash.sortedUniq = sortedUniq;
16629      lodash.sortedUniqBy = sortedUniqBy;
16630      lodash.split = split;
16631      lodash.spread = spread;
16632      lodash.tail = tail;
16633      lodash.take = take;
16634      lodash.takeRight = takeRight;
16635      lodash.takeRightWhile = takeRightWhile;
16636      lodash.takeWhile = takeWhile;
16637      lodash.tap = tap;
16638      lodash.throttle = throttle;
16639      lodash.thru = thru;
16640      lodash.toArray = toArray;
16641      lodash.toPairs = toPairs;
16642      lodash.toPairsIn = toPairsIn;
16643      lodash.toPath = toPath;
16644      lodash.toPlainObject = toPlainObject;
16645      lodash.transform = transform;
16646      lodash.unary = unary;
16647      lodash.union = union;
16648      lodash.unionBy = unionBy;
16649      lodash.unionWith = unionWith;
16650      lodash.uniq = uniq;
16651      lodash.uniqBy = uniqBy;
16652      lodash.uniqWith = uniqWith;
16653      lodash.unset = unset;
16654      lodash.unzip = unzip;
16655      lodash.unzipWith = unzipWith;
16656      lodash.update = update;
16657      lodash.updateWith = updateWith;
16658      lodash.values = values;
16659      lodash.valuesIn = valuesIn;
16660      lodash.without = without;
16661      lodash.words = words;
16662      lodash.wrap = wrap;
16663      lodash.xor = xor;
16664      lodash.xorBy = xorBy;
16665      lodash.xorWith = xorWith;
16666      lodash.zip = zip;
16667      lodash.zipObject = zipObject;
16668      lodash.zipObjectDeep = zipObjectDeep;
16669      lodash.zipWith = zipWith;
16670  
16671      // Add aliases.
16672      lodash.entries = toPairs;
16673      lodash.entriesIn = toPairsIn;
16674      lodash.extend = assignIn;
16675      lodash.extendWith = assignInWith;
16676  
16677      // Add methods to `lodash.prototype`.
16678      mixin(lodash, lodash);
16679  
16680      /*------------------------------------------------------------------------*/
16681  
16682      // Add methods that return unwrapped values in chain sequences.
16683      lodash.add = add;
16684      lodash.attempt = attempt;
16685      lodash.camelCase = camelCase;
16686      lodash.capitalize = capitalize;
16687      lodash.ceil = ceil;
16688      lodash.clamp = clamp;
16689      lodash.clone = clone;
16690      lodash.cloneDeep = cloneDeep;
16691      lodash.cloneDeepWith = cloneDeepWith;
16692      lodash.cloneWith = cloneWith;
16693      lodash.conformsTo = conformsTo;
16694      lodash.deburr = deburr;
16695      lodash.defaultTo = defaultTo;
16696      lodash.divide = divide;
16697      lodash.endsWith = endsWith;
16698      lodash.eq = eq;
16699      lodash.escape = escape;
16700      lodash.escapeRegExp = escapeRegExp;
16701      lodash.every = every;
16702      lodash.find = find;
16703      lodash.findIndex = findIndex;
16704      lodash.findKey = findKey;
16705      lodash.findLast = findLast;
16706      lodash.findLastIndex = findLastIndex;
16707      lodash.findLastKey = findLastKey;
16708      lodash.floor = floor;
16709      lodash.forEach = forEach;
16710      lodash.forEachRight = forEachRight;
16711      lodash.forIn = forIn;
16712      lodash.forInRight = forInRight;
16713      lodash.forOwn = forOwn;
16714      lodash.forOwnRight = forOwnRight;
16715      lodash.get = get;
16716      lodash.gt = gt;
16717      lodash.gte = gte;
16718      lodash.has = has;
16719      lodash.hasIn = hasIn;
16720      lodash.head = head;
16721      lodash.identity = identity;
16722      lodash.includes = includes;
16723      lodash.indexOf = indexOf;
16724      lodash.inRange = inRange;
16725      lodash.invoke = invoke;
16726      lodash.isArguments = isArguments;
16727      lodash.isArray = isArray;
16728      lodash.isArrayBuffer = isArrayBuffer;
16729      lodash.isArrayLike = isArrayLike;
16730      lodash.isArrayLikeObject = isArrayLikeObject;
16731      lodash.isBoolean = isBoolean;
16732      lodash.isBuffer = isBuffer;
16733      lodash.isDate = isDate;
16734      lodash.isElement = isElement;
16735      lodash.isEmpty = isEmpty;
16736      lodash.isEqual = isEqual;
16737      lodash.isEqualWith = isEqualWith;
16738      lodash.isError = isError;
16739      lodash.isFinite = isFinite;
16740      lodash.isFunction = isFunction;
16741      lodash.isInteger = isInteger;
16742      lodash.isLength = isLength;
16743      lodash.isMap = isMap;
16744      lodash.isMatch = isMatch;
16745      lodash.isMatchWith = isMatchWith;
16746      lodash.isNaN = isNaN;
16747      lodash.isNative = isNative;
16748      lodash.isNil = isNil;
16749      lodash.isNull = isNull;
16750      lodash.isNumber = isNumber;
16751      lodash.isObject = isObject;
16752      lodash.isObjectLike = isObjectLike;
16753      lodash.isPlainObject = isPlainObject;
16754      lodash.isRegExp = isRegExp;
16755      lodash.isSafeInteger = isSafeInteger;
16756      lodash.isSet = isSet;
16757      lodash.isString = isString;
16758      lodash.isSymbol = isSymbol;
16759      lodash.isTypedArray = isTypedArray;
16760      lodash.isUndefined = isUndefined;
16761      lodash.isWeakMap = isWeakMap;
16762      lodash.isWeakSet = isWeakSet;
16763      lodash.join = join;
16764      lodash.kebabCase = kebabCase;
16765      lodash.last = last;
16766      lodash.lastIndexOf = lastIndexOf;
16767      lodash.lowerCase = lowerCase;
16768      lodash.lowerFirst = lowerFirst;
16769      lodash.lt = lt;
16770      lodash.lte = lte;
16771      lodash.max = max;
16772      lodash.maxBy = maxBy;
16773      lodash.mean = mean;
16774      lodash.meanBy = meanBy;
16775      lodash.min = min;
16776      lodash.minBy = minBy;
16777      lodash.stubArray = stubArray;
16778      lodash.stubFalse = stubFalse;
16779      lodash.stubObject = stubObject;
16780      lodash.stubString = stubString;
16781      lodash.stubTrue = stubTrue;
16782      lodash.multiply = multiply;
16783      lodash.nth = nth;
16784      lodash.noConflict = noConflict;
16785      lodash.noop = noop;
16786      lodash.now = now;
16787      lodash.pad = pad;
16788      lodash.padEnd = padEnd;
16789      lodash.padStart = padStart;
16790      lodash.parseInt = parseInt;
16791      lodash.random = random;
16792      lodash.reduce = reduce;
16793      lodash.reduceRight = reduceRight;
16794      lodash.repeat = repeat;
16795      lodash.replace = replace;
16796      lodash.result = result;
16797      lodash.round = round;
16798      lodash.runInContext = runInContext;
16799      lodash.sample = sample;
16800      lodash.size = size;
16801      lodash.snakeCase = snakeCase;
16802      lodash.some = some;
16803      lodash.sortedIndex = sortedIndex;
16804      lodash.sortedIndexBy = sortedIndexBy;
16805      lodash.sortedIndexOf = sortedIndexOf;
16806      lodash.sortedLastIndex = sortedLastIndex;
16807      lodash.sortedLastIndexBy = sortedLastIndexBy;
16808      lodash.sortedLastIndexOf = sortedLastIndexOf;
16809      lodash.startCase = startCase;
16810      lodash.startsWith = startsWith;
16811      lodash.subtract = subtract;
16812      lodash.sum = sum;
16813      lodash.sumBy = sumBy;
16814      lodash.template = template;
16815      lodash.times = times;
16816      lodash.toFinite = toFinite;
16817      lodash.toInteger = toInteger;
16818      lodash.toLength = toLength;
16819      lodash.toLower = toLower;
16820      lodash.toNumber = toNumber;
16821      lodash.toSafeInteger = toSafeInteger;
16822      lodash.toString = toString;
16823      lodash.toUpper = toUpper;
16824      lodash.trim = trim;
16825      lodash.trimEnd = trimEnd;
16826      lodash.trimStart = trimStart;
16827      lodash.truncate = truncate;
16828      lodash.unescape = unescape;
16829      lodash.uniqueId = uniqueId;
16830      lodash.upperCase = upperCase;
16831      lodash.upperFirst = upperFirst;
16832  
16833      // Add aliases.
16834      lodash.each = forEach;
16835      lodash.eachRight = forEachRight;
16836      lodash.first = head;
16837  
16838      mixin(lodash, (function() {
16839        var source = {};
16840        baseForOwn(lodash, function(func, methodName) {
16841          if (!hasOwnProperty.call(lodash.prototype, methodName)) {
16842            source[methodName] = func;
16843          }
16844        });
16845        return source;
16846      }()), { 'chain': false });
16847  
16848      /*------------------------------------------------------------------------*/
16849  
16850      /**
16851       * The semantic version number.
16852       *
16853       * @static
16854       * @memberOf _
16855       * @type {string}
16856       */
16857      lodash.VERSION = VERSION;
16858  
16859      // Assign default placeholders.
16860      arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
16861        lodash[methodName].placeholder = lodash;
16862      });
16863  
16864      // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
16865      arrayEach(['drop', 'take'], function(methodName, index) {
16866        LazyWrapper.prototype[methodName] = function(n) {
16867          n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
16868  
16869          var result = (this.__filtered__ && !index)
16870            ? new LazyWrapper(this)
16871            : this.clone();
16872  
16873          if (result.__filtered__) {
16874            result.__takeCount__ = nativeMin(n, result.__takeCount__);
16875          } else {
16876            result.__views__.push({
16877              'size': nativeMin(n, MAX_ARRAY_LENGTH),
16878              'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
16879            });
16880          }
16881          return result;
16882        };
16883  
16884        LazyWrapper.prototype[methodName + 'Right'] = function(n) {
16885          return this.reverse()[methodName](n).reverse();
16886        };
16887      });
16888  
16889      // Add `LazyWrapper` methods that accept an `iteratee` value.
16890      arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
16891        var type = index + 1,
16892            isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
16893  
16894        LazyWrapper.prototype[methodName] = function(iteratee) {
16895          var result = this.clone();
16896          result.__iteratees__.push({
16897            'iteratee': getIteratee(iteratee, 3),
16898            'type': type
16899          });
16900          result.__filtered__ = result.__filtered__ || isFilter;
16901          return result;
16902        };
16903      });
16904  
16905      // Add `LazyWrapper` methods for `_.head` and `_.last`.
16906      arrayEach(['head', 'last'], function(methodName, index) {
16907        var takeName = 'take' + (index ? 'Right' : '');
16908  
16909        LazyWrapper.prototype[methodName] = function() {
16910          return this[takeName](1).value()[0];
16911        };
16912      });
16913  
16914      // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
16915      arrayEach(['initial', 'tail'], function(methodName, index) {
16916        var dropName = 'drop' + (index ? '' : 'Right');
16917  
16918        LazyWrapper.prototype[methodName] = function() {
16919          return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
16920        };
16921      });
16922  
16923      LazyWrapper.prototype.compact = function() {
16924        return this.filter(identity);
16925      };
16926  
16927      LazyWrapper.prototype.find = function(predicate) {
16928        return this.filter(predicate).head();
16929      };
16930  
16931      LazyWrapper.prototype.findLast = function(predicate) {
16932        return this.reverse().find(predicate);
16933      };
16934  
16935      LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
16936        if (typeof path == 'function') {
16937          return new LazyWrapper(this);
16938        }
16939        return this.map(function(value) {
16940          return baseInvoke(value, path, args);
16941        });
16942      });
16943  
16944      LazyWrapper.prototype.reject = function(predicate) {
16945        return this.filter(negate(getIteratee(predicate)));
16946      };
16947  
16948      LazyWrapper.prototype.slice = function(start, end) {
16949        start = toInteger(start);
16950  
16951        var result = this;
16952        if (result.__filtered__ && (start > 0 || end < 0)) {
16953          return new LazyWrapper(result);
16954        }
16955        if (start < 0) {
16956          result = result.takeRight(-start);
16957        } else if (start) {
16958          result = result.drop(start);
16959        }
16960        if (end !== undefined) {
16961          end = toInteger(end);
16962          result = end < 0 ? result.dropRight(-end) : result.take(end - start);
16963        }
16964        return result;
16965      };
16966  
16967      LazyWrapper.prototype.takeRightWhile = function(predicate) {
16968        return this.reverse().takeWhile(predicate).reverse();
16969      };
16970  
16971      LazyWrapper.prototype.toArray = function() {
16972        return this.take(MAX_ARRAY_LENGTH);
16973      };
16974  
16975      // Add `LazyWrapper` methods to `lodash.prototype`.
16976      baseForOwn(LazyWrapper.prototype, function(func, methodName) {
16977        var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
16978            isTaker = /^(?:head|last)$/.test(methodName),
16979            lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
16980            retUnwrapped = isTaker || /^find/.test(methodName);
16981  
16982        if (!lodashFunc) {
16983          return;
16984        }
16985        lodash.prototype[methodName] = function() {
16986          var value = this.__wrapped__,
16987              args = isTaker ? [1] : arguments,
16988              isLazy = value instanceof LazyWrapper,
16989              iteratee = args[0],
16990              useLazy = isLazy || isArray(value);
16991  
16992          var interceptor = function(value) {
16993            var result = lodashFunc.apply(lodash, arrayPush([value], args));
16994            return (isTaker && chainAll) ? result[0] : result;
16995          };
16996  
16997          if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
16998            // Avoid lazy use if the iteratee has a "length" value other than `1`.
16999            isLazy = useLazy = false;
17000          }
17001          var chainAll = this.__chain__,
17002              isHybrid = !!this.__actions__.length,
17003              isUnwrapped = retUnwrapped && !chainAll,
17004              onlyLazy = isLazy && !isHybrid;
17005  
17006          if (!retUnwrapped && useLazy) {
17007            value = onlyLazy ? value : new LazyWrapper(this);
17008            var result = func.apply(value, args);
17009            result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
17010            return new LodashWrapper(result, chainAll);
17011          }
17012          if (isUnwrapped && onlyLazy) {
17013            return func.apply(this, args);
17014          }
17015          result = this.thru(interceptor);
17016          return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
17017        };
17018      });
17019  
17020      // Add `Array` methods to `lodash.prototype`.
17021      arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
17022        var func = arrayProto[methodName],
17023            chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
17024            retUnwrapped = /^(?:pop|shift)$/.test(methodName);
17025  
17026        lodash.prototype[methodName] = function() {
17027          var args = arguments;
17028          if (retUnwrapped && !this.__chain__) {
17029            var value = this.value();
17030            return func.apply(isArray(value) ? value : [], args);
17031          }
17032          return this[chainName](function(value) {
17033            return func.apply(isArray(value) ? value : [], args);
17034          });
17035        };
17036      });
17037  
17038      // Map minified method names to their real names.
17039      baseForOwn(LazyWrapper.prototype, function(func, methodName) {
17040        var lodashFunc = lodash[methodName];
17041        if (lodashFunc) {
17042          var key = (lodashFunc.name + ''),
17043              names = realNames[key] || (realNames[key] = []);
17044  
17045          names.push({ 'name': methodName, 'func': lodashFunc });
17046        }
17047      });
17048  
17049      realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
17050        'name': 'wrapper',
17051        'func': undefined
17052      }];
17053  
17054      // Add methods to `LazyWrapper`.
17055      LazyWrapper.prototype.clone = lazyClone;
17056      LazyWrapper.prototype.reverse = lazyReverse;
17057      LazyWrapper.prototype.value = lazyValue;
17058  
17059      // Add chain sequence methods to the `lodash` wrapper.
17060      lodash.prototype.at = wrapperAt;
17061      lodash.prototype.chain = wrapperChain;
17062      lodash.prototype.commit = wrapperCommit;
17063      lodash.prototype.next = wrapperNext;
17064      lodash.prototype.plant = wrapperPlant;
17065      lodash.prototype.reverse = wrapperReverse;
17066      lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
17067  
17068      // Add lazy aliases.
17069      lodash.prototype.first = lodash.prototype.head;
17070  
17071      if (symIterator) {
17072        lodash.prototype[symIterator] = wrapperToIterator;
17073      }
17074      return lodash;
17075    });
17076  
17077    /*--------------------------------------------------------------------------*/
17078  
17079    // Export lodash.
17080    var _ = runInContext();
17081  
17082    // Some AMD build optimizers, like r.js, check for condition patterns like:
17083    if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
17084      // Expose Lodash on the global object to prevent errors when Lodash is
17085      // loaded by a script tag in the presence of an AMD loader.
17086      // See http://requirejs.org/docs/errors.html#mismatch for more details.
17087      // Use `_.noConflict` to remove Lodash from the global object.
17088      root._ = _;
17089  
17090      // Define as an anonymous module so, through path mapping, it can be
17091      // referenced as the "underscore" module.
17092      define(function() {
17093        return _;
17094      });
17095    }
17096    // Check for `exports` after `define` in case a build optimizer adds it.
17097    else if (freeModule) {
17098      // Export for Node.js.
17099      (freeModule.exports = _)._ = _;
17100      // Export for CommonJS support.
17101      freeExports._ = _;
17102    }
17103    else {
17104      // Export to the global object.
17105      root._ = _;
17106    }
17107  }.call(this));


Generated: Mon Jan 7 01:00:05 2019 Cross-referenced by PHPXref 0.7.1