Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | 04-Aug-2019 | - | ||||
README.md | H A D | 02-Aug-2019 | 286.7 KiB | 11,305 | 8,196 |
README.md
1# <a href="https://lodash.com/">lodash</a> <span>v4.17.15</span> 2 3<!-- div class="toc-container" --> 4 5<!-- div --> 6 7## `Array` 8* <a href="#_chunkarray-size1">`_.chunk`</a> 9* <a href="#_compactarray">`_.compact`</a> 10* <a href="#_concatarray-values">`_.concat`</a> 11* <a href="#_differencearray-values">`_.difference`</a> 12* <a href="#_differencebyarray-values-iteratee_identity">`_.differenceBy`</a> 13* <a href="#_differencewitharray-values-comparator">`_.differenceWith`</a> 14* <a href="#_droparray-n1">`_.drop`</a> 15* <a href="#_droprightarray-n1">`_.dropRight`</a> 16* <a href="#_droprightwhilearray-predicate_identity">`_.dropRightWhile`</a> 17* <a href="#_dropwhilearray-predicate_identity">`_.dropWhile`</a> 18* <a href="#_fillarray-value-start0-endarraylength">`_.fill`</a> 19* <a href="#_findindexarray-predicate_identity-fromindex0">`_.findIndex`</a> 20* <a href="#_findlastindexarray-predicate_identity-fromindexarraylength-1">`_.findLastIndex`</a> 21* <a href="#_headarray" class="alias">`_.first` -> `head`</a> 22* <a href="#_flattenarray">`_.flatten`</a> 23* <a href="#_flattendeeparray">`_.flattenDeep`</a> 24* <a href="#_flattendeptharray-depth1">`_.flattenDepth`</a> 25* <a href="#_frompairspairs">`_.fromPairs`</a> 26* <a href="#_headarray">`_.head`</a> 27* <a href="#_indexofarray-value-fromindex0">`_.indexOf`</a> 28* <a href="#_initialarray">`_.initial`</a> 29* <a href="#_intersectionarrays">`_.intersection`</a> 30* <a href="#_intersectionbyarrays-iteratee_identity">`_.intersectionBy`</a> 31* <a href="#_intersectionwitharrays-comparator">`_.intersectionWith`</a> 32* <a href="#_joinarray-separator-">`_.join`</a> 33* <a href="#_lastarray">`_.last`</a> 34* <a href="#_lastindexofarray-value-fromindexarraylength-1">`_.lastIndexOf`</a> 35* <a href="#_ntharray-n0">`_.nth`</a> 36* <a href="#_pullarray-values">`_.pull`</a> 37* <a href="#_pullallarray-values">`_.pullAll`</a> 38* <a href="#_pullallbyarray-values-iteratee_identity">`_.pullAllBy`</a> 39* <a href="#_pullallwitharray-values-comparator">`_.pullAllWith`</a> 40* <a href="#_pullatarray-indexes">`_.pullAt`</a> 41* <a href="#_removearray-predicate_identity">`_.remove`</a> 42* <a href="#_reversearray">`_.reverse`</a> 43* <a href="#_slicearray-start0-endarraylength">`_.slice`</a> 44* <a href="#_sortedindexarray-value">`_.sortedIndex`</a> 45* <a href="#_sortedindexbyarray-value-iteratee_identity">`_.sortedIndexBy`</a> 46* <a href="#_sortedindexofarray-value">`_.sortedIndexOf`</a> 47* <a href="#_sortedlastindexarray-value">`_.sortedLastIndex`</a> 48* <a href="#_sortedlastindexbyarray-value-iteratee_identity">`_.sortedLastIndexBy`</a> 49* <a href="#_sortedlastindexofarray-value">`_.sortedLastIndexOf`</a> 50* <a href="#_sorteduniqarray">`_.sortedUniq`</a> 51* <a href="#_sorteduniqbyarray-iteratee">`_.sortedUniqBy`</a> 52* <a href="#_tailarray">`_.tail`</a> 53* <a href="#_takearray-n1">`_.take`</a> 54* <a href="#_takerightarray-n1">`_.takeRight`</a> 55* <a href="#_takerightwhilearray-predicate_identity">`_.takeRightWhile`</a> 56* <a href="#_takewhilearray-predicate_identity">`_.takeWhile`</a> 57* <a href="#_unionarrays">`_.union`</a> 58* <a href="#_unionbyarrays-iteratee_identity">`_.unionBy`</a> 59* <a href="#_unionwitharrays-comparator">`_.unionWith`</a> 60* <a href="#_uniqarray">`_.uniq`</a> 61* <a href="#_uniqbyarray-iteratee_identity">`_.uniqBy`</a> 62* <a href="#_uniqwitharray-comparator">`_.uniqWith`</a> 63* <a href="#_unziparray">`_.unzip`</a> 64* <a href="#_unzipwitharray-iteratee_identity">`_.unzipWith`</a> 65* <a href="#_withoutarray-values">`_.without`</a> 66* <a href="#_xorarrays">`_.xor`</a> 67* <a href="#_xorbyarrays-iteratee_identity">`_.xorBy`</a> 68* <a href="#_xorwitharrays-comparator">`_.xorWith`</a> 69* <a href="#_ziparrays">`_.zip`</a> 70* <a href="#_zipobjectprops-values">`_.zipObject`</a> 71* <a href="#_zipobjectdeepprops-values">`_.zipObjectDeep`</a> 72* <a href="#_zipwitharrays-iteratee_identity">`_.zipWith`</a> 73 74<!-- /div --> 75 76<!-- div --> 77 78## `Collection` 79* <a href="#_countbycollection-iteratee_identity">`_.countBy`</a> 80* <a href="#_foreachcollection-iteratee_identity" class="alias">`_.each` -> `forEach`</a> 81* <a href="#_foreachrightcollection-iteratee_identity" class="alias">`_.eachRight` -> `forEachRight`</a> 82* <a href="#_everycollection-predicate_identity">`_.every`</a> 83* <a href="#_filtercollection-predicate_identity">`_.filter`</a> 84* <a href="#_findcollection-predicate_identity-fromindex0">`_.find`</a> 85* <a href="#_findlastcollection-predicate_identity-fromindexcollectionlength-1">`_.findLast`</a> 86* <a href="#_flatmapcollection-iteratee_identity">`_.flatMap`</a> 87* <a href="#_flatmapdeepcollection-iteratee_identity">`_.flatMapDeep`</a> 88* <a href="#_flatmapdepthcollection-iteratee_identity-depth1">`_.flatMapDepth`</a> 89* <a href="#_foreachcollection-iteratee_identity">`_.forEach`</a> 90* <a href="#_foreachrightcollection-iteratee_identity">`_.forEachRight`</a> 91* <a href="#_groupbycollection-iteratee_identity">`_.groupBy`</a> 92* <a href="#_includescollection-value-fromindex0">`_.includes`</a> 93* <a href="#_invokemapcollection-path-args">`_.invokeMap`</a> 94* <a href="#_keybycollection-iteratee_identity">`_.keyBy`</a> 95* <a href="#_mapcollection-iteratee_identity">`_.map`</a> 96* <a href="#_orderbycollection-iteratees_identity-orders">`_.orderBy`</a> 97* <a href="#_partitioncollection-predicate_identity">`_.partition`</a> 98* <a href="#_reducecollection-iteratee_identity-accumulator">`_.reduce`</a> 99* <a href="#_reducerightcollection-iteratee_identity-accumulator">`_.reduceRight`</a> 100* <a href="#_rejectcollection-predicate_identity">`_.reject`</a> 101* <a href="#_samplecollection">`_.sample`</a> 102* <a href="#_samplesizecollection-n1">`_.sampleSize`</a> 103* <a href="#_shufflecollection">`_.shuffle`</a> 104* <a href="#_sizecollection">`_.size`</a> 105* <a href="#_somecollection-predicate_identity">`_.some`</a> 106* <a href="#_sortbycollection-iteratees_identity">`_.sortBy`</a> 107 108<!-- /div --> 109 110<!-- div --> 111 112## `Date` 113* <a href="#_now">`_.now`</a> 114 115<!-- /div --> 116 117<!-- div --> 118 119## `Function` 120* <a href="#_aftern-func">`_.after`</a> 121* <a href="#_aryfunc-nfunclength">`_.ary`</a> 122* <a href="#_beforen-func">`_.before`</a> 123* <a href="#_bindfunc-thisarg-partials">`_.bind`</a> 124* <a href="#_bindkeyobject-key-partials">`_.bindKey`</a> 125* <a href="#_curryfunc-arityfunclength">`_.curry`</a> 126* <a href="#_curryrightfunc-arityfunclength">`_.curryRight`</a> 127* <a href="#_debouncefunc-wait0-options">`_.debounce`</a> 128* <a href="#_deferfunc-args">`_.defer`</a> 129* <a href="#_delayfunc-wait-args">`_.delay`</a> 130* <a href="#_flipfunc">`_.flip`</a> 131* <a href="#_memoizefunc-resolver">`_.memoize`</a> 132* <a href="#_negatepredicate">`_.negate`</a> 133* <a href="#_oncefunc">`_.once`</a> 134* <a href="#_overargsfunc-transforms_identity">`_.overArgs`</a> 135* <a href="#_partialfunc-partials">`_.partial`</a> 136* <a href="#_partialrightfunc-partials">`_.partialRight`</a> 137* <a href="#_reargfunc-indexes">`_.rearg`</a> 138* <a href="#_restfunc-startfunclength-1">`_.rest`</a> 139* <a href="#_spreadfunc-start0">`_.spread`</a> 140* <a href="#_throttlefunc-wait0-options">`_.throttle`</a> 141* <a href="#_unaryfunc">`_.unary`</a> 142* <a href="#_wrapvalue-wrapperidentity">`_.wrap`</a> 143 144<!-- /div --> 145 146<!-- div --> 147 148## `Lang` 149* <a href="#_castarrayvalue">`_.castArray`</a> 150* <a href="#_clonevalue">`_.clone`</a> 151* <a href="#_clonedeepvalue">`_.cloneDeep`</a> 152* <a href="#_clonedeepwithvalue-customizer">`_.cloneDeepWith`</a> 153* <a href="#_clonewithvalue-customizer">`_.cloneWith`</a> 154* <a href="#_conformstoobject-source">`_.conformsTo`</a> 155* <a href="#_eqvalue-other">`_.eq`</a> 156* <a href="#_gtvalue-other">`_.gt`</a> 157* <a href="#_gtevalue-other">`_.gte`</a> 158* <a href="#_isargumentsvalue">`_.isArguments`</a> 159* <a href="#_isarrayvalue">`_.isArray`</a> 160* <a href="#_isarraybuffervalue">`_.isArrayBuffer`</a> 161* <a href="#_isarraylikevalue">`_.isArrayLike`</a> 162* <a href="#_isarraylikeobjectvalue">`_.isArrayLikeObject`</a> 163* <a href="#_isbooleanvalue">`_.isBoolean`</a> 164* <a href="#_isbuffervalue">`_.isBuffer`</a> 165* <a href="#_isdatevalue">`_.isDate`</a> 166* <a href="#_iselementvalue">`_.isElement`</a> 167* <a href="#_isemptyvalue">`_.isEmpty`</a> 168* <a href="#_isequalvalue-other">`_.isEqual`</a> 169* <a href="#_isequalwithvalue-other-customizer">`_.isEqualWith`</a> 170* <a href="#_iserrorvalue">`_.isError`</a> 171* <a href="#_isfinitevalue">`_.isFinite`</a> 172* <a href="#_isfunctionvalue">`_.isFunction`</a> 173* <a href="#_isintegervalue">`_.isInteger`</a> 174* <a href="#_islengthvalue">`_.isLength`</a> 175* <a href="#_ismapvalue">`_.isMap`</a> 176* <a href="#_ismatchobject-source">`_.isMatch`</a> 177* <a href="#_ismatchwithobject-source-customizer">`_.isMatchWith`</a> 178* <a href="#_isnanvalue">`_.isNaN`</a> 179* <a href="#_isnativevalue">`_.isNative`</a> 180* <a href="#_isnilvalue">`_.isNil`</a> 181* <a href="#_isnullvalue">`_.isNull`</a> 182* <a href="#_isnumbervalue">`_.isNumber`</a> 183* <a href="#_isobjectvalue">`_.isObject`</a> 184* <a href="#_isobjectlikevalue">`_.isObjectLike`</a> 185* <a href="#_isplainobjectvalue">`_.isPlainObject`</a> 186* <a href="#_isregexpvalue">`_.isRegExp`</a> 187* <a href="#_issafeintegervalue">`_.isSafeInteger`</a> 188* <a href="#_issetvalue">`_.isSet`</a> 189* <a href="#_isstringvalue">`_.isString`</a> 190* <a href="#_issymbolvalue">`_.isSymbol`</a> 191* <a href="#_istypedarrayvalue">`_.isTypedArray`</a> 192* <a href="#_isundefinedvalue">`_.isUndefined`</a> 193* <a href="#_isweakmapvalue">`_.isWeakMap`</a> 194* <a href="#_isweaksetvalue">`_.isWeakSet`</a> 195* <a href="#_ltvalue-other">`_.lt`</a> 196* <a href="#_ltevalue-other">`_.lte`</a> 197* <a href="#_toarrayvalue">`_.toArray`</a> 198* <a href="#_tofinitevalue">`_.toFinite`</a> 199* <a href="#_tointegervalue">`_.toInteger`</a> 200* <a href="#_tolengthvalue">`_.toLength`</a> 201* <a href="#_tonumbervalue">`_.toNumber`</a> 202* <a href="#_toplainobjectvalue">`_.toPlainObject`</a> 203* <a href="#_tosafeintegervalue">`_.toSafeInteger`</a> 204* <a href="#_tostringvalue">`_.toString`</a> 205 206<!-- /div --> 207 208<!-- div --> 209 210## `Math` 211* <a href="#_addaugend-addend">`_.add`</a> 212* <a href="#_ceilnumber-precision0">`_.ceil`</a> 213* <a href="#_dividedividend-divisor">`_.divide`</a> 214* <a href="#_floornumber-precision0">`_.floor`</a> 215* <a href="#_maxarray">`_.max`</a> 216* <a href="#_maxbyarray-iteratee_identity">`_.maxBy`</a> 217* <a href="#_meanarray">`_.mean`</a> 218* <a href="#_meanbyarray-iteratee_identity">`_.meanBy`</a> 219* <a href="#_minarray">`_.min`</a> 220* <a href="#_minbyarray-iteratee_identity">`_.minBy`</a> 221* <a href="#_multiplymultiplier-multiplicand">`_.multiply`</a> 222* <a href="#_roundnumber-precision0">`_.round`</a> 223* <a href="#_subtractminuend-subtrahend">`_.subtract`</a> 224* <a href="#_sumarray">`_.sum`</a> 225* <a href="#_sumbyarray-iteratee_identity">`_.sumBy`</a> 226 227<!-- /div --> 228 229<!-- div --> 230 231## `Number` 232* <a href="#_clampnumber-lower-upper">`_.clamp`</a> 233* <a href="#_inrangenumber-start0-end">`_.inRange`</a> 234* <a href="#_randomlower0-upper1-floating">`_.random`</a> 235 236<!-- /div --> 237 238<!-- div --> 239 240## `Object` 241* <a href="#_assignobject-sources">`_.assign`</a> 242* <a href="#_assigninobject-sources">`_.assignIn`</a> 243* <a href="#_assigninwithobject-sources-customizer">`_.assignInWith`</a> 244* <a href="#_assignwithobject-sources-customizer">`_.assignWith`</a> 245* <a href="#_atobject-paths">`_.at`</a> 246* <a href="#_createprototype-properties">`_.create`</a> 247* <a href="#_defaultsobject-sources">`_.defaults`</a> 248* <a href="#_defaultsdeepobject-sources">`_.defaultsDeep`</a> 249* <a href="#_topairsobject" class="alias">`_.entries` -> `toPairs`</a> 250* <a href="#_topairsinobject" class="alias">`_.entriesIn` -> `toPairsIn`</a> 251* <a href="#_assigninobject-sources" class="alias">`_.extend` -> `assignIn`</a> 252* <a href="#_assigninwithobject-sources-customizer" class="alias">`_.extendWith` -> `assignInWith`</a> 253* <a href="#_findkeyobject-predicate_identity">`_.findKey`</a> 254* <a href="#_findlastkeyobject-predicate_identity">`_.findLastKey`</a> 255* <a href="#_forinobject-iteratee_identity">`_.forIn`</a> 256* <a href="#_forinrightobject-iteratee_identity">`_.forInRight`</a> 257* <a href="#_forownobject-iteratee_identity">`_.forOwn`</a> 258* <a href="#_forownrightobject-iteratee_identity">`_.forOwnRight`</a> 259* <a href="#_functionsobject">`_.functions`</a> 260* <a href="#_functionsinobject">`_.functionsIn`</a> 261* <a href="#_getobject-path-defaultvalue">`_.get`</a> 262* <a href="#_hasobject-path">`_.has`</a> 263* <a href="#_hasinobject-path">`_.hasIn`</a> 264* <a href="#_invertobject">`_.invert`</a> 265* <a href="#_invertbyobject-iteratee_identity">`_.invertBy`</a> 266* <a href="#_invokeobject-path-args">`_.invoke`</a> 267* <a href="#_keysobject">`_.keys`</a> 268* <a href="#_keysinobject">`_.keysIn`</a> 269* <a href="#_mapkeysobject-iteratee_identity">`_.mapKeys`</a> 270* <a href="#_mapvaluesobject-iteratee_identity">`_.mapValues`</a> 271* <a href="#_mergeobject-sources">`_.merge`</a> 272* <a href="#_mergewithobject-sources-customizer">`_.mergeWith`</a> 273* <a href="#_omitobject-paths">`_.omit`</a> 274* <a href="#_omitbyobject-predicate_identity">`_.omitBy`</a> 275* <a href="#_pickobject-paths">`_.pick`</a> 276* <a href="#_pickbyobject-predicate_identity">`_.pickBy`</a> 277* <a href="#_resultobject-path-defaultvalue">`_.result`</a> 278* <a href="#_setobject-path-value">`_.set`</a> 279* <a href="#_setwithobject-path-value-customizer">`_.setWith`</a> 280* <a href="#_topairsobject">`_.toPairs`</a> 281* <a href="#_topairsinobject">`_.toPairsIn`</a> 282* <a href="#_transformobject-iteratee_identity-accumulator">`_.transform`</a> 283* <a href="#_unsetobject-path">`_.unset`</a> 284* <a href="#_updateobject-path-updater">`_.update`</a> 285* <a href="#_updatewithobject-path-updater-customizer">`_.updateWith`</a> 286* <a href="#_valuesobject">`_.values`</a> 287* <a href="#_valuesinobject">`_.valuesIn`</a> 288 289<!-- /div --> 290 291<!-- div --> 292 293## `Seq` 294* <a href="#_value">`_`</a> 295* <a href="#_chainvalue">`_.chain`</a> 296* <a href="#_tapvalue-interceptor">`_.tap`</a> 297* <a href="#_thruvalue-interceptor">`_.thru`</a> 298* <a href="#_prototypesymboliterator">`_.prototype[Symbol.iterator]`</a> 299* <a href="#_prototypeatpaths">`_.prototype.at`</a> 300* <a href="#_prototypechain">`_.prototype.chain`</a> 301* <a href="#_prototypecommit">`_.prototype.commit`</a> 302* <a href="#_prototypenext">`_.prototype.next`</a> 303* <a href="#_prototypeplantvalue">`_.prototype.plant`</a> 304* <a href="#_prototypereverse">`_.prototype.reverse`</a> 305* <a href="#_prototypevalue" class="alias">`_.prototype.toJSON` -> `value`</a> 306* <a href="#_prototypevalue">`_.prototype.value`</a> 307* <a href="#_prototypevalue" class="alias">`_.prototype.valueOf` -> `value`</a> 308 309<!-- /div --> 310 311<!-- div --> 312 313## `String` 314* <a href="#_camelcasestring">`_.camelCase`</a> 315* <a href="#_capitalizestring">`_.capitalize`</a> 316* <a href="#_deburrstring">`_.deburr`</a> 317* <a href="#_endswithstring-target-positionstringlength">`_.endsWith`</a> 318* <a href="#_escapestring">`_.escape`</a> 319* <a href="#_escaperegexpstring">`_.escapeRegExp`</a> 320* <a href="#_kebabcasestring">`_.kebabCase`</a> 321* <a href="#_lowercasestring">`_.lowerCase`</a> 322* <a href="#_lowerfirststring">`_.lowerFirst`</a> 323* <a href="#_padstring-length0-chars">`_.pad`</a> 324* <a href="#_padendstring-length0-chars">`_.padEnd`</a> 325* <a href="#_padstartstring-length0-chars">`_.padStart`</a> 326* <a href="#_parseintstring-radix10">`_.parseInt`</a> 327* <a href="#_repeatstring-n1">`_.repeat`</a> 328* <a href="#_replacestring-pattern-replacement">`_.replace`</a> 329* <a href="#_snakecasestring">`_.snakeCase`</a> 330* <a href="#_splitstring-separator-limit">`_.split`</a> 331* <a href="#_startcasestring">`_.startCase`</a> 332* <a href="#_startswithstring-target-position0">`_.startsWith`</a> 333* <a href="#_templatestring-options">`_.template`</a> 334* <a href="#_tolowerstring">`_.toLower`</a> 335* <a href="#_toupperstring">`_.toUpper`</a> 336* <a href="#_trimstring-charswhitespace">`_.trim`</a> 337* <a href="#_trimendstring-charswhitespace">`_.trimEnd`</a> 338* <a href="#_trimstartstring-charswhitespace">`_.trimStart`</a> 339* <a href="#_truncatestring-options">`_.truncate`</a> 340* <a href="#_unescapestring">`_.unescape`</a> 341* <a href="#_uppercasestring">`_.upperCase`</a> 342* <a href="#_upperfirststring">`_.upperFirst`</a> 343* <a href="#_wordsstring-pattern">`_.words`</a> 344 345<!-- /div --> 346 347<!-- div --> 348 349## `Util` 350* <a href="#_attemptfunc-args">`_.attempt`</a> 351* <a href="#_bindallobject-methodnames">`_.bindAll`</a> 352* <a href="#_condpairs">`_.cond`</a> 353* <a href="#_conformssource">`_.conforms`</a> 354* <a href="#_constantvalue">`_.constant`</a> 355* <a href="#_defaulttovalue-defaultvalue">`_.defaultTo`</a> 356* <a href="#_flowfuncs">`_.flow`</a> 357* <a href="#_flowrightfuncs">`_.flowRight`</a> 358* <a href="#_identityvalue">`_.identity`</a> 359* <a href="#_iterateefunc_identity">`_.iteratee`</a> 360* <a href="#_matchessource">`_.matches`</a> 361* <a href="#_matchespropertypath-srcvalue">`_.matchesProperty`</a> 362* <a href="#_methodpath-args">`_.method`</a> 363* <a href="#_methodofobject-args">`_.methodOf`</a> 364* <a href="#_mixinobjectlodash-source-options">`_.mixin`</a> 365* <a href="#_noconflict">`_.noConflict`</a> 366* <a href="#_noop">`_.noop`</a> 367* <a href="#_nthargn0">`_.nthArg`</a> 368* <a href="#_overiteratees_identity">`_.over`</a> 369* <a href="#_overeverypredicates_identity">`_.overEvery`</a> 370* <a href="#_oversomepredicates_identity">`_.overSome`</a> 371* <a href="#_propertypath">`_.property`</a> 372* <a href="#_propertyofobject">`_.propertyOf`</a> 373* <a href="#_rangestart0-end-step1">`_.range`</a> 374* <a href="#_rangerightstart0-end-step1">`_.rangeRight`</a> 375* <a href="#_runincontextcontextroot">`_.runInContext`</a> 376* <a href="#_stubarray">`_.stubArray`</a> 377* <a href="#_stubfalse">`_.stubFalse`</a> 378* <a href="#_stubobject">`_.stubObject`</a> 379* <a href="#_stubstring">`_.stubString`</a> 380* <a href="#_stubtrue">`_.stubTrue`</a> 381* <a href="#_timesn-iteratee_identity">`_.times`</a> 382* <a href="#_topathvalue">`_.toPath`</a> 383* <a href="#_uniqueidprefix">`_.uniqueId`</a> 384 385<!-- /div --> 386 387<!-- div --> 388 389## `Properties` 390* <a href="#_version">`_.VERSION`</a> 391* <a href="#_templatesettings">`_.templateSettings`</a> 392* <a href="#_templatesettingsescape">`_.templateSettings.escape`</a> 393* <a href="#_templatesettingsevaluate">`_.templateSettings.evaluate`</a> 394* <a href="#_templatesettingsimports">`_.templateSettings.imports`</a> 395* <a href="#_templatesettingsinterpolate">`_.templateSettings.interpolate`</a> 396* <a href="#_templatesettingsvariable">`_.templateSettings.variable`</a> 397 398<!-- /div --> 399 400<!-- div --> 401 402## `Methods` 403* <a href="#_templatesettingsimports_">`_.templateSettings.imports._`</a> 404 405<!-- /div --> 406 407<!-- /div --> 408 409<!-- div class="doc-container" --> 410 411<!-- div --> 412 413## `“Array” Methods` 414 415<!-- div --> 416 417<h3 id="_chunkarray-size1"><code>_.chunk(array, [size=1])</code></h3> 418[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6839 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") [Ⓣ][1] 419 420Creates an array of elements split into groups the length of `size`. 421If `array` can't be split evenly, the final chunk will be the remaining 422elements. 423 424#### Since 4253.0.0 426 427#### Arguments 4281. `array` *(Array)*: The array to process. 4292. `[size=1]` *(number)*: The length of each chunk 430 431#### Returns 432*(Array)*: Returns the new array of chunks. 433 434#### Example 435```js 436_.chunk(['a', 'b', 'c', 'd'], 2); 437// => [['a', 'b'], ['c', 'd']] 438 439_.chunk(['a', 'b', 'c', 'd'], 3); 440// => [['a', 'b', 'c'], ['d']] 441``` 442--- 443 444<!-- /div --> 445 446<!-- div --> 447 448<h3 id="_compactarray"><code>_.compact(array)</code></h3> 449[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6874 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") [Ⓣ][1] 450 451Creates an array with all falsey values removed. The values `false`, `null`, 452`0`, `""`, `undefined`, and `NaN` are falsey. 453 454#### Since 4550.1.0 456 457#### Arguments 4581. `array` *(Array)*: The array to compact. 459 460#### Returns 461*(Array)*: Returns the new array of filtered values. 462 463#### Example 464```js 465_.compact([0, 1, false, 2, '', 3]); 466// => [1, 2, 3] 467``` 468--- 469 470<!-- /div --> 471 472<!-- div --> 473 474<h3 id="_concatarray-values"><code>_.concat(array, [values])</code></h3> 475[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6911 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package") [Ⓣ][1] 476 477Creates a new array concatenating `array` with any additional arrays 478and/or values. 479 480#### Since 4814.0.0 482 483#### Arguments 4841. `array` *(Array)*: The array to concatenate. 4852. `[values]` *(...*)*: The values to concatenate. 486 487#### Returns 488*(Array)*: Returns the new concatenated array. 489 490#### Example 491```js 492var array = [1]; 493var other = _.concat(array, 2, [3], [[4]]); 494 495console.log(other); 496// => [1, 2, 3, [4]] 497 498console.log(array); 499// => [1] 500``` 501--- 502 503<!-- /div --> 504 505<!-- div --> 506 507<h3 id="_differencearray-values"><code>_.difference(array, [values])</code></h3> 508[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6947 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") [Ⓣ][1] 509 510Creates an array of `array` values not included in the other given arrays 511using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 512for equality comparisons. The order and references of result values are 513determined by the first array. 514<br> 515<br> 516**Note:** Unlike `_.pullAll`, this method returns a new array. 517 518#### Since 5190.1.0 520 521#### Arguments 5221. `array` *(Array)*: The array to inspect. 5232. `[values]` *(...Array)*: The values to exclude. 524 525#### Returns 526*(Array)*: Returns the new array of filtered values. 527 528#### Example 529```js 530_.difference([2, 1], [2, 3]); 531// => [1] 532``` 533--- 534 535<!-- /div --> 536 537<!-- div --> 538 539<h3 id="_differencebyarray-values-iteratee_identity"><code>_.differenceBy(array, [values], [iteratee=_.identity])</code></h3> 540[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6979 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package") [Ⓣ][1] 541 542This method is like `_.difference` except that it accepts `iteratee` which 543is invoked for each element of `array` and `values` to generate the criterion 544by which they're compared. The order and references of result values are 545determined by the first array. The iteratee is invoked with one argument:<br> 546*(value)*. 547<br> 548<br> 549**Note:** Unlike `_.pullAllBy`, this method returns a new array. 550 551#### Since 5524.0.0 553 554#### Arguments 5551. `array` *(Array)*: The array to inspect. 5562. `[values]` *(...Array)*: The values to exclude. 5573. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 558 559#### Returns 560*(Array)*: Returns the new array of filtered values. 561 562#### Example 563```js 564_.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 565// => [1.2] 566 567// The `_.property` iteratee shorthand. 568_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 569// => [{ 'x': 2 }] 570``` 571--- 572 573<!-- /div --> 574 575<!-- div --> 576 577<h3 id="_differencewitharray-values-comparator"><code>_.differenceWith(array, [values], [comparator])</code></h3> 578[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7012 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package") [Ⓣ][1] 579 580This method is like `_.difference` except that it accepts `comparator` 581which is invoked to compare elements of `array` to `values`. The order and 582references of result values are determined by the first array. The comparator 583is invoked with two arguments: *(arrVal, othVal)*. 584<br> 585<br> 586**Note:** Unlike `_.pullAllWith`, this method returns a new array. 587 588#### Since 5894.0.0 590 591#### Arguments 5921. `array` *(Array)*: The array to inspect. 5932. `[values]` *(...Array)*: The values to exclude. 5943. `[comparator]` *(Function)*: The comparator invoked per element. 595 596#### Returns 597*(Array)*: Returns the new array of filtered values. 598 599#### Example 600```js 601var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 602 603_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 604// => [{ 'x': 2, 'y': 1 }] 605``` 606--- 607 608<!-- /div --> 609 610<!-- div --> 611 612<h3 id="_droparray-n1"><code>_.drop(array, [n=1])</code></h3> 613[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7047 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") [Ⓣ][1] 614 615Creates a slice of `array` with `n` elements dropped from the beginning. 616 617#### Since 6180.5.0 619 620#### Arguments 6211. `array` *(Array)*: The array to query. 6222. `[n=1]` *(number)*: The number of elements to drop. 623 624#### Returns 625*(Array)*: Returns the slice of `array`. 626 627#### Example 628```js 629_.drop([1, 2, 3]); 630// => [2, 3] 631 632_.drop([1, 2, 3], 2); 633// => [3] 634 635_.drop([1, 2, 3], 5); 636// => [] 637 638_.drop([1, 2, 3], 0); 639// => [1, 2, 3] 640``` 641--- 642 643<!-- /div --> 644 645<!-- div --> 646 647<h3 id="_droprightarray-n1"><code>_.dropRight(array, [n=1])</code></h3> 648[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7081 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") [Ⓣ][1] 649 650Creates a slice of `array` with `n` elements dropped from the end. 651 652#### Since 6533.0.0 654 655#### Arguments 6561. `array` *(Array)*: The array to query. 6572. `[n=1]` *(number)*: The number of elements to drop. 658 659#### Returns 660*(Array)*: Returns the slice of `array`. 661 662#### Example 663```js 664_.dropRight([1, 2, 3]); 665// => [1, 2] 666 667_.dropRight([1, 2, 3], 2); 668// => [1] 669 670_.dropRight([1, 2, 3], 5); 671// => [] 672 673_.dropRight([1, 2, 3], 0); 674// => [1, 2, 3] 675``` 676--- 677 678<!-- /div --> 679 680<!-- div --> 681 682<h3 id="_droprightwhilearray-predicate_identity"><code>_.dropRightWhile(array, [predicate=_.identity])</code></h3> 683[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7126 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") [Ⓣ][1] 684 685Creates a slice of `array` excluding elements dropped from the end. 686Elements are dropped until `predicate` returns falsey. The predicate is 687invoked with three arguments: *(value, index, array)*. 688 689#### Since 6903.0.0 691 692#### Arguments 6931. `array` *(Array)*: The array to query. 6942. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 695 696#### Returns 697*(Array)*: Returns the slice of `array`. 698 699#### Example 700```js 701var users = [ 702 { 'user': 'barney', 'active': true }, 703 { 'user': 'fred', 'active': false }, 704 { 'user': 'pebbles', 'active': false } 705]; 706 707_.dropRightWhile(users, function(o) { return !o.active; }); 708// => objects for ['barney'] 709 710// The `_.matches` iteratee shorthand. 711_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 712// => objects for ['barney', 'fred'] 713 714// The `_.matchesProperty` iteratee shorthand. 715_.dropRightWhile(users, ['active', false]); 716// => objects for ['barney'] 717 718// The `_.property` iteratee shorthand. 719_.dropRightWhile(users, 'active'); 720// => objects for ['barney', 'fred', 'pebbles'] 721``` 722--- 723 724<!-- /div --> 725 726<!-- div --> 727 728<h3 id="_dropwhilearray-predicate_identity"><code>_.dropWhile(array, [predicate=_.identity])</code></h3> 729[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7167 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") [Ⓣ][1] 730 731Creates a slice of `array` excluding elements dropped from the beginning. 732Elements are dropped until `predicate` returns falsey. The predicate is 733invoked with three arguments: *(value, index, array)*. 734 735#### Since 7363.0.0 737 738#### Arguments 7391. `array` *(Array)*: The array to query. 7402. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 741 742#### Returns 743*(Array)*: Returns the slice of `array`. 744 745#### Example 746```js 747var users = [ 748 { 'user': 'barney', 'active': false }, 749 { 'user': 'fred', 'active': false }, 750 { 'user': 'pebbles', 'active': true } 751]; 752 753_.dropWhile(users, function(o) { return !o.active; }); 754// => objects for ['pebbles'] 755 756// The `_.matches` iteratee shorthand. 757_.dropWhile(users, { 'user': 'barney', 'active': false }); 758// => objects for ['fred', 'pebbles'] 759 760// The `_.matchesProperty` iteratee shorthand. 761_.dropWhile(users, ['active', false]); 762// => objects for ['pebbles'] 763 764// The `_.property` iteratee shorthand. 765_.dropWhile(users, 'active'); 766// => objects for ['barney', 'fred', 'pebbles'] 767``` 768--- 769 770<!-- /div --> 771 772<!-- div --> 773 774<h3 id="_fillarray-value-start0-endarraylength"><code>_.fill(array, value, [start=0], [end=array.length])</code></h3> 775[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7202 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") [Ⓣ][1] 776 777Fills elements of `array` with `value` from `start` up to, but not 778including, `end`. 779<br> 780<br> 781**Note:** This method mutates `array`. 782 783#### Since 7843.2.0 785 786#### Arguments 7871. `array` *(Array)*: The array to fill. 7882. `value` *(*)*: The value to fill `array` with. 7893. `[start=0]` *(number)*: The start position. 7904. `[end=array.length]` *(number)*: The end position. 791 792#### Returns 793*(Array)*: Returns `array`. 794 795#### Example 796```js 797var array = [1, 2, 3]; 798 799_.fill(array, 'a'); 800console.log(array); 801// => ['a', 'a', 'a'] 802 803_.fill(Array(3), 2); 804// => [2, 2, 2] 805 806_.fill([4, 6, 8, 10], '*', 1, 3); 807// => [4, '*', '*', 10] 808``` 809--- 810 811<!-- /div --> 812 813<!-- div --> 814 815<h3 id="_findindexarray-predicate_identity-fromindex0"><code>_.findIndex(array, [predicate=_.identity], [fromIndex=0])</code></h3> 816[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7249 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") [Ⓣ][1] 817 818This method is like `_.find` except that it returns the index of the first 819element `predicate` returns truthy for instead of the element itself. 820 821#### Since 8221.1.0 823 824#### Arguments 8251. `array` *(Array)*: The array to inspect. 8262. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 8273. `[fromIndex=0]` *(number)*: The index to search from. 828 829#### Returns 830*(number)*: Returns the index of the found element, else `-1`. 831 832#### Example 833```js 834var users = [ 835 { 'user': 'barney', 'active': false }, 836 { 'user': 'fred', 'active': false }, 837 { 'user': 'pebbles', 'active': true } 838]; 839 840_.findIndex(users, function(o) { return o.user == 'barney'; }); 841// => 0 842 843// The `_.matches` iteratee shorthand. 844_.findIndex(users, { 'user': 'fred', 'active': false }); 845// => 1 846 847// The `_.matchesProperty` iteratee shorthand. 848_.findIndex(users, ['active', false]); 849// => 0 850 851// The `_.property` iteratee shorthand. 852_.findIndex(users, 'active'); 853// => 2 854``` 855--- 856 857<!-- /div --> 858 859<!-- div --> 860 861<h3 id="_findlastindexarray-predicate_identity-fromindexarraylength-1"><code>_.findLastIndex(array, [predicate=_.identity], [fromIndex=array.length-1])</code></h3> 862[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7296 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") [Ⓣ][1] 863 864This method is like `_.findIndex` except that it iterates over elements 865of `collection` from right to left. 866 867#### Since 8682.0.0 869 870#### Arguments 8711. `array` *(Array)*: The array to inspect. 8722. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 8733. `[fromIndex=array.length-1]` *(number)*: The index to search from. 874 875#### Returns 876*(number)*: Returns the index of the found element, else `-1`. 877 878#### Example 879```js 880var users = [ 881 { 'user': 'barney', 'active': true }, 882 { 'user': 'fred', 'active': false }, 883 { 'user': 'pebbles', 'active': false } 884]; 885 886_.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 887// => 2 888 889// The `_.matches` iteratee shorthand. 890_.findLastIndex(users, { 'user': 'barney', 'active': true }); 891// => 0 892 893// The `_.matchesProperty` iteratee shorthand. 894_.findLastIndex(users, ['active', false]); 895// => 2 896 897// The `_.property` iteratee shorthand. 898_.findLastIndex(users, 'active'); 899// => 0 900``` 901--- 902 903<!-- /div --> 904 905<!-- div --> 906 907<h3 id="_flattenarray"><code>_.flatten(array)</code></h3> 908[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7325 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") [Ⓣ][1] 909 910Flattens `array` a single level deep. 911 912#### Since 9130.1.0 914 915#### Arguments 9161. `array` *(Array)*: The array to flatten. 917 918#### Returns 919*(Array)*: Returns the new flattened array. 920 921#### Example 922```js 923_.flatten([1, [2, [3, [4]], 5]]); 924// => [1, 2, [3, [4]], 5] 925``` 926--- 927 928<!-- /div --> 929 930<!-- div --> 931 932<h3 id="_flattendeeparray"><code>_.flattenDeep(array)</code></h3> 933[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7344 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") [Ⓣ][1] 934 935Recursively flattens `array`. 936 937#### Since 9383.0.0 939 940#### Arguments 9411. `array` *(Array)*: The array to flatten. 942 943#### Returns 944*(Array)*: Returns the new flattened array. 945 946#### Example 947```js 948_.flattenDeep([1, [2, [3, [4]], 5]]); 949// => [1, 2, 3, 4, 5] 950``` 951--- 952 953<!-- /div --> 954 955<!-- div --> 956 957<h3 id="_flattendeptharray-depth1"><code>_.flattenDepth(array, [depth=1])</code></h3> 958[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7369 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flattendepth "See the npm package") [Ⓣ][1] 959 960Recursively flatten `array` up to `depth` times. 961 962#### Since 9634.4.0 964 965#### Arguments 9661. `array` *(Array)*: The array to flatten. 9672. `[depth=1]` *(number)*: The maximum recursion depth. 968 969#### Returns 970*(Array)*: Returns the new flattened array. 971 972#### Example 973```js 974var array = [1, [2, [3, [4]], 5]]; 975 976_.flattenDepth(array, 1); 977// => [1, 2, [3, [4]], 5] 978 979_.flattenDepth(array, 2); 980// => [1, 2, 3, [4], 5] 981``` 982--- 983 984<!-- /div --> 985 986<!-- div --> 987 988<h3 id="_frompairspairs"><code>_.fromPairs(pairs)</code></h3> 989[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7393 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package") [Ⓣ][1] 990 991The inverse of `_.toPairs`; this method returns an object composed 992from key-value `pairs`. 993 994#### Since 9954.0.0 996 997#### Arguments 9981. `pairs` *(Array)*: The key-value pairs. 999 1000#### Returns 1001*(Object)*: Returns the new object. 1002 1003#### Example 1004```js 1005_.fromPairs([['a', 1], ['b', 2]]); 1006// => { 'a': 1, 'b': 2 } 1007``` 1008--- 1009 1010<!-- /div --> 1011 1012<!-- div --> 1013 1014<h3 id="_headarray"><code>_.head(array)</code></h3> 1015[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7423 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package") [Ⓣ][1] 1016 1017Gets the first element of `array`. 1018 1019#### Since 10200.1.0 1021 1022#### Aliases 1023*_.first* 1024 1025#### Arguments 10261. `array` *(Array)*: The array to query. 1027 1028#### Returns 1029*(*)*: Returns the first element of `array`. 1030 1031#### Example 1032```js 1033_.head([1, 2, 3]); 1034// => 1 1035 1036_.head([]); 1037// => undefined 1038``` 1039--- 1040 1041<!-- /div --> 1042 1043<!-- div --> 1044 1045<h3 id="_indexofarray-value-fromindex0"><code>_.indexOf(array, value, [fromIndex=0])</code></h3> 1046[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7450 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") [Ⓣ][1] 1047 1048Gets the index at which the first occurrence of `value` is found in `array` 1049using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 1050for equality comparisons. If `fromIndex` is negative, it's used as the 1051offset from the end of `array`. 1052 1053#### Since 10540.1.0 1055 1056#### Arguments 10571. `array` *(Array)*: The array to inspect. 10582. `value` *(*)*: The value to search for. 10593. `[fromIndex=0]` *(number)*: The index to search from. 1060 1061#### Returns 1062*(number)*: Returns the index of the matched value, else `-1`. 1063 1064#### Example 1065```js 1066_.indexOf([1, 2, 1, 2], 2); 1067// => 1 1068 1069// Search from the `fromIndex`. 1070_.indexOf([1, 2, 1, 2], 2, 2); 1071// => 3 1072``` 1073--- 1074 1075<!-- /div --> 1076 1077<!-- div --> 1078 1079<h3 id="_initialarray"><code>_.initial(array)</code></h3> 1080[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7476 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") [Ⓣ][1] 1081 1082Gets all but the last element of `array`. 1083 1084#### Since 10850.1.0 1086 1087#### Arguments 10881. `array` *(Array)*: The array to query. 1089 1090#### Returns 1091*(Array)*: Returns the slice of `array`. 1092 1093#### Example 1094```js 1095_.initial([1, 2, 3]); 1096// => [1, 2] 1097``` 1098--- 1099 1100<!-- /div --> 1101 1102<!-- div --> 1103 1104<h3 id="_intersectionarrays"><code>_.intersection([arrays])</code></h3> 1105[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7498 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") [Ⓣ][1] 1106 1107Creates an array of unique values that are included in all given arrays 1108using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 1109for equality comparisons. The order and references of result values are 1110determined by the first array. 1111 1112#### Since 11130.1.0 1114 1115#### Arguments 11161. `[arrays]` *(...Array)*: The arrays to inspect. 1117 1118#### Returns 1119*(Array)*: Returns the new array of intersecting values. 1120 1121#### Example 1122```js 1123_.intersection([2, 1], [2, 3]); 1124// => [2] 1125``` 1126--- 1127 1128<!-- /div --> 1129 1130<!-- div --> 1131 1132<h3 id="_intersectionbyarrays-iteratee_identity"><code>_.intersectionBy([arrays], [iteratee=_.identity])</code></h3> 1133[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7528 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package") [Ⓣ][1] 1134 1135This method is like `_.intersection` except that it accepts `iteratee` 1136which is invoked for each element of each `arrays` to generate the criterion 1137by which they're compared. The order and references of result values are 1138determined by the first array. The iteratee is invoked with one argument:<br> 1139*(value)*. 1140 1141#### Since 11424.0.0 1143 1144#### Arguments 11451. `[arrays]` *(...Array)*: The arrays to inspect. 11462. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 1147 1148#### Returns 1149*(Array)*: Returns the new array of intersecting values. 1150 1151#### Example 1152```js 1153_.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 1154// => [2.1] 1155 1156// The `_.property` iteratee shorthand. 1157_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 1158// => [{ 'x': 1 }] 1159``` 1160--- 1161 1162<!-- /div --> 1163 1164<!-- div --> 1165 1166<h3 id="_intersectionwitharrays-comparator"><code>_.intersectionWith([arrays], [comparator])</code></h3> 1167[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7563 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package") [Ⓣ][1] 1168 1169This method is like `_.intersection` except that it accepts `comparator` 1170which is invoked to compare elements of `arrays`. The order and references 1171of result values are determined by the first array. The comparator is 1172invoked with two arguments: *(arrVal, othVal)*. 1173 1174#### Since 11754.0.0 1176 1177#### Arguments 11781. `[arrays]` *(...Array)*: The arrays to inspect. 11792. `[comparator]` *(Function)*: The comparator invoked per element. 1180 1181#### Returns 1182*(Array)*: Returns the new array of intersecting values. 1183 1184#### Example 1185```js 1186var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 1187var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 1188 1189_.intersectionWith(objects, others, _.isEqual); 1190// => [{ 'x': 1, 'y': 2 }] 1191``` 1192--- 1193 1194<!-- /div --> 1195 1196<!-- div --> 1197 1198<h3 id="_joinarray-separator-"><code>_.join(array, [separator=','])</code></h3> 1199[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7591 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package") [Ⓣ][1] 1200 1201Converts all elements in `array` into a string separated by `separator`. 1202 1203#### Since 12044.0.0 1205 1206#### Arguments 12071. `array` *(Array)*: The array to convert. 12082. `[separator=',']` *(string)*: The element separator. 1209 1210#### Returns 1211*(string)*: Returns the joined string. 1212 1213#### Example 1214```js 1215_.join(['a', 'b', 'c'], '~'); 1216// => 'a~b~c' 1217``` 1218--- 1219 1220<!-- /div --> 1221 1222<!-- div --> 1223 1224<h3 id="_lastarray"><code>_.last(array)</code></h3> 1225[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7609 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") [Ⓣ][1] 1226 1227Gets the last element of `array`. 1228 1229#### Since 12300.1.0 1231 1232#### Arguments 12331. `array` *(Array)*: The array to query. 1234 1235#### Returns 1236*(*)*: Returns the last element of `array`. 1237 1238#### Example 1239```js 1240_.last([1, 2, 3]); 1241// => 3 1242``` 1243--- 1244 1245<!-- /div --> 1246 1247<!-- div --> 1248 1249<h3 id="_lastindexofarray-value-fromindexarraylength-1"><code>_.lastIndexOf(array, value, [fromIndex=array.length-1])</code></h3> 1250[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7635 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") [Ⓣ][1] 1251 1252This method is like `_.indexOf` except that it iterates over elements of 1253`array` from right to left. 1254 1255#### Since 12560.1.0 1257 1258#### Arguments 12591. `array` *(Array)*: The array to inspect. 12602. `value` *(*)*: The value to search for. 12613. `[fromIndex=array.length-1]` *(number)*: The index to search from. 1262 1263#### Returns 1264*(number)*: Returns the index of the matched value, else `-1`. 1265 1266#### Example 1267```js 1268_.lastIndexOf([1, 2, 1, 2], 2); 1269// => 3 1270 1271// Search from the `fromIndex`. 1272_.lastIndexOf([1, 2, 1, 2], 2, 2); 1273// => 1 1274``` 1275--- 1276 1277<!-- /div --> 1278 1279<!-- div --> 1280 1281<h3 id="_ntharray-n0"><code>_.nth(array, [n=0])</code></h3> 1282[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7671 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.nth "See the npm package") [Ⓣ][1] 1283 1284Gets the element at index `n` of `array`. If `n` is negative, the nth 1285element from the end is returned. 1286 1287#### Since 12884.11.0 1289 1290#### Arguments 12911. `array` *(Array)*: The array to query. 12922. `[n=0]` *(number)*: The index of the element to return. 1293 1294#### Returns 1295*(*)*: Returns the nth element of `array`. 1296 1297#### Example 1298```js 1299var array = ['a', 'b', 'c', 'd']; 1300 1301_.nth(array, 1); 1302// => 'b' 1303 1304_.nth(array, -2); 1305// => 'c'; 1306``` 1307--- 1308 1309<!-- /div --> 1310 1311<!-- div --> 1312 1313<h3 id="_pullarray-values"><code>_.pull(array, [values])</code></h3> 1314[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7698 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") [Ⓣ][1] 1315 1316Removes all given values from `array` using 1317[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 1318for equality comparisons. 1319<br> 1320<br> 1321**Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 1322to remove elements from an array by predicate. 1323 1324#### Since 13252.0.0 1326 1327#### Arguments 13281. `array` *(Array)*: The array to modify. 13292. `[values]` *(...*)*: The values to remove. 1330 1331#### Returns 1332*(Array)*: Returns `array`. 1333 1334#### Example 1335```js 1336var array = ['a', 'b', 'c', 'a', 'b', 'c']; 1337 1338_.pull(array, 'a', 'c'); 1339console.log(array); 1340// => ['b', 'b'] 1341``` 1342--- 1343 1344<!-- /div --> 1345 1346<!-- div --> 1347 1348<h3 id="_pullallarray-values"><code>_.pullAll(array, values)</code></h3> 1349[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7720 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package") [Ⓣ][1] 1350 1351This method is like `_.pull` except that it accepts an array of values to remove. 1352<br> 1353<br> 1354**Note:** Unlike `_.difference`, this method mutates `array`. 1355 1356#### Since 13574.0.0 1358 1359#### Arguments 13601. `array` *(Array)*: The array to modify. 13612. `values` *(Array)*: The values to remove. 1362 1363#### Returns 1364*(Array)*: Returns `array`. 1365 1366#### Example 1367```js 1368var array = ['a', 'b', 'c', 'a', 'b', 'c']; 1369 1370_.pullAll(array, ['a', 'c']); 1371console.log(array); 1372// => ['b', 'b'] 1373``` 1374--- 1375 1376<!-- /div --> 1377 1378<!-- div --> 1379 1380<h3 id="_pullallbyarray-values-iteratee_identity"><code>_.pullAllBy(array, values, [iteratee=_.identity])</code></h3> 1381[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7749 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package") [Ⓣ][1] 1382 1383This method is like `_.pullAll` except that it accepts `iteratee` which is 1384invoked for each element of `array` and `values` to generate the criterion 1385by which they're compared. The iteratee is invoked with one argument: *(value)*. 1386<br> 1387<br> 1388**Note:** Unlike `_.differenceBy`, this method mutates `array`. 1389 1390#### Since 13914.0.0 1392 1393#### Arguments 13941. `array` *(Array)*: The array to modify. 13952. `values` *(Array)*: The values to remove. 13963. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 1397 1398#### Returns 1399*(Array)*: Returns `array`. 1400 1401#### Example 1402```js 1403var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 1404 1405_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 1406console.log(array); 1407// => [{ 'x': 2 }] 1408``` 1409--- 1410 1411<!-- /div --> 1412 1413<!-- div --> 1414 1415<h3 id="_pullallwitharray-values-comparator"><code>_.pullAllWith(array, values, [comparator])</code></h3> 1416[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7778 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullallwith "See the npm package") [Ⓣ][1] 1417 1418This method is like `_.pullAll` except that it accepts `comparator` which 1419is invoked to compare elements of `array` to `values`. The comparator is 1420invoked with two arguments: *(arrVal, othVal)*. 1421<br> 1422<br> 1423**Note:** Unlike `_.differenceWith`, this method mutates `array`. 1424 1425#### Since 14264.6.0 1427 1428#### Arguments 14291. `array` *(Array)*: The array to modify. 14302. `values` *(Array)*: The values to remove. 14313. `[comparator]` *(Function)*: The comparator invoked per element. 1432 1433#### Returns 1434*(Array)*: Returns `array`. 1435 1436#### Example 1437```js 1438var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 1439 1440_.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 1441console.log(array); 1442// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 1443``` 1444--- 1445 1446<!-- /div --> 1447 1448<!-- div --> 1449 1450<h3 id="_pullatarray-indexes"><code>_.pullAt(array, [indexes])</code></h3> 1451[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7808 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") [Ⓣ][1] 1452 1453Removes elements from `array` corresponding to `indexes` and returns an 1454array of removed elements. 1455<br> 1456<br> 1457**Note:** Unlike `_.at`, this method mutates `array`. 1458 1459#### Since 14603.0.0 1461 1462#### Arguments 14631. `array` *(Array)*: The array to modify. 14642. `[indexes]` *(...(number|number[]))*: The indexes of elements to remove. 1465 1466#### Returns 1467*(Array)*: Returns the new array of removed elements. 1468 1469#### Example 1470```js 1471var array = ['a', 'b', 'c', 'd']; 1472var pulled = _.pullAt(array, [1, 3]); 1473 1474console.log(array); 1475// => ['a', 'c'] 1476 1477console.log(pulled); 1478// => ['b', 'd'] 1479``` 1480--- 1481 1482<!-- /div --> 1483 1484<!-- div --> 1485 1486<h3 id="_removearray-predicate_identity"><code>_.remove(array, [predicate=_.identity])</code></h3> 1487[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7847 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") [Ⓣ][1] 1488 1489Removes all elements from `array` that `predicate` returns truthy for 1490and returns an array of the removed elements. The predicate is invoked 1491with three arguments: *(value, index, array)*. 1492<br> 1493<br> 1494**Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 1495to pull elements from an array by value. 1496 1497#### Since 14982.0.0 1499 1500#### Arguments 15011. `array` *(Array)*: The array to modify. 15022. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 1503 1504#### Returns 1505*(Array)*: Returns the new array of removed elements. 1506 1507#### Example 1508```js 1509var array = [1, 2, 3, 4]; 1510var evens = _.remove(array, function(n) { 1511 return n % 2 == 0; 1512}); 1513 1514console.log(array); 1515// => [1, 3] 1516 1517console.log(evens); 1518// => [2, 4] 1519``` 1520--- 1521 1522<!-- /div --> 1523 1524<!-- div --> 1525 1526<h3 id="_reversearray"><code>_.reverse(array)</code></h3> 1527[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7891 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package") [Ⓣ][1] 1528 1529Reverses `array` so that the first element becomes the last, the second 1530element becomes the second to last, and so on. 1531<br> 1532<br> 1533**Note:** This method mutates `array` and is based on 1534[`Array#reverse`](https://mdn.io/Array/reverse). 1535 1536#### Since 15374.0.0 1538 1539#### Arguments 15401. `array` *(Array)*: The array to modify. 1541 1542#### Returns 1543*(Array)*: Returns `array`. 1544 1545#### Example 1546```js 1547var array = [1, 2, 3]; 1548 1549_.reverse(array); 1550// => [3, 2, 1] 1551 1552console.log(array); 1553// => [3, 2, 1] 1554``` 1555--- 1556 1557<!-- /div --> 1558 1559<!-- div --> 1560 1561<h3 id="_slicearray-start0-endarraylength"><code>_.slice(array, [start=0], [end=array.length])</code></h3> 1562[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7911 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") [Ⓣ][1] 1563 1564Creates a slice of `array` from `start` up to, but not including, `end`. 1565<br> 1566<br> 1567**Note:** This method is used instead of 1568[`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 1569returned. 1570 1571#### Since 15723.0.0 1573 1574#### Arguments 15751. `array` *(Array)*: The array to slice. 15762. `[start=0]` *(number)*: The start position. 15773. `[end=array.length]` *(number)*: The end position. 1578 1579#### Returns 1580*(Array)*: Returns the slice of `array`. 1581 1582--- 1583 1584<!-- /div --> 1585 1586<!-- div --> 1587 1588<h3 id="_sortedindexarray-value"><code>_.sortedIndex(array, value)</code></h3> 1589[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7944 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") [Ⓣ][1] 1590 1591Uses a binary search to determine the lowest index at which `value` 1592should be inserted into `array` in order to maintain its sort order. 1593 1594#### Since 15950.1.0 1596 1597#### Arguments 15981. `array` *(Array)*: The sorted array to inspect. 15992. `value` *(*)*: The value to evaluate. 1600 1601#### Returns 1602*(number)*: Returns the index at which `value` should be inserted into `array`. 1603 1604#### Example 1605```js 1606_.sortedIndex([30, 50], 40); 1607// => 1 1608``` 1609--- 1610 1611<!-- /div --> 1612 1613<!-- div --> 1614 1615<h3 id="_sortedindexbyarray-value-iteratee_identity"><code>_.sortedIndexBy(array, value, [iteratee=_.identity])</code></h3> 1616[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7973 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package") [Ⓣ][1] 1617 1618This method is like `_.sortedIndex` except that it accepts `iteratee` 1619which is invoked for `value` and each element of `array` to compute their 1620sort ranking. The iteratee is invoked with one argument: *(value)*. 1621 1622#### Since 16234.0.0 1624 1625#### Arguments 16261. `array` *(Array)*: The sorted array to inspect. 16272. `value` *(*)*: The value to evaluate. 16283. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 1629 1630#### Returns 1631*(number)*: Returns the index at which `value` should be inserted into `array`. 1632 1633#### Example 1634```js 1635var objects = [{ 'x': 4 }, { 'x': 5 }]; 1636 1637_.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 1638// => 0 1639 1640// The `_.property` iteratee shorthand. 1641_.sortedIndexBy(objects, { 'x': 4 }, 'x'); 1642// => 0 1643``` 1644--- 1645 1646<!-- /div --> 1647 1648<!-- div --> 1649 1650<h3 id="_sortedindexofarray-value"><code>_.sortedIndexOf(array, value)</code></h3> 1651[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L7993 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package") [Ⓣ][1] 1652 1653This method is like `_.indexOf` except that it performs a binary 1654search on a sorted `array`. 1655 1656#### Since 16574.0.0 1658 1659#### Arguments 16601. `array` *(Array)*: The array to inspect. 16612. `value` *(*)*: The value to search for. 1662 1663#### Returns 1664*(number)*: Returns the index of the matched value, else `-1`. 1665 1666#### Example 1667```js 1668_.sortedIndexOf([4, 5, 5, 5, 6], 5); 1669// => 1 1670``` 1671--- 1672 1673<!-- /div --> 1674 1675<!-- div --> 1676 1677<h3 id="_sortedlastindexarray-value"><code>_.sortedLastIndex(array, value)</code></h3> 1678[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8022 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") [Ⓣ][1] 1679 1680This method is like `_.sortedIndex` except that it returns the highest 1681index at which `value` should be inserted into `array` in order to 1682maintain its sort order. 1683 1684#### Since 16853.0.0 1686 1687#### Arguments 16881. `array` *(Array)*: The sorted array to inspect. 16892. `value` *(*)*: The value to evaluate. 1690 1691#### Returns 1692*(number)*: Returns the index at which `value` should be inserted into `array`. 1693 1694#### Example 1695```js 1696_.sortedLastIndex([4, 5, 5, 5, 6], 5); 1697// => 4 1698``` 1699--- 1700 1701<!-- /div --> 1702 1703<!-- div --> 1704 1705<h3 id="_sortedlastindexbyarray-value-iteratee_identity"><code>_.sortedLastIndexBy(array, value, [iteratee=_.identity])</code></h3> 1706[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8051 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package") [Ⓣ][1] 1707 1708This method is like `_.sortedLastIndex` except that it accepts `iteratee` 1709which is invoked for `value` and each element of `array` to compute their 1710sort ranking. The iteratee is invoked with one argument: *(value)*. 1711 1712#### Since 17134.0.0 1714 1715#### Arguments 17161. `array` *(Array)*: The sorted array to inspect. 17172. `value` *(*)*: The value to evaluate. 17183. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 1719 1720#### Returns 1721*(number)*: Returns the index at which `value` should be inserted into `array`. 1722 1723#### Example 1724```js 1725var objects = [{ 'x': 4 }, { 'x': 5 }]; 1726 1727_.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 1728// => 1 1729 1730// The `_.property` iteratee shorthand. 1731_.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 1732// => 1 1733``` 1734--- 1735 1736<!-- /div --> 1737 1738<!-- div --> 1739 1740<h3 id="_sortedlastindexofarray-value"><code>_.sortedLastIndexOf(array, value)</code></h3> 1741[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8071 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package") [Ⓣ][1] 1742 1743This method is like `_.lastIndexOf` except that it performs a binary 1744search on a sorted `array`. 1745 1746#### Since 17474.0.0 1748 1749#### Arguments 17501. `array` *(Array)*: The array to inspect. 17512. `value` *(*)*: The value to search for. 1752 1753#### Returns 1754*(number)*: Returns the index of the matched value, else `-1`. 1755 1756#### Example 1757```js 1758_.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 1759// => 3 1760``` 1761--- 1762 1763<!-- /div --> 1764 1765<!-- div --> 1766 1767<h3 id="_sorteduniqarray"><code>_.sortedUniq(array)</code></h3> 1768[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8097 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package") [Ⓣ][1] 1769 1770This method is like `_.uniq` except that it's designed and optimized 1771for sorted arrays. 1772 1773#### Since 17744.0.0 1775 1776#### Arguments 17771. `array` *(Array)*: The array to inspect. 1778 1779#### Returns 1780*(Array)*: Returns the new duplicate free array. 1781 1782#### Example 1783```js 1784_.sortedUniq([1, 1, 2]); 1785// => [1, 2] 1786``` 1787--- 1788 1789<!-- /div --> 1790 1791<!-- div --> 1792 1793<h3 id="_sorteduniqbyarray-iteratee"><code>_.sortedUniqBy(array, [iteratee])</code></h3> 1794[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8119 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package") [Ⓣ][1] 1795 1796This method is like `_.uniqBy` except that it's designed and optimized 1797for sorted arrays. 1798 1799#### Since 18004.0.0 1801 1802#### Arguments 18031. `array` *(Array)*: The array to inspect. 18042. `[iteratee]` *(Function)*: The iteratee invoked per element. 1805 1806#### Returns 1807*(Array)*: Returns the new duplicate free array. 1808 1809#### Example 1810```js 1811_.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 1812// => [1.1, 2.3] 1813``` 1814--- 1815 1816<!-- /div --> 1817 1818<!-- div --> 1819 1820<h3 id="_tailarray"><code>_.tail(array)</code></h3> 1821[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8139 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package") [Ⓣ][1] 1822 1823Gets all but the first element of `array`. 1824 1825#### Since 18264.0.0 1827 1828#### Arguments 18291. `array` *(Array)*: The array to query. 1830 1831#### Returns 1832*(Array)*: Returns the slice of `array`. 1833 1834#### Example 1835```js 1836_.tail([1, 2, 3]); 1837// => [2, 3] 1838``` 1839--- 1840 1841<!-- /div --> 1842 1843<!-- div --> 1844 1845<h3 id="_takearray-n1"><code>_.take(array, [n=1])</code></h3> 1846[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8169 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") [Ⓣ][1] 1847 1848Creates a slice of `array` with `n` elements taken from the beginning. 1849 1850#### Since 18510.1.0 1852 1853#### Arguments 18541. `array` *(Array)*: The array to query. 18552. `[n=1]` *(number)*: The number of elements to take. 1856 1857#### Returns 1858*(Array)*: Returns the slice of `array`. 1859 1860#### Example 1861```js 1862_.take([1, 2, 3]); 1863// => [1] 1864 1865_.take([1, 2, 3], 2); 1866// => [1, 2] 1867 1868_.take([1, 2, 3], 5); 1869// => [1, 2, 3] 1870 1871_.take([1, 2, 3], 0); 1872// => [] 1873``` 1874--- 1875 1876<!-- /div --> 1877 1878<!-- div --> 1879 1880<h3 id="_takerightarray-n1"><code>_.takeRight(array, [n=1])</code></h3> 1881[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8202 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") [Ⓣ][1] 1882 1883Creates a slice of `array` with `n` elements taken from the end. 1884 1885#### Since 18863.0.0 1887 1888#### Arguments 18891. `array` *(Array)*: The array to query. 18902. `[n=1]` *(number)*: The number of elements to take. 1891 1892#### Returns 1893*(Array)*: Returns the slice of `array`. 1894 1895#### Example 1896```js 1897_.takeRight([1, 2, 3]); 1898// => [3] 1899 1900_.takeRight([1, 2, 3], 2); 1901// => [2, 3] 1902 1903_.takeRight([1, 2, 3], 5); 1904// => [1, 2, 3] 1905 1906_.takeRight([1, 2, 3], 0); 1907// => [] 1908``` 1909--- 1910 1911<!-- /div --> 1912 1913<!-- div --> 1914 1915<h3 id="_takerightwhilearray-predicate_identity"><code>_.takeRightWhile(array, [predicate=_.identity])</code></h3> 1916[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8247 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") [Ⓣ][1] 1917 1918Creates a slice of `array` with elements taken from the end. Elements are 1919taken until `predicate` returns falsey. The predicate is invoked with 1920three arguments: *(value, index, array)*. 1921 1922#### Since 19233.0.0 1924 1925#### Arguments 19261. `array` *(Array)*: The array to query. 19272. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 1928 1929#### Returns 1930*(Array)*: Returns the slice of `array`. 1931 1932#### Example 1933```js 1934var users = [ 1935 { 'user': 'barney', 'active': true }, 1936 { 'user': 'fred', 'active': false }, 1937 { 'user': 'pebbles', 'active': false } 1938]; 1939 1940_.takeRightWhile(users, function(o) { return !o.active; }); 1941// => objects for ['fred', 'pebbles'] 1942 1943// The `_.matches` iteratee shorthand. 1944_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 1945// => objects for ['pebbles'] 1946 1947// The `_.matchesProperty` iteratee shorthand. 1948_.takeRightWhile(users, ['active', false]); 1949// => objects for ['fred', 'pebbles'] 1950 1951// The `_.property` iteratee shorthand. 1952_.takeRightWhile(users, 'active'); 1953// => [] 1954``` 1955--- 1956 1957<!-- /div --> 1958 1959<!-- div --> 1960 1961<h3 id="_takewhilearray-predicate_identity"><code>_.takeWhile(array, [predicate=_.identity])</code></h3> 1962[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8288 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") [Ⓣ][1] 1963 1964Creates a slice of `array` with elements taken from the beginning. Elements 1965are taken until `predicate` returns falsey. The predicate is invoked with 1966three arguments: *(value, index, array)*. 1967 1968#### Since 19693.0.0 1970 1971#### Arguments 19721. `array` *(Array)*: The array to query. 19732. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 1974 1975#### Returns 1976*(Array)*: Returns the slice of `array`. 1977 1978#### Example 1979```js 1980var users = [ 1981 { 'user': 'barney', 'active': false }, 1982 { 'user': 'fred', 'active': false }, 1983 { 'user': 'pebbles', 'active': true } 1984]; 1985 1986_.takeWhile(users, function(o) { return !o.active; }); 1987// => objects for ['barney', 'fred'] 1988 1989// The `_.matches` iteratee shorthand. 1990_.takeWhile(users, { 'user': 'barney', 'active': false }); 1991// => objects for ['barney'] 1992 1993// The `_.matchesProperty` iteratee shorthand. 1994_.takeWhile(users, ['active', false]); 1995// => objects for ['barney', 'fred'] 1996 1997// The `_.property` iteratee shorthand. 1998_.takeWhile(users, 'active'); 1999// => [] 2000``` 2001--- 2002 2003<!-- /div --> 2004 2005<!-- div --> 2006 2007<h3 id="_unionarrays"><code>_.union([arrays])</code></h3> 2008[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8310 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") [Ⓣ][1] 2009 2010Creates an array of unique values, in order, from all given arrays using 2011[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 2012for equality comparisons. 2013 2014#### Since 20150.1.0 2016 2017#### Arguments 20181. `[arrays]` *(...Array)*: The arrays to inspect. 2019 2020#### Returns 2021*(Array)*: Returns the new array of combined values. 2022 2023#### Example 2024```js 2025_.union([2], [1, 2]); 2026// => [2, 1] 2027``` 2028--- 2029 2030<!-- /div --> 2031 2032<!-- div --> 2033 2034<h3 id="_unionbyarrays-iteratee_identity"><code>_.unionBy([arrays], [iteratee=_.identity])</code></h3> 2035[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8337 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package") [Ⓣ][1] 2036 2037This method is like `_.union` except that it accepts `iteratee` which is 2038invoked for each element of each `arrays` to generate the criterion by 2039which uniqueness is computed. Result values are chosen from the first 2040array in which the value occurs. The iteratee is invoked with one argument:<br> 2041*(value)*. 2042 2043#### Since 20444.0.0 2045 2046#### Arguments 20471. `[arrays]` *(...Array)*: The arrays to inspect. 20482. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 2049 2050#### Returns 2051*(Array)*: Returns the new array of combined values. 2052 2053#### Example 2054```js 2055_.unionBy([2.1], [1.2, 2.3], Math.floor); 2056// => [2.1, 1.2] 2057 2058// The `_.property` iteratee shorthand. 2059_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 2060// => [{ 'x': 1 }, { 'x': 2 }] 2061``` 2062--- 2063 2064<!-- /div --> 2065 2066<!-- div --> 2067 2068<h3 id="_unionwitharrays-comparator"><code>_.unionWith([arrays], [comparator])</code></h3> 2069[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8366 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package") [Ⓣ][1] 2070 2071This method is like `_.union` except that it accepts `comparator` which 2072is invoked to compare elements of `arrays`. Result values are chosen from 2073the first array in which the value occurs. The comparator is invoked 2074with two arguments: *(arrVal, othVal)*. 2075 2076#### Since 20774.0.0 2078 2079#### Arguments 20801. `[arrays]` *(...Array)*: The arrays to inspect. 20812. `[comparator]` *(Function)*: The comparator invoked per element. 2082 2083#### Returns 2084*(Array)*: Returns the new array of combined values. 2085 2086#### Example 2087```js 2088var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 2089var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 2090 2091_.unionWith(objects, others, _.isEqual); 2092// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 2093``` 2094--- 2095 2096<!-- /div --> 2097 2098<!-- div --> 2099 2100<h3 id="_uniqarray"><code>_.uniq(array)</code></h3> 2101[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8390 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") [Ⓣ][1] 2102 2103Creates a duplicate-free version of an array, using 2104[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 2105for equality comparisons, in which only the first occurrence of each element 2106is kept. The order of result values is determined by the order they occur 2107in the array. 2108 2109#### Since 21100.1.0 2111 2112#### Arguments 21131. `array` *(Array)*: The array to inspect. 2114 2115#### Returns 2116*(Array)*: Returns the new duplicate free array. 2117 2118#### Example 2119```js 2120_.uniq([2, 1, 2]); 2121// => [2, 1] 2122``` 2123--- 2124 2125<!-- /div --> 2126 2127<!-- div --> 2128 2129<h3 id="_uniqbyarray-iteratee_identity"><code>_.uniqBy(array, [iteratee=_.identity])</code></h3> 2130[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8417 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package") [Ⓣ][1] 2131 2132This method is like `_.uniq` except that it accepts `iteratee` which is 2133invoked for each element in `array` to generate the criterion by which 2134uniqueness is computed. The order of result values is determined by the 2135order they occur in the array. The iteratee is invoked with one argument:<br> 2136*(value)*. 2137 2138#### Since 21394.0.0 2140 2141#### Arguments 21421. `array` *(Array)*: The array to inspect. 21432. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 2144 2145#### Returns 2146*(Array)*: Returns the new duplicate free array. 2147 2148#### Example 2149```js 2150_.uniqBy([2.1, 1.2, 2.3], Math.floor); 2151// => [2.1, 1.2] 2152 2153// The `_.property` iteratee shorthand. 2154_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 2155// => [{ 'x': 1 }, { 'x': 2 }] 2156``` 2157--- 2158 2159<!-- /div --> 2160 2161<!-- div --> 2162 2163<h3 id="_uniqwitharray-comparator"><code>_.uniqWith(array, [comparator])</code></h3> 2164[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8441 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package") [Ⓣ][1] 2165 2166This method is like `_.uniq` except that it accepts `comparator` which 2167is invoked to compare elements of `array`. The order of result values is 2168determined by the order they occur in the array.The comparator is invoked 2169with two arguments: *(arrVal, othVal)*. 2170 2171#### Since 21724.0.0 2173 2174#### Arguments 21751. `array` *(Array)*: The array to inspect. 21762. `[comparator]` *(Function)*: The comparator invoked per element. 2177 2178#### Returns 2179*(Array)*: Returns the new duplicate free array. 2180 2181#### Example 2182```js 2183var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 2184 2185_.uniqWith(objects, _.isEqual); 2186// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 2187``` 2188--- 2189 2190<!-- /div --> 2191 2192<!-- div --> 2193 2194<h3 id="_unziparray"><code>_.unzip(array)</code></h3> 2195[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8465 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") [Ⓣ][1] 2196 2197This method is like `_.zip` except that it accepts an array of grouped 2198elements and creates an array regrouping the elements to their pre-zip 2199configuration. 2200 2201#### Since 22021.2.0 2203 2204#### Arguments 22051. `array` *(Array)*: The array of grouped elements to process. 2206 2207#### Returns 2208*(Array)*: Returns the new array of regrouped elements. 2209 2210#### Example 2211```js 2212var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 2213// => [['a', 1, true], ['b', 2, false]] 2214 2215_.unzip(zipped); 2216// => [['a', 'b'], [1, 2], [true, false]] 2217``` 2218--- 2219 2220<!-- /div --> 2221 2222<!-- div --> 2223 2224<h3 id="_unzipwitharray-iteratee_identity"><code>_.unzipWith(array, [iteratee=_.identity])</code></h3> 2225[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8502 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package") [Ⓣ][1] 2226 2227This method is like `_.unzip` except that it accepts `iteratee` to specify 2228how regrouped values should be combined. The iteratee is invoked with the 2229elements of each group: *(...group)*. 2230 2231#### Since 22323.8.0 2233 2234#### Arguments 22351. `array` *(Array)*: The array of grouped elements to process. 22362. `[iteratee=_.identity]` *(Function)*: The function to combine regrouped values. 2237 2238#### Returns 2239*(Array)*: Returns the new array of regrouped elements. 2240 2241#### Example 2242```js 2243var zipped = _.zip([1, 2], [10, 20], [100, 200]); 2244// => [[1, 10, 100], [2, 20, 200]] 2245 2246_.unzipWith(zipped, _.add); 2247// => [3, 30, 300] 2248``` 2249--- 2250 2251<!-- /div --> 2252 2253<!-- div --> 2254 2255<h3 id="_withoutarray-values"><code>_.without(array, [values])</code></h3> 2256[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8535 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") [Ⓣ][1] 2257 2258Creates an array excluding all given values using 2259[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 2260for equality comparisons. 2261<br> 2262<br> 2263**Note:** Unlike `_.pull`, this method returns a new array. 2264 2265#### Since 22660.1.0 2267 2268#### Arguments 22691. `array` *(Array)*: The array to inspect. 22702. `[values]` *(...*)*: The values to exclude. 2271 2272#### Returns 2273*(Array)*: Returns the new array of filtered values. 2274 2275#### Example 2276```js 2277_.without([2, 1, 2, 3], 1, 2); 2278// => [3] 2279``` 2280--- 2281 2282<!-- /div --> 2283 2284<!-- div --> 2285 2286<h3 id="_xorarrays"><code>_.xor([arrays])</code></h3> 2287[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8559 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") [Ⓣ][1] 2288 2289Creates an array of unique values that is the 2290[symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 2291of the given arrays. The order of result values is determined by the order 2292they occur in the arrays. 2293 2294#### Since 22952.4.0 2296 2297#### Arguments 22981. `[arrays]` *(...Array)*: The arrays to inspect. 2299 2300#### Returns 2301*(Array)*: Returns the new array of filtered values. 2302 2303#### Example 2304```js 2305_.xor([2, 1], [2, 3]); 2306// => [1, 3] 2307``` 2308--- 2309 2310<!-- /div --> 2311 2312<!-- div --> 2313 2314<h3 id="_xorbyarrays-iteratee_identity"><code>_.xorBy([arrays], [iteratee=_.identity])</code></h3> 2315[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8586 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package") [Ⓣ][1] 2316 2317This method is like `_.xor` except that it accepts `iteratee` which is 2318invoked for each element of each `arrays` to generate the criterion by 2319which by which they're compared. The order of result values is determined 2320by the order they occur in the arrays. The iteratee is invoked with one 2321argument: *(value)*. 2322 2323#### Since 23244.0.0 2325 2326#### Arguments 23271. `[arrays]` *(...Array)*: The arrays to inspect. 23282. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 2329 2330#### Returns 2331*(Array)*: Returns the new array of filtered values. 2332 2333#### Example 2334```js 2335_.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 2336// => [1.2, 3.4] 2337 2338// The `_.property` iteratee shorthand. 2339_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 2340// => [{ 'x': 2 }] 2341``` 2342--- 2343 2344<!-- /div --> 2345 2346<!-- div --> 2347 2348<h3 id="_xorwitharrays-comparator"><code>_.xorWith([arrays], [comparator])</code></h3> 2349[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8615 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package") [Ⓣ][1] 2350 2351This method is like `_.xor` except that it accepts `comparator` which is 2352invoked to compare elements of `arrays`. The order of result values is 2353determined by the order they occur in the arrays. The comparator is invoked 2354with two arguments: *(arrVal, othVal)*. 2355 2356#### Since 23574.0.0 2358 2359#### Arguments 23601. `[arrays]` *(...Array)*: The arrays to inspect. 23612. `[comparator]` *(Function)*: The comparator invoked per element. 2362 2363#### Returns 2364*(Array)*: Returns the new array of filtered values. 2365 2366#### Example 2367```js 2368var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 2369var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 2370 2371_.xorWith(objects, others, _.isEqual); 2372// => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 2373``` 2374--- 2375 2376<!-- /div --> 2377 2378<!-- div --> 2379 2380<h3 id="_ziparrays"><code>_.zip([arrays])</code></h3> 2381[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8637 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") [Ⓣ][1] 2382 2383Creates an array of grouped elements, the first of which contains the 2384first elements of the given arrays, the second of which contains the 2385second elements of the given arrays, and so on. 2386 2387#### Since 23880.1.0 2389 2390#### Arguments 23911. `[arrays]` *(...Array)*: The arrays to process. 2392 2393#### Returns 2394*(Array)*: Returns the new array of grouped elements. 2395 2396#### Example 2397```js 2398_.zip(['a', 'b'], [1, 2], [true, false]); 2399// => [['a', 1, true], ['b', 2, false]] 2400``` 2401--- 2402 2403<!-- /div --> 2404 2405<!-- div --> 2406 2407<h3 id="_zipobjectprops-values"><code>_.zipObject([props=[]], [values=[]])</code></h3> 2408[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8655 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") [Ⓣ][1] 2409 2410This method is like `_.fromPairs` except that it accepts two arrays, 2411one of property identifiers and one of corresponding values. 2412 2413#### Since 24140.4.0 2415 2416#### Arguments 24171. `[props=[]]` *(Array)*: The property identifiers. 24182. `[values=[]]` *(Array)*: The property values. 2419 2420#### Returns 2421*(Object)*: Returns the new object. 2422 2423#### Example 2424```js 2425_.zipObject(['a', 'b'], [1, 2]); 2426// => { 'a': 1, 'b': 2 } 2427``` 2428--- 2429 2430<!-- /div --> 2431 2432<!-- div --> 2433 2434<h3 id="_zipobjectdeepprops-values"><code>_.zipObjectDeep([props=[]], [values=[]])</code></h3> 2435[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8674 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package") [Ⓣ][1] 2436 2437This method is like `_.zipObject` except that it supports property paths. 2438 2439#### Since 24404.1.0 2441 2442#### Arguments 24431. `[props=[]]` *(Array)*: The property identifiers. 24442. `[values=[]]` *(Array)*: The property values. 2445 2446#### Returns 2447*(Object)*: Returns the new object. 2448 2449#### Example 2450```js 2451_.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 2452// => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 2453``` 2454--- 2455 2456<!-- /div --> 2457 2458<!-- div --> 2459 2460<h3 id="_zipwitharrays-iteratee_identity"><code>_.zipWith([arrays], [iteratee=_.identity])</code></h3> 2461[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8698 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package") [Ⓣ][1] 2462 2463This method is like `_.zip` except that it accepts `iteratee` to specify 2464how grouped values should be combined. The iteratee is invoked with the 2465elements of each group: *(...group)*. 2466 2467#### Since 24683.8.0 2469 2470#### Arguments 24711. `[arrays]` *(...Array)*: The arrays to process. 24722. `[iteratee=_.identity]` *(Function)*: The function to combine grouped values. 2473 2474#### Returns 2475*(Array)*: Returns the new array of grouped elements. 2476 2477#### Example 2478```js 2479_.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 2480 return a + b + c; 2481}); 2482// => [111, 222] 2483``` 2484--- 2485 2486<!-- /div --> 2487 2488<!-- /div --> 2489 2490<!-- div --> 2491 2492## `“Collection” Methods` 2493 2494<!-- div --> 2495 2496<h3 id="_countbycollection-iteratee_identity"><code>_.countBy(collection, [iteratee=_.identity])</code></h3> 2497[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9077 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") [Ⓣ][1] 2498 2499Creates an object composed of keys generated from the results of running 2500each element of `collection` thru `iteratee`. The corresponding value of 2501each key is the number of times the key was returned by `iteratee`. The 2502iteratee is invoked with one argument: *(value)*. 2503 2504#### Since 25050.5.0 2506 2507#### Arguments 25081. `collection` *(Array|Object)*: The collection to iterate over. 25092. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys. 2510 2511#### Returns 2512*(Object)*: Returns the composed aggregate object. 2513 2514#### Example 2515```js 2516_.countBy([6.1, 4.2, 6.3], Math.floor); 2517// => { '4': 1, '6': 2 } 2518 2519// The `_.property` iteratee shorthand. 2520_.countBy(['one', 'two', 'three'], 'length'); 2521// => { '3': 2, '5': 1 } 2522``` 2523--- 2524 2525<!-- /div --> 2526 2527<!-- div --> 2528 2529<h3 id="_everycollection-predicate_identity"><code>_.every(collection, [predicate=_.identity])</code></h3> 2530[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9126 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") [Ⓣ][1] 2531 2532Checks if `predicate` returns truthy for **all** elements of `collection`. 2533Iteration is stopped once `predicate` returns falsey. The predicate is 2534invoked with three arguments: *(value, index|key, collection)*. 2535<br> 2536<br> 2537**Note:** This method returns `true` for 2538[empty collections](https://en.wikipedia.org/wiki/Empty_set) because 2539[everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 2540elements of empty collections. 2541 2542#### Since 25430.1.0 2544 2545#### Arguments 25461. `collection` *(Array|Object)*: The collection to iterate over. 25472. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 2548 2549#### Returns 2550*(boolean)*: Returns `true` if all elements pass the predicate check, else `false`. 2551 2552#### Example 2553```js 2554_.every([true, 1, null, 'yes'], Boolean); 2555// => false 2556 2557var users = [ 2558 { 'user': 'barney', 'age': 36, 'active': false }, 2559 { 'user': 'fred', 'age': 40, 'active': false } 2560]; 2561 2562// The `_.matches` iteratee shorthand. 2563_.every(users, { 'user': 'barney', 'active': false }); 2564// => false 2565 2566// The `_.matchesProperty` iteratee shorthand. 2567_.every(users, ['active', false]); 2568// => true 2569 2570// The `_.property` iteratee shorthand. 2571_.every(users, 'active'); 2572// => false 2573``` 2574--- 2575 2576<!-- /div --> 2577 2578<!-- div --> 2579 2580<h3 id="_filtercollection-predicate_identity"><code>_.filter(collection, [predicate=_.identity])</code></h3> 2581[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9171 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") [Ⓣ][1] 2582 2583Iterates over elements of `collection`, returning an array of all elements 2584`predicate` returns truthy for. The predicate is invoked with three 2585arguments: *(value, index|key, collection)*. 2586<br> 2587<br> 2588**Note:** Unlike `_.remove`, this method returns a new array. 2589 2590#### Since 25910.1.0 2592 2593#### Arguments 25941. `collection` *(Array|Object)*: The collection to iterate over. 25952. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 2596 2597#### Returns 2598*(Array)*: Returns the new filtered array. 2599 2600#### Example 2601```js 2602var users = [ 2603 { 'user': 'barney', 'age': 36, 'active': true }, 2604 { 'user': 'fred', 'age': 40, 'active': false } 2605]; 2606 2607_.filter(users, function(o) { return !o.active; }); 2608// => objects for ['fred'] 2609 2610// The `_.matches` iteratee shorthand. 2611_.filter(users, { 'age': 36, 'active': true }); 2612// => objects for ['barney'] 2613 2614// The `_.matchesProperty` iteratee shorthand. 2615_.filter(users, ['active', false]); 2616// => objects for ['fred'] 2617 2618// The `_.property` iteratee shorthand. 2619_.filter(users, 'active'); 2620// => objects for ['barney'] 2621``` 2622--- 2623 2624<!-- /div --> 2625 2626<!-- div --> 2627 2628<h3 id="_findcollection-predicate_identity-fromindex0"><code>_.find(collection, [predicate=_.identity], [fromIndex=0])</code></h3> 2629[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9212 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") [Ⓣ][1] 2630 2631Iterates over elements of `collection`, returning the first element 2632`predicate` returns truthy for. The predicate is invoked with three 2633arguments: *(value, index|key, collection)*. 2634 2635#### Since 26360.1.0 2637 2638#### Arguments 26391. `collection` *(Array|Object)*: The collection to inspect. 26402. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 26413. `[fromIndex=0]` *(number)*: The index to search from. 2642 2643#### Returns 2644*(*)*: Returns the matched element, else `undefined`. 2645 2646#### Example 2647```js 2648var users = [ 2649 { 'user': 'barney', 'age': 36, 'active': true }, 2650 { 'user': 'fred', 'age': 40, 'active': false }, 2651 { 'user': 'pebbles', 'age': 1, 'active': true } 2652]; 2653 2654_.find(users, function(o) { return o.age < 40; }); 2655// => object for 'barney' 2656 2657// The `_.matches` iteratee shorthand. 2658_.find(users, { 'age': 1, 'active': true }); 2659// => object for 'pebbles' 2660 2661// The `_.matchesProperty` iteratee shorthand. 2662_.find(users, ['active', false]); 2663// => object for 'fred' 2664 2665// The `_.property` iteratee shorthand. 2666_.find(users, 'active'); 2667// => object for 'barney' 2668``` 2669--- 2670 2671<!-- /div --> 2672 2673<!-- div --> 2674 2675<h3 id="_findlastcollection-predicate_identity-fromindexcollectionlength-1"><code>_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])</code></h3> 2676[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9233 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") [Ⓣ][1] 2677 2678This method is like `_.find` except that it iterates over elements of 2679`collection` from right to left. 2680 2681#### Since 26822.0.0 2683 2684#### Arguments 26851. `collection` *(Array|Object)*: The collection to inspect. 26862. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 26873. `[fromIndex=collection.length-1]` *(number)*: The index to search from. 2688 2689#### Returns 2690*(*)*: Returns the matched element, else `undefined`. 2691 2692#### Example 2693```js 2694_.findLast([1, 2, 3, 4], function(n) { 2695 return n % 2 == 1; 2696}); 2697// => 3 2698``` 2699--- 2700 2701<!-- /div --> 2702 2703<!-- div --> 2704 2705<h3 id="_flatmapcollection-iteratee_identity"><code>_.flatMap(collection, [iteratee=_.identity])</code></h3> 2706[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9256 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package") [Ⓣ][1] 2707 2708Creates a flattened array of values by running each element in `collection` 2709thru `iteratee` and flattening the mapped results. The iteratee is invoked 2710with three arguments: *(value, index|key, collection)*. 2711 2712#### Since 27134.0.0 2714 2715#### Arguments 27161. `collection` *(Array|Object)*: The collection to iterate over. 27172. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 2718 2719#### Returns 2720*(Array)*: Returns the new flattened array. 2721 2722#### Example 2723```js 2724function duplicate(n) { 2725 return [n, n]; 2726} 2727 2728_.flatMap([1, 2], duplicate); 2729// => [1, 1, 2, 2] 2730``` 2731--- 2732 2733<!-- /div --> 2734 2735<!-- div --> 2736 2737<h3 id="_flatmapdeepcollection-iteratee_identity"><code>_.flatMapDeep(collection, [iteratee=_.identity])</code></h3> 2738[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9280 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdeep "See the npm package") [Ⓣ][1] 2739 2740This method is like `_.flatMap` except that it recursively flattens the 2741mapped results. 2742 2743#### Since 27444.7.0 2745 2746#### Arguments 27471. `collection` *(Array|Object)*: The collection to iterate over. 27482. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 2749 2750#### Returns 2751*(Array)*: Returns the new flattened array. 2752 2753#### Example 2754```js 2755function duplicate(n) { 2756 return [[[n, n]]]; 2757} 2758 2759_.flatMapDeep([1, 2], duplicate); 2760// => [1, 1, 2, 2] 2761``` 2762--- 2763 2764<!-- /div --> 2765 2766<!-- div --> 2767 2768<h3 id="_flatmapdepthcollection-iteratee_identity-depth1"><code>_.flatMapDepth(collection, [iteratee=_.identity], [depth=1])</code></h3> 2769[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9305 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdepth "See the npm package") [Ⓣ][1] 2770 2771This method is like `_.flatMap` except that it recursively flattens the 2772mapped results up to `depth` times. 2773 2774#### Since 27754.7.0 2776 2777#### Arguments 27781. `collection` *(Array|Object)*: The collection to iterate over. 27792. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 27803. `[depth=1]` *(number)*: The maximum recursion depth. 2781 2782#### Returns 2783*(Array)*: Returns the new flattened array. 2784 2785#### Example 2786```js 2787function duplicate(n) { 2788 return [[[n, n]]]; 2789} 2790 2791_.flatMapDepth([1, 2], duplicate, 2); 2792// => [[1, 1], [2, 2]] 2793``` 2794--- 2795 2796<!-- /div --> 2797 2798<!-- div --> 2799 2800<h3 id="_foreachcollection-iteratee_identity"><code>_.forEach(collection, [iteratee=_.identity])</code></h3> 2801[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9340 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") [Ⓣ][1] 2802 2803Iterates over elements of `collection` and invokes `iteratee` for each element. 2804The iteratee is invoked with three arguments: *(value, index|key, collection)*. 2805Iteratee functions may exit iteration early by explicitly returning `false`. 2806<br> 2807<br> 2808**Note:** As with other "Collections" methods, objects with a "length" 2809property are iterated like arrays. To avoid this behavior use `_.forIn` 2810or `_.forOwn` for object iteration. 2811 2812#### Since 28130.1.0 2814 2815#### Aliases 2816*_.each* 2817 2818#### Arguments 28191. `collection` *(Array|Object)*: The collection to iterate over. 28202. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 2821 2822#### Returns 2823*(*)*: Returns `collection`. 2824 2825#### Example 2826```js 2827_.forEach([1, 2], function(value) { 2828 console.log(value); 2829}); 2830// => Logs `1` then `2`. 2831 2832_.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 2833 console.log(key); 2834}); 2835// => Logs 'a' then 'b' (iteration order is not guaranteed). 2836``` 2837--- 2838 2839<!-- /div --> 2840 2841<!-- div --> 2842 2843<h3 id="_foreachrightcollection-iteratee_identity"><code>_.forEachRight(collection, [iteratee=_.identity])</code></h3> 2844[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9365 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") [Ⓣ][1] 2845 2846This method is like `_.forEach` except that it iterates over elements of 2847`collection` from right to left. 2848 2849#### Since 28502.0.0 2851 2852#### Aliases 2853*_.eachRight* 2854 2855#### Arguments 28561. `collection` *(Array|Object)*: The collection to iterate over. 28572. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 2858 2859#### Returns 2860*(*)*: Returns `collection`. 2861 2862#### Example 2863```js 2864_.forEachRight([1, 2], function(value) { 2865 console.log(value); 2866}); 2867// => Logs `2` then `1`. 2868``` 2869--- 2870 2871<!-- /div --> 2872 2873<!-- div --> 2874 2875<h3 id="_groupbycollection-iteratee_identity"><code>_.groupBy(collection, [iteratee=_.identity])</code></h3> 2876[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9393 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") [Ⓣ][1] 2877 2878Creates an object composed of keys generated from the results of running 2879each element of `collection` thru `iteratee`. The order of grouped values 2880is determined by the order they occur in `collection`. The corresponding 2881value of each key is an array of elements responsible for generating the 2882key. The iteratee is invoked with one argument: *(value)*. 2883 2884#### Since 28850.1.0 2886 2887#### Arguments 28881. `collection` *(Array|Object)*: The collection to iterate over. 28892. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys. 2890 2891#### Returns 2892*(Object)*: Returns the composed aggregate object. 2893 2894#### Example 2895```js 2896_.groupBy([6.1, 4.2, 6.3], Math.floor); 2897// => { '4': [4.2], '6': [6.1, 6.3] } 2898 2899// The `_.property` iteratee shorthand. 2900_.groupBy(['one', 'two', 'three'], 'length'); 2901// => { '3': ['one', 'two'], '5': ['three'] } 2902``` 2903--- 2904 2905<!-- /div --> 2906 2907<!-- div --> 2908 2909<h3 id="_includescollection-value-fromindex0"><code>_.includes(collection, value, [fromIndex=0])</code></h3> 2910[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9431 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") [Ⓣ][1] 2911 2912Checks if `value` is in `collection`. If `collection` is a string, it's 2913checked for a substring of `value`, otherwise 2914[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 2915is used for equality comparisons. If `fromIndex` is negative, it's used as 2916the offset from the end of `collection`. 2917 2918#### Since 29190.1.0 2920 2921#### Arguments 29221. `collection` *(Array|Object|string)*: The collection to inspect. 29232. `value` *(*)*: The value to search for. 29243. `[fromIndex=0]` *(number)*: The index to search from. 2925 2926#### Returns 2927*(boolean)*: Returns `true` if `value` is found, else `false`. 2928 2929#### Example 2930```js 2931_.includes([1, 2, 3], 1); 2932// => true 2933 2934_.includes([1, 2, 3], 1, 2); 2935// => false 2936 2937_.includes({ 'a': 1, 'b': 2 }, 1); 2938// => true 2939 2940_.includes('abcd', 'bc'); 2941// => true 2942``` 2943--- 2944 2945<!-- /div --> 2946 2947<!-- div --> 2948 2949<h3 id="_invokemapcollection-path-args"><code>_.invokeMap(collection, path, [args])</code></h3> 2950[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9467 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package") [Ⓣ][1] 2951 2952Invokes the method at `path` of each element in `collection`, returning 2953an array of the results of each invoked method. Any additional arguments 2954are provided to each invoked method. If `path` is a function, it's invoked 2955for, and `this` bound to, each element in `collection`. 2956 2957#### Since 29584.0.0 2959 2960#### Arguments 29611. `collection` *(Array|Object)*: The collection to iterate over. 29622. `path` *(Array|Function|string)*: The path of the method to invoke or the function invoked per iteration. 29633. `[args]` *(...*)*: The arguments to invoke each method with. 2964 2965#### Returns 2966*(Array)*: Returns the array of results. 2967 2968#### Example 2969```js 2970_.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 2971// => [[1, 5, 7], [1, 2, 3]] 2972 2973_.invokeMap([123, 456], String.prototype.split, ''); 2974// => [['1', '2', '3'], ['4', '5', '6']] 2975``` 2976--- 2977 2978<!-- /div --> 2979 2980<!-- div --> 2981 2982<h3 id="_keybycollection-iteratee_identity"><code>_.keyBy(collection, [iteratee=_.identity])</code></h3> 2983[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9506 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package") [Ⓣ][1] 2984 2985Creates an object composed of keys generated from the results of running 2986each element of `collection` thru `iteratee`. The corresponding value of 2987each key is the last element responsible for generating the key. The 2988iteratee is invoked with one argument: *(value)*. 2989 2990#### Since 29914.0.0 2992 2993#### Arguments 29941. `collection` *(Array|Object)*: The collection to iterate over. 29952. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys. 2996 2997#### Returns 2998*(Object)*: Returns the composed aggregate object. 2999 3000#### Example 3001```js 3002var array = [ 3003 { 'dir': 'left', 'code': 97 }, 3004 { 'dir': 'right', 'code': 100 } 3005]; 3006 3007_.keyBy(array, function(o) { 3008 return String.fromCharCode(o.code); 3009}); 3010// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 3011 3012_.keyBy(array, 'dir'); 3013// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 3014``` 3015--- 3016 3017<!-- /div --> 3018 3019<!-- div --> 3020 3021<h3 id="_mapcollection-iteratee_identity"><code>_.map(collection, [iteratee=_.identity])</code></h3> 3022[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9552 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") [Ⓣ][1] 3023 3024Creates an array of values by running each element in `collection` thru 3025`iteratee`. The iteratee is invoked with three arguments:<br> 3026*(value, index|key, collection)*. 3027<br> 3028<br> 3029Many lodash methods are guarded to work as iteratees for methods like 3030`_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 3031<br> 3032<br> 3033The guarded methods are:<br> 3034`ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 3035`fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 3036`sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 3037`template`, `trim`, `trimEnd`, `trimStart`, and `words` 3038 3039#### Since 30400.1.0 3041 3042#### Arguments 30431. `collection` *(Array|Object)*: The collection to iterate over. 30442. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 3045 3046#### Returns 3047*(Array)*: Returns the new mapped array. 3048 3049#### Example 3050```js 3051function square(n) { 3052 return n * n; 3053} 3054 3055_.map([4, 8], square); 3056// => [16, 64] 3057 3058_.map({ 'a': 4, 'b': 8 }, square); 3059// => [16, 64] (iteration order is not guaranteed) 3060 3061var users = [ 3062 { 'user': 'barney' }, 3063 { 'user': 'fred' } 3064]; 3065 3066// The `_.property` iteratee shorthand. 3067_.map(users, 'user'); 3068// => ['barney', 'fred'] 3069``` 3070--- 3071 3072<!-- /div --> 3073 3074<!-- div --> 3075 3076<h3 id="_orderbycollection-iteratees_identity-orders"><code>_.orderBy(collection, [iteratees=[_.identity]], [orders])</code></h3> 3077[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9586 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package") [Ⓣ][1] 3078 3079This method is like `_.sortBy` except that it allows specifying the sort 3080orders of the iteratees to sort by. If `orders` is unspecified, all values 3081are sorted in ascending order. Otherwise, specify an order of "desc" for 3082descending or "asc" for ascending sort order of corresponding values. 3083 3084#### Since 30854.0.0 3086 3087#### Arguments 30881. `collection` *(Array|Object)*: The collection to iterate over. 30892. `[iteratees=[_.identity]]` *(Array[]|Function[]|Object[]|string[])*: The iteratees to sort by. 30903. `[orders]` *(string[])*: The sort orders of `iteratees`. 3091 3092#### Returns 3093*(Array)*: Returns the new sorted array. 3094 3095#### Example 3096```js 3097var users = [ 3098 { 'user': 'fred', 'age': 48 }, 3099 { 'user': 'barney', 'age': 34 }, 3100 { 'user': 'fred', 'age': 40 }, 3101 { 'user': 'barney', 'age': 36 } 3102]; 3103 3104// Sort by `user` in ascending order and by `age` in descending order. 3105_.orderBy(users, ['user', 'age'], ['asc', 'desc']); 3106// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 3107``` 3108--- 3109 3110<!-- /div --> 3111 3112<!-- div --> 3113 3114<h3 id="_partitioncollection-predicate_identity"><code>_.partition(collection, [predicate=_.identity])</code></h3> 3115[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9636 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") [Ⓣ][1] 3116 3117Creates an array of elements split into two groups, the first of which 3118contains elements `predicate` returns truthy for, the second of which 3119contains elements `predicate` returns falsey for. The predicate is 3120invoked with one argument: *(value)*. 3121 3122#### Since 31233.0.0 3124 3125#### Arguments 31261. `collection` *(Array|Object)*: The collection to iterate over. 31272. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 3128 3129#### Returns 3130*(Array)*: Returns the array of grouped elements. 3131 3132#### Example 3133```js 3134var users = [ 3135 { 'user': 'barney', 'age': 36, 'active': false }, 3136 { 'user': 'fred', 'age': 40, 'active': true }, 3137 { 'user': 'pebbles', 'age': 1, 'active': false } 3138]; 3139 3140_.partition(users, function(o) { return o.active; }); 3141// => objects for [['fred'], ['barney', 'pebbles']] 3142 3143// The `_.matches` iteratee shorthand. 3144_.partition(users, { 'age': 1, 'active': false }); 3145// => objects for [['pebbles'], ['barney', 'fred']] 3146 3147// The `_.matchesProperty` iteratee shorthand. 3148_.partition(users, ['active', false]); 3149// => objects for [['barney', 'pebbles'], ['fred']] 3150 3151// The `_.property` iteratee shorthand. 3152_.partition(users, 'active'); 3153// => objects for [['fred'], ['barney', 'pebbles']] 3154``` 3155--- 3156 3157<!-- /div --> 3158 3159<!-- div --> 3160 3161<h3 id="_reducecollection-iteratee_identity-accumulator"><code>_.reduce(collection, [iteratee=_.identity], [accumulator])</code></h3> 3162[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9677 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") [Ⓣ][1] 3163 3164Reduces `collection` to a value which is the accumulated result of running 3165each element in `collection` thru `iteratee`, where each successive 3166invocation is supplied the return value of the previous. If `accumulator` 3167is not given, the first element of `collection` is used as the initial 3168value. The iteratee is invoked with four arguments:<br> 3169*(accumulator, value, index|key, collection)*. 3170<br> 3171<br> 3172Many lodash methods are guarded to work as iteratees for methods like 3173`_.reduce`, `_.reduceRight`, and `_.transform`. 3174<br> 3175<br> 3176The guarded methods are:<br> 3177`assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 3178and `sortBy` 3179 3180#### Since 31810.1.0 3182 3183#### Arguments 31841. `collection` *(Array|Object)*: The collection to iterate over. 31852. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 31863. `[accumulator]` *(*)*: The initial value. 3187 3188#### Returns 3189*(*)*: Returns the accumulated value. 3190 3191#### Example 3192```js 3193_.reduce([1, 2], function(sum, n) { 3194 return sum + n; 3195}, 0); 3196// => 3 3197 3198_.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 3199 (result[value] || (result[value] = [])).push(key); 3200 return result; 3201}, {}); 3202// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 3203``` 3204--- 3205 3206<!-- /div --> 3207 3208<!-- div --> 3209 3210<h3 id="_reducerightcollection-iteratee_identity-accumulator"><code>_.reduceRight(collection, [iteratee=_.identity], [accumulator])</code></h3> 3211[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9706 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") [Ⓣ][1] 3212 3213This method is like `_.reduce` except that it iterates over elements of 3214`collection` from right to left. 3215 3216#### Since 32170.1.0 3218 3219#### Arguments 32201. `collection` *(Array|Object)*: The collection to iterate over. 32212. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 32223. `[accumulator]` *(*)*: The initial value. 3223 3224#### Returns 3225*(*)*: Returns the accumulated value. 3226 3227#### Example 3228```js 3229var array = [[0, 1], [2, 3], [4, 5]]; 3230 3231_.reduceRight(array, function(flattened, other) { 3232 return flattened.concat(other); 3233}, []); 3234// => [4, 5, 2, 3, 0, 1] 3235``` 3236--- 3237 3238<!-- /div --> 3239 3240<!-- div --> 3241 3242<h3 id="_rejectcollection-predicate_identity"><code>_.reject(collection, [predicate=_.identity])</code></h3> 3243[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9747 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") [Ⓣ][1] 3244 3245The opposite of `_.filter`; this method returns the elements of `collection` 3246that `predicate` does **not** return truthy for. 3247 3248#### Since 32490.1.0 3250 3251#### Arguments 32521. `collection` *(Array|Object)*: The collection to iterate over. 32532. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 3254 3255#### Returns 3256*(Array)*: Returns the new filtered array. 3257 3258#### Example 3259```js 3260var users = [ 3261 { 'user': 'barney', 'age': 36, 'active': false }, 3262 { 'user': 'fred', 'age': 40, 'active': true } 3263]; 3264 3265_.reject(users, function(o) { return !o.active; }); 3266// => objects for ['fred'] 3267 3268// The `_.matches` iteratee shorthand. 3269_.reject(users, { 'age': 40, 'active': true }); 3270// => objects for ['barney'] 3271 3272// The `_.matchesProperty` iteratee shorthand. 3273_.reject(users, ['active', false]); 3274// => objects for ['fred'] 3275 3276// The `_.property` iteratee shorthand. 3277_.reject(users, 'active'); 3278// => objects for ['barney'] 3279``` 3280--- 3281 3282<!-- /div --> 3283 3284<!-- div --> 3285 3286<h3 id="_samplecollection"><code>_.sample(collection)</code></h3> 3287[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9766 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") [Ⓣ][1] 3288 3289Gets a random element from `collection`. 3290 3291#### Since 32922.0.0 3293 3294#### Arguments 32951. `collection` *(Array|Object)*: The collection to sample. 3296 3297#### Returns 3298*(*)*: Returns the random element. 3299 3300#### Example 3301```js 3302_.sample([1, 2, 3, 4]); 3303// => 2 3304``` 3305--- 3306 3307<!-- /div --> 3308 3309<!-- div --> 3310 3311<h3 id="_samplesizecollection-n1"><code>_.sampleSize(collection, [n=1])</code></h3> 3312[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9791 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package") [Ⓣ][1] 3313 3314Gets `n` random elements at unique keys from `collection` up to the 3315size of `collection`. 3316 3317#### Since 33184.0.0 3319 3320#### Arguments 33211. `collection` *(Array|Object)*: The collection to sample. 33222. `[n=1]` *(number)*: The number of elements to sample. 3323 3324#### Returns 3325*(Array)*: Returns the random elements. 3326 3327#### Example 3328```js 3329_.sampleSize([1, 2, 3], 2); 3330// => [3, 1] 3331 3332_.sampleSize([1, 2, 3], 4); 3333// => [2, 3, 1] 3334``` 3335--- 3336 3337<!-- /div --> 3338 3339<!-- div --> 3340 3341<h3 id="_shufflecollection"><code>_.shuffle(collection)</code></h3> 3342[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9816 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") [Ⓣ][1] 3343 3344Creates an array of shuffled values, using a version of the 3345[Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 3346 3347#### Since 33480.1.0 3349 3350#### Arguments 33511. `collection` *(Array|Object)*: The collection to shuffle. 3352 3353#### Returns 3354*(Array)*: Returns the new shuffled array. 3355 3356#### Example 3357```js 3358_.shuffle([1, 2, 3, 4]); 3359// => [4, 1, 3, 2] 3360``` 3361--- 3362 3363<!-- /div --> 3364 3365<!-- div --> 3366 3367<h3 id="_sizecollection"><code>_.size(collection)</code></h3> 3368[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9842 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") [Ⓣ][1] 3369 3370Gets the size of `collection` by returning its length for array-like 3371values or the number of own enumerable string keyed properties for objects. 3372 3373#### Since 33740.1.0 3375 3376#### Arguments 33771. `collection` *(Array|Object|string)*: The collection to inspect. 3378 3379#### Returns 3380*(number)*: Returns the collection size. 3381 3382#### Example 3383```js 3384_.size([1, 2, 3]); 3385// => 3 3386 3387_.size({ 'a': 1, 'b': 2 }); 3388// => 2 3389 3390_.size('pebbles'); 3391// => 7 3392``` 3393--- 3394 3395<!-- /div --> 3396 3397<!-- div --> 3398 3399<h3 id="_somecollection-predicate_identity"><code>_.some(collection, [predicate=_.identity])</code></h3> 3400[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9892 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") [Ⓣ][1] 3401 3402Checks if `predicate` returns truthy for **any** element of `collection`. 3403Iteration is stopped once `predicate` returns truthy. The predicate is 3404invoked with three arguments: *(value, index|key, collection)*. 3405 3406#### Since 34070.1.0 3408 3409#### Arguments 34101. `collection` *(Array|Object)*: The collection to iterate over. 34112. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 3412 3413#### Returns 3414*(boolean)*: Returns `true` if any element passes the predicate check, else `false`. 3415 3416#### Example 3417```js 3418_.some([null, 0, 'yes', false], Boolean); 3419// => true 3420 3421var users = [ 3422 { 'user': 'barney', 'active': true }, 3423 { 'user': 'fred', 'active': false } 3424]; 3425 3426// The `_.matches` iteratee shorthand. 3427_.some(users, { 'user': 'barney', 'active': false }); 3428// => false 3429 3430// The `_.matchesProperty` iteratee shorthand. 3431_.some(users, ['active', false]); 3432// => true 3433 3434// The `_.property` iteratee shorthand. 3435_.some(users, 'active'); 3436// => true 3437``` 3438--- 3439 3440<!-- /div --> 3441 3442<!-- div --> 3443 3444<h3 id="_sortbycollection-iteratees_identity"><code>_.sortBy(collection, [iteratees=[_.identity]])</code></h3> 3445[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9929 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") [Ⓣ][1] 3446 3447Creates an array of elements, sorted in ascending order by the results of 3448running each element in a collection thru each iteratee. This method 3449performs a stable sort, that is, it preserves the original sort order of 3450equal elements. The iteratees are invoked with one argument: *(value)*. 3451 3452#### Since 34530.1.0 3454 3455#### Arguments 34561. `collection` *(Array|Object)*: The collection to iterate over. 34572. `[iteratees=[_.identity]]` *(...(Function|Function[]))*: The iteratees to sort by. 3458 3459#### Returns 3460*(Array)*: Returns the new sorted array. 3461 3462#### Example 3463```js 3464var users = [ 3465 { 'user': 'fred', 'age': 48 }, 3466 { 'user': 'barney', 'age': 36 }, 3467 { 'user': 'fred', 'age': 40 }, 3468 { 'user': 'barney', 'age': 34 } 3469]; 3470 3471_.sortBy(users, [function(o) { return o.user; }]); 3472// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 3473 3474_.sortBy(users, ['user', 'age']); 3475// => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] 3476``` 3477--- 3478 3479<!-- /div --> 3480 3481<!-- /div --> 3482 3483<!-- div --> 3484 3485## `“Date” Methods` 3486 3487<!-- div --> 3488 3489<h3 id="_now"><code>_.now()</code></h3> 3490[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9960 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") [Ⓣ][1] 3491 3492Gets the timestamp of the number of milliseconds that have elapsed since 3493the Unix epoch *(1 January `1970 00`:00:00 UTC)*. 3494 3495#### Since 34962.4.0 3497 3498#### Returns 3499*(number)*: Returns the timestamp. 3500 3501#### Example 3502```js 3503_.defer(function(stamp) { 3504 console.log(_.now() - stamp); 3505}, _.now()); 3506// => Logs the number of milliseconds it took for the deferred invocation. 3507``` 3508--- 3509 3510<!-- /div --> 3511 3512<!-- /div --> 3513 3514<!-- div --> 3515 3516## `“Function” Methods` 3517 3518<!-- div --> 3519 3520<h3 id="_aftern-func"><code>_.after(n, func)</code></h3> 3521[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9990 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") [Ⓣ][1] 3522 3523The opposite of `_.before`; this method creates a function that invokes 3524`func` once it's called `n` or more times. 3525 3526#### Since 35270.1.0 3528 3529#### Arguments 35301. `n` *(number)*: The number of calls before `func` is invoked. 35312. `func` *(Function)*: The function to restrict. 3532 3533#### Returns 3534*(Function)*: Returns the new restricted function. 3535 3536#### Example 3537```js 3538var saves = ['profile', 'settings']; 3539 3540var done = _.after(saves.length, function() { 3541 console.log('done saving!'); 3542}); 3543 3544_.forEach(saves, function(type) { 3545 asyncSave({ 'type': type, 'complete': done }); 3546}); 3547// => Logs 'done saving!' after the two async saves have completed. 3548``` 3549--- 3550 3551<!-- /div --> 3552 3553<!-- div --> 3554 3555<h3 id="_aryfunc-nfunclength"><code>_.ary(func, [n=func.length])</code></h3> 3556[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10019 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") [Ⓣ][1] 3557 3558Creates a function that invokes `func`, with up to `n` arguments, 3559ignoring any additional arguments. 3560 3561#### Since 35623.0.0 3563 3564#### Arguments 35651. `func` *(Function)*: The function to cap arguments for. 35662. `[n=func.length]` *(number)*: The arity cap. 3567 3568#### Returns 3569*(Function)*: Returns the new capped function. 3570 3571#### Example 3572```js 3573_.map(['6', '8', '10'], _.ary(parseInt, 1)); 3574// => [6, 8, 10] 3575``` 3576--- 3577 3578<!-- /div --> 3579 3580<!-- div --> 3581 3582<h3 id="_beforen-func"><code>_.before(n, func)</code></h3> 3583[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10042 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") [Ⓣ][1] 3584 3585Creates a function that invokes `func`, with the `this` binding and arguments 3586of the created function, while it's called less than `n` times. Subsequent 3587calls to the created function return the result of the last `func` invocation. 3588 3589#### Since 35903.0.0 3591 3592#### Arguments 35931. `n` *(number)*: The number of calls at which `func` is no longer invoked. 35942. `func` *(Function)*: The function to restrict. 3595 3596#### Returns 3597*(Function)*: Returns the new restricted function. 3598 3599#### Example 3600```js 3601jQuery(element).on('click', _.before(5, addContactToList)); 3602// => Allows adding up to 4 contacts to the list. 3603``` 3604--- 3605 3606<!-- /div --> 3607 3608<!-- div --> 3609 3610<h3 id="_bindfunc-thisarg-partials"><code>_.bind(func, thisArg, [partials])</code></h3> 3611[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10094 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") [Ⓣ][1] 3612 3613Creates a function that invokes `func` with the `this` binding of `thisArg` 3614and `partials` prepended to the arguments it receives. 3615<br> 3616<br> 3617The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 3618may be used as a placeholder for partially applied arguments. 3619<br> 3620<br> 3621**Note:** Unlike native `Function#bind`, this method doesn't set the "length" 3622property of bound functions. 3623 3624#### Since 36250.1.0 3626 3627#### Arguments 36281. `func` *(Function)*: The function to bind. 36292. `thisArg` *(*)*: The `this` binding of `func`. 36303. `[partials]` *(...*)*: The arguments to be partially applied. 3631 3632#### Returns 3633*(Function)*: Returns the new bound function. 3634 3635#### Example 3636```js 3637function greet(greeting, punctuation) { 3638 return greeting + ' ' + this.user + punctuation; 3639} 3640 3641var object = { 'user': 'fred' }; 3642 3643var bound = _.bind(greet, object, 'hi'); 3644bound('!'); 3645// => 'hi fred!' 3646 3647// Bound with placeholders. 3648var bound = _.bind(greet, object, _, '!'); 3649bound('hi'); 3650// => 'hi fred!' 3651``` 3652--- 3653 3654<!-- /div --> 3655 3656<!-- div --> 3657 3658<h3 id="_bindkeyobject-key-partials"><code>_.bindKey(object, key, [partials])</code></h3> 3659[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10148 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") [Ⓣ][1] 3660 3661Creates a function that invokes the method at `object[key]` with `partials` 3662prepended to the arguments it receives. 3663<br> 3664<br> 3665This method differs from `_.bind` by allowing bound functions to reference 3666methods that may be redefined or don't yet exist. See 3667[Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 3668for more details. 3669<br> 3670<br> 3671The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 3672builds, may be used as a placeholder for partially applied arguments. 3673 3674#### Since 36750.10.0 3676 3677#### Arguments 36781. `object` *(Object)*: The object to invoke the method on. 36792. `key` *(string)*: The key of the method. 36803. `[partials]` *(...*)*: The arguments to be partially applied. 3681 3682#### Returns 3683*(Function)*: Returns the new bound function. 3684 3685#### Example 3686```js 3687var object = { 3688 'user': 'fred', 3689 'greet': function(greeting, punctuation) { 3690 return greeting + ' ' + this.user + punctuation; 3691 } 3692}; 3693 3694var bound = _.bindKey(object, 'greet', 'hi'); 3695bound('!'); 3696// => 'hi fred!' 3697 3698object.greet = function(greeting, punctuation) { 3699 return greeting + 'ya ' + this.user + punctuation; 3700}; 3701 3702bound('!'); 3703// => 'hiya fred!' 3704 3705// Bound with placeholders. 3706var bound = _.bindKey(object, 'greet', _, '!'); 3707bound('hi'); 3708// => 'hiya fred!' 3709``` 3710--- 3711 3712<!-- /div --> 3713 3714<!-- div --> 3715 3716<h3 id="_curryfunc-arityfunclength"><code>_.curry(func, [arity=func.length])</code></h3> 3717[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10198 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") [Ⓣ][1] 3718 3719Creates a function that accepts arguments of `func` and either invokes 3720`func` returning its result, if at least `arity` number of arguments have 3721been provided, or returns a function that accepts the remaining `func` 3722arguments, and so on. The arity of `func` may be specified if `func.length` 3723is not sufficient. 3724<br> 3725<br> 3726The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 3727may be used as a placeholder for provided arguments. 3728<br> 3729<br> 3730**Note:** This method doesn't set the "length" property of curried functions. 3731 3732#### Since 37332.0.0 3734 3735#### Arguments 37361. `func` *(Function)*: The function to curry. 37372. `[arity=func.length]` *(number)*: The arity of `func`. 3738 3739#### Returns 3740*(Function)*: Returns the new curried function. 3741 3742#### Example 3743```js 3744var abc = function(a, b, c) { 3745 return [a, b, c]; 3746}; 3747 3748var curried = _.curry(abc); 3749 3750curried(1)(2)(3); 3751// => [1, 2, 3] 3752 3753curried(1, 2)(3); 3754// => [1, 2, 3] 3755 3756curried(1, 2, 3); 3757// => [1, 2, 3] 3758 3759// Curried with placeholders. 3760curried(1)(_, 3)(2); 3761// => [1, 2, 3] 3762``` 3763--- 3764 3765<!-- /div --> 3766 3767<!-- div --> 3768 3769<h3 id="_curryrightfunc-arityfunclength"><code>_.curryRight(func, [arity=func.length])</code></h3> 3770[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10243 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") [Ⓣ][1] 3771 3772This method is like `_.curry` except that arguments are applied to `func` 3773in the manner of `_.partialRight` instead of `_.partial`. 3774<br> 3775<br> 3776The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 3777builds, may be used as a placeholder for provided arguments. 3778<br> 3779<br> 3780**Note:** This method doesn't set the "length" property of curried functions. 3781 3782#### Since 37833.0.0 3784 3785#### Arguments 37861. `func` *(Function)*: The function to curry. 37872. `[arity=func.length]` *(number)*: The arity of `func`. 3788 3789#### Returns 3790*(Function)*: Returns the new curried function. 3791 3792#### Example 3793```js 3794var abc = function(a, b, c) { 3795 return [a, b, c]; 3796}; 3797 3798var curried = _.curryRight(abc); 3799 3800curried(3)(2)(1); 3801// => [1, 2, 3] 3802 3803curried(2, 3)(1); 3804// => [1, 2, 3] 3805 3806curried(1, 2, 3); 3807// => [1, 2, 3] 3808 3809// Curried with placeholders. 3810curried(3)(1, _)(2); 3811// => [1, 2, 3] 3812``` 3813--- 3814 3815<!-- /div --> 3816 3817<!-- div --> 3818 3819<h3 id="_debouncefunc-wait0-options"><code>_.debounce(func, [wait=0], [options={}])</code></h3> 3820[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10304 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") [Ⓣ][1] 3821 3822Creates a debounced function that delays invoking `func` until after `wait` 3823milliseconds have elapsed since the last time the debounced function was 3824invoked. The debounced function comes with a `cancel` method to cancel 3825delayed `func` invocations and a `flush` method to immediately invoke them. 3826Provide `options` to indicate whether `func` should be invoked on the 3827leading and/or trailing edge of the `wait` timeout. The `func` is invoked 3828with the last arguments provided to the debounced function. Subsequent 3829calls to the debounced function return the result of the last `func` 3830invocation. 3831<br> 3832<br> 3833**Note:** If `leading` and `trailing` options are `true`, `func` is 3834invoked on the trailing edge of the timeout only if the debounced function 3835is invoked more than once during the `wait` timeout. 3836<br> 3837<br> 3838If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 3839until to the next tick, similar to `setTimeout` with a timeout of `0`. 3840<br> 3841<br> 3842See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 3843for details over the differences between `_.debounce` and `_.throttle`. 3844 3845#### Since 38460.1.0 3847 3848#### Arguments 38491. `func` *(Function)*: The function to debounce. 38502. `[wait=0]` *(number)*: The number of milliseconds to delay. 38513. `[options={}]` *(Object)*: The options object. 38524. `[options.leading=false]` *(boolean)*: Specify invoking on the leading edge of the timeout. 38535. `[options.maxWait]` *(number)*: The maximum time `func` is allowed to be delayed before it's invoked. 38546. `[options.trailing=true]` *(boolean)*: Specify invoking on the trailing edge of the timeout. 3855 3856#### Returns 3857*(Function)*: Returns the new debounced function. 3858 3859#### Example 3860```js 3861// Avoid costly calculations while the window size is in flux. 3862jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 3863 3864// Invoke `sendMail` when clicked, debouncing subsequent calls. 3865jQuery(element).on('click', _.debounce(sendMail, 300, { 3866 'leading': true, 3867 'trailing': false 3868})); 3869 3870// Ensure `batchLog` is invoked once after 1 second of debounced calls. 3871var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 3872var source = new EventSource('/stream'); 3873jQuery(source).on('message', debounced); 3874 3875// Cancel the trailing debounced invocation. 3876jQuery(window).on('popstate', debounced.cancel); 3877``` 3878--- 3879 3880<!-- /div --> 3881 3882<!-- div --> 3883 3884<h3 id="_deferfunc-args"><code>_.defer(func, [args])</code></h3> 3885[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10447 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") [Ⓣ][1] 3886 3887Defers invoking the `func` until the current call stack has cleared. Any 3888additional arguments are provided to `func` when it's invoked. 3889 3890#### Since 38910.1.0 3892 3893#### Arguments 38941. `func` *(Function)*: The function to defer. 38952. `[args]` *(...*)*: The arguments to invoke `func` with. 3896 3897#### Returns 3898*(number)*: Returns the timer id. 3899 3900#### Example 3901```js 3902_.defer(function(text) { 3903 console.log(text); 3904}, 'deferred'); 3905// => Logs 'deferred' after one millisecond. 3906``` 3907--- 3908 3909<!-- /div --> 3910 3911<!-- div --> 3912 3913<h3 id="_delayfunc-wait-args"><code>_.delay(func, wait, [args])</code></h3> 3914[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10470 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") [Ⓣ][1] 3915 3916Invokes `func` after `wait` milliseconds. Any additional arguments are 3917provided to `func` when it's invoked. 3918 3919#### Since 39200.1.0 3921 3922#### Arguments 39231. `func` *(Function)*: The function to delay. 39242. `wait` *(number)*: The number of milliseconds to delay invocation. 39253. `[args]` *(...*)*: The arguments to invoke `func` with. 3926 3927#### Returns 3928*(number)*: Returns the timer id. 3929 3930#### Example 3931```js 3932_.delay(function(text) { 3933 console.log(text); 3934}, 1000, 'later'); 3935// => Logs 'later' after one second. 3936``` 3937--- 3938 3939<!-- /div --> 3940 3941<!-- div --> 3942 3943<h3 id="_flipfunc"><code>_.flip(func)</code></h3> 3944[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10492 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package") [Ⓣ][1] 3945 3946Creates a function that invokes `func` with arguments reversed. 3947 3948#### Since 39494.0.0 3950 3951#### Arguments 39521. `func` *(Function)*: The function to flip arguments for. 3953 3954#### Returns 3955*(Function)*: Returns the new flipped function. 3956 3957#### Example 3958```js 3959var flipped = _.flip(function() { 3960 return _.toArray(arguments); 3961}); 3962 3963flipped('a', 'b', 'c', 'd'); 3964// => ['d', 'c', 'b', 'a'] 3965``` 3966--- 3967 3968<!-- /div --> 3969 3970<!-- div --> 3971 3972<h3 id="_memoizefunc-resolver"><code>_.memoize(func, [resolver])</code></h3> 3973[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10540 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") [Ⓣ][1] 3974 3975Creates a function that memoizes the result of `func`. If `resolver` is 3976provided, it determines the cache key for storing the result based on the 3977arguments provided to the memoized function. By default, the first argument 3978provided to the memoized function is used as the map cache key. The `func` 3979is invoked with the `this` binding of the memoized function. 3980<br> 3981<br> 3982**Note:** The cache is exposed as the `cache` property on the memoized 3983function. Its creation may be customized by replacing the `_.memoize.Cache` 3984constructor with one whose instances implement the 3985[`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 3986method interface of `clear`, `delete`, `get`, `has`, and `set`. 3987 3988#### Since 39890.1.0 3990 3991#### Arguments 39921. `func` *(Function)*: The function to have its output memoized. 39932. `[resolver]` *(Function)*: The function to resolve the cache key. 3994 3995#### Returns 3996*(Function)*: Returns the new memoized function. 3997 3998#### Example 3999```js 4000var object = { 'a': 1, 'b': 2 }; 4001var other = { 'c': 3, 'd': 4 }; 4002 4003var values = _.memoize(_.values); 4004values(object); 4005// => [1, 2] 4006 4007values(other); 4008// => [3, 4] 4009 4010object.a = 2; 4011values(object); 4012// => [1, 2] 4013 4014// Modify the result cache. 4015values.cache.set(object, ['a', 'b']); 4016values(object); 4017// => ['a', 'b'] 4018 4019// Replace `_.memoize.Cache`. 4020_.memoize.Cache = WeakMap; 4021``` 4022--- 4023 4024<!-- /div --> 4025 4026<!-- div --> 4027 4028<h3 id="_negatepredicate"><code>_.negate(predicate)</code></h3> 4029[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10583 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") [Ⓣ][1] 4030 4031Creates a function that negates the result of the predicate `func`. The 4032`func` predicate is invoked with the `this` binding and arguments of the 4033created function. 4034 4035#### Since 40363.0.0 4037 4038#### Arguments 40391. `predicate` *(Function)*: The predicate to negate. 4040 4041#### Returns 4042*(Function)*: Returns the new negated function. 4043 4044#### Example 4045```js 4046function isEven(n) { 4047 return n % 2 == 0; 4048} 4049 4050_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 4051// => [1, 3, 5] 4052``` 4053--- 4054 4055<!-- /div --> 4056 4057<!-- div --> 4058 4059<h3 id="_oncefunc"><code>_.once(func)</code></h3> 4060[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10617 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") [Ⓣ][1] 4061 4062Creates a function that is restricted to invoking `func` once. Repeat calls 4063to the function return the value of the first invocation. The `func` is 4064invoked with the `this` binding and arguments of the created function. 4065 4066#### Since 40670.1.0 4068 4069#### Arguments 40701. `func` *(Function)*: The function to restrict. 4071 4072#### Returns 4073*(Function)*: Returns the new restricted function. 4074 4075#### Example 4076```js 4077var initialize = _.once(createApplication); 4078initialize(); 4079initialize(); 4080// => `createApplication` is invoked once 4081``` 4082--- 4083 4084<!-- /div --> 4085 4086<!-- div --> 4087 4088<h3 id="_overargsfunc-transforms_identity"><code>_.overArgs(func, [transforms=[_.identity]])</code></h3> 4089[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10652 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package") [Ⓣ][1] 4090 4091Creates a function that invokes `func` with its arguments transformed. 4092 4093#### Since 40944.0.0 4095 4096#### Arguments 40971. `func` *(Function)*: The function to wrap. 40982. `[transforms=[_.identity]]` *(...(Function|Function[]))*: The argument transforms. 4099 4100#### Returns 4101*(Function)*: Returns the new function. 4102 4103#### Example 4104```js 4105function doubled(n) { 4106 return n * 2; 4107} 4108 4109function square(n) { 4110 return n * n; 4111} 4112 4113var func = _.overArgs(function(x, y) { 4114 return [x, y]; 4115}, [square, doubled]); 4116 4117func(9, 3); 4118// => [81, 6] 4119 4120func(10, 5); 4121// => [100, 10] 4122``` 4123--- 4124 4125<!-- /div --> 4126 4127<!-- div --> 4128 4129<h3 id="_partialfunc-partials"><code>_.partial(func, [partials])</code></h3> 4130[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10702 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") [Ⓣ][1] 4131 4132Creates a function that invokes `func` with `partials` prepended to the 4133arguments it receives. This method is like `_.bind` except it does **not** 4134alter the `this` binding. 4135<br> 4136<br> 4137The `_.partial.placeholder` value, which defaults to `_` in monolithic 4138builds, may be used as a placeholder for partially applied arguments. 4139<br> 4140<br> 4141**Note:** This method doesn't set the "length" property of partially 4142applied functions. 4143 4144#### Since 41450.2.0 4146 4147#### Arguments 41481. `func` *(Function)*: The function to partially apply arguments to. 41492. `[partials]` *(...*)*: The arguments to be partially applied. 4150 4151#### Returns 4152*(Function)*: Returns the new partially applied function. 4153 4154#### Example 4155```js 4156function greet(greeting, name) { 4157 return greeting + ' ' + name; 4158} 4159 4160var sayHelloTo = _.partial(greet, 'hello'); 4161sayHelloTo('fred'); 4162// => 'hello fred' 4163 4164// Partially applied with placeholders. 4165var greetFred = _.partial(greet, _, 'fred'); 4166greetFred('hi'); 4167// => 'hi fred' 4168``` 4169--- 4170 4171<!-- /div --> 4172 4173<!-- div --> 4174 4175<h3 id="_partialrightfunc-partials"><code>_.partialRight(func, [partials])</code></h3> 4176[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10739 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") [Ⓣ][1] 4177 4178This method is like `_.partial` except that partially applied arguments 4179are appended to the arguments it receives. 4180<br> 4181<br> 4182The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 4183builds, may be used as a placeholder for partially applied arguments. 4184<br> 4185<br> 4186**Note:** This method doesn't set the "length" property of partially 4187applied functions. 4188 4189#### Since 41901.0.0 4191 4192#### Arguments 41931. `func` *(Function)*: The function to partially apply arguments to. 41942. `[partials]` *(...*)*: The arguments to be partially applied. 4195 4196#### Returns 4197*(Function)*: Returns the new partially applied function. 4198 4199#### Example 4200```js 4201function greet(greeting, name) { 4202 return greeting + ' ' + name; 4203} 4204 4205var greetFred = _.partialRight(greet, 'fred'); 4206greetFred('hi'); 4207// => 'hi fred' 4208 4209// Partially applied with placeholders. 4210var sayHelloTo = _.partialRight(greet, 'hello', _); 4211sayHelloTo('fred'); 4212// => 'hello fred' 4213``` 4214--- 4215 4216<!-- /div --> 4217 4218<!-- div --> 4219 4220<h3 id="_reargfunc-indexes"><code>_.rearg(func, indexes)</code></h3> 4221[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10766 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") [Ⓣ][1] 4222 4223Creates a function that invokes `func` with arguments arranged according 4224to the specified `indexes` where the argument value at the first index is 4225provided as the first argument, the argument value at the second index is 4226provided as the second argument, and so on. 4227 4228#### Since 42293.0.0 4230 4231#### Arguments 42321. `func` *(Function)*: The function to rearrange arguments for. 42332. `indexes` *(...(number|number[]))*: The arranged argument indexes. 4234 4235#### Returns 4236*(Function)*: Returns the new function. 4237 4238#### Example 4239```js 4240var rearged = _.rearg(function(a, b, c) { 4241 return [a, b, c]; 4242}, [2, 0, 1]); 4243 4244rearged('b', 'c', 'a') 4245// => ['a', 'b', 'c'] 4246``` 4247--- 4248 4249<!-- /div --> 4250 4251<!-- div --> 4252 4253<h3 id="_restfunc-startfunclength-1"><code>_.rest(func, [start=func.length-1])</code></h3> 4254[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10795 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") [Ⓣ][1] 4255 4256Creates a function that invokes `func` with the `this` binding of the 4257created function and arguments from `start` and beyond provided as 4258an array. 4259<br> 4260<br> 4261**Note:** This method is based on the 4262[rest parameter](https://mdn.io/rest_parameters). 4263 4264#### Since 42654.0.0 4266 4267#### Arguments 42681. `func` *(Function)*: The function to apply a rest parameter to. 42692. `[start=func.length-1]` *(number)*: The start position of the rest parameter. 4270 4271#### Returns 4272*(Function)*: Returns the new function. 4273 4274#### Example 4275```js 4276var say = _.rest(function(what, names) { 4277 return what + ' ' + _.initial(names).join(', ') + 4278 (_.size(names) > 1 ? ', & ' : '') + _.last(names); 4279}); 4280 4281say('hello', 'fred', 'barney', 'pebbles'); 4282// => 'hello fred, barney, & pebbles' 4283``` 4284--- 4285 4286<!-- /div --> 4287 4288<!-- div --> 4289 4290<h3 id="_spreadfunc-start0"><code>_.spread(func, [start=0])</code></h3> 4291[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10837 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") [Ⓣ][1] 4292 4293Creates a function that invokes `func` with the `this` binding of the 4294create function and an array of arguments much like 4295[`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 4296<br> 4297<br> 4298**Note:** This method is based on the 4299[spread operator](https://mdn.io/spread_operator). 4300 4301#### Since 43023.2.0 4303 4304#### Arguments 43051. `func` *(Function)*: The function to spread arguments over. 43062. `[start=0]` *(number)*: The start position of the spread. 4307 4308#### Returns 4309*(Function)*: Returns the new function. 4310 4311#### Example 4312```js 4313var say = _.spread(function(who, what) { 4314 return who + ' says ' + what; 4315}); 4316 4317say(['fred', 'hello']); 4318// => 'fred says hello' 4319 4320var numbers = Promise.all([ 4321 Promise.resolve(40), 4322 Promise.resolve(36) 4323]); 4324 4325numbers.then(_.spread(function(x, y) { 4326 return x + y; 4327})); 4328// => a Promise of 76 4329``` 4330--- 4331 4332<!-- /div --> 4333 4334<!-- div --> 4335 4336<h3 id="_throttlefunc-wait0-options"><code>_.throttle(func, [wait=0], [options={}])</code></h3> 4337[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10897 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") [Ⓣ][1] 4338 4339Creates a throttled function that only invokes `func` at most once per 4340every `wait` milliseconds. The throttled function comes with a `cancel` 4341method to cancel delayed `func` invocations and a `flush` method to 4342immediately invoke them. Provide `options` to indicate whether `func` 4343should be invoked on the leading and/or trailing edge of the `wait` 4344timeout. The `func` is invoked with the last arguments provided to the 4345throttled function. Subsequent calls to the throttled function return the 4346result of the last `func` invocation. 4347<br> 4348<br> 4349**Note:** If `leading` and `trailing` options are `true`, `func` is 4350invoked on the trailing edge of the timeout only if the throttled function 4351is invoked more than once during the `wait` timeout. 4352<br> 4353<br> 4354If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 4355until to the next tick, similar to `setTimeout` with a timeout of `0`. 4356<br> 4357<br> 4358See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 4359for details over the differences between `_.throttle` and `_.debounce`. 4360 4361#### Since 43620.1.0 4363 4364#### Arguments 43651. `func` *(Function)*: The function to throttle. 43662. `[wait=0]` *(number)*: The number of milliseconds to throttle invocations to. 43673. `[options={}]` *(Object)*: The options object. 43684. `[options.leading=true]` *(boolean)*: Specify invoking on the leading edge of the timeout. 43695. `[options.trailing=true]` *(boolean)*: Specify invoking on the trailing edge of the timeout. 4370 4371#### Returns 4372*(Function)*: Returns the new throttled function. 4373 4374#### Example 4375```js 4376// Avoid excessively updating the position while scrolling. 4377jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 4378 4379// Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 4380var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 4381jQuery(element).on('click', throttled); 4382 4383// Cancel the trailing throttled invocation. 4384jQuery(window).on('popstate', throttled.cancel); 4385``` 4386--- 4387 4388<!-- /div --> 4389 4390<!-- div --> 4391 4392<h3 id="_unaryfunc"><code>_.unary(func)</code></h3> 4393[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10930 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package") [Ⓣ][1] 4394 4395Creates a function that accepts up to one argument, ignoring any 4396additional arguments. 4397 4398#### Since 43994.0.0 4400 4401#### Arguments 44021. `func` *(Function)*: The function to cap arguments for. 4403 4404#### Returns 4405*(Function)*: Returns the new capped function. 4406 4407#### Example 4408```js 4409_.map(['6', '8', '10'], _.unary(parseInt)); 4410// => [6, 8, 10] 4411``` 4412--- 4413 4414<!-- /div --> 4415 4416<!-- div --> 4417 4418<h3 id="_wrapvalue-wrapperidentity"><code>_.wrap(value, [wrapper=identity])</code></h3> 4419[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10956 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") [Ⓣ][1] 4420 4421Creates a function that provides `value` to `wrapper` as its first 4422argument. Any additional arguments provided to the function are appended 4423to those provided to the `wrapper`. The wrapper is invoked with the `this` 4424binding of the created function. 4425 4426#### Since 44270.1.0 4428 4429#### Arguments 44301. `value` *(*)*: The value to wrap. 44312. `[wrapper=identity]` *(Function)*: The wrapper function. 4432 4433#### Returns 4434*(Function)*: Returns the new function. 4435 4436#### Example 4437```js 4438var p = _.wrap(_.escape, function(func, text) { 4439 return '<p>' + func(text) + '</p>'; 4440}); 4441 4442p('fred, barney, & pebbles'); 4443// => '<p>fred, barney, & pebbles</p>' 4444``` 4445--- 4446 4447<!-- /div --> 4448 4449<!-- /div --> 4450 4451<!-- div --> 4452 4453## `“Lang” Methods` 4454 4455<!-- div --> 4456 4457<h3 id="_castarrayvalue"><code>_.castArray(value)</code></h3> 4458[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L10995 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.castarray "See the npm package") [Ⓣ][1] 4459 4460Casts `value` as an array if it's not one. 4461 4462#### Since 44634.4.0 4464 4465#### Arguments 44661. `value` *(*)*: The value to inspect. 4467 4468#### Returns 4469*(Array)*: Returns the cast array. 4470 4471#### Example 4472```js 4473_.castArray(1); 4474// => [1] 4475 4476_.castArray({ 'a': 1 }); 4477// => [{ 'a': 1 }] 4478 4479_.castArray('abc'); 4480// => ['abc'] 4481 4482_.castArray(null); 4483// => [null] 4484 4485_.castArray(undefined); 4486// => [undefined] 4487 4488_.castArray(); 4489// => [] 4490 4491var array = [1, 2, 3]; 4492console.log(_.castArray(array) === array); 4493// => true 4494``` 4495--- 4496 4497<!-- /div --> 4498 4499<!-- div --> 4500 4501<h3 id="_clonevalue"><code>_.clone(value)</code></h3> 4502[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11029 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") [Ⓣ][1] 4503 4504Creates a shallow clone of `value`. 4505<br> 4506<br> 4507**Note:** This method is loosely based on the 4508[structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 4509and supports cloning arrays, array buffers, booleans, date objects, maps, 4510numbers, `Object` objects, regexes, sets, strings, symbols, and typed 4511arrays. The own enumerable properties of `arguments` objects are cloned 4512as plain objects. An empty object is returned for uncloneable values such 4513as error objects, functions, DOM nodes, and WeakMaps. 4514 4515#### Since 45160.1.0 4517 4518#### Arguments 45191. `value` *(*)*: The value to clone. 4520 4521#### Returns 4522*(*)*: Returns the cloned value. 4523 4524#### Example 4525```js 4526var objects = [{ 'a': 1 }, { 'b': 2 }]; 4527 4528var shallow = _.clone(objects); 4529console.log(shallow[0] === objects[0]); 4530// => true 4531``` 4532--- 4533 4534<!-- /div --> 4535 4536<!-- div --> 4537 4538<h3 id="_clonedeepvalue"><code>_.cloneDeep(value)</code></h3> 4539[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11087 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") [Ⓣ][1] 4540 4541This method is like `_.clone` except that it recursively clones `value`. 4542 4543#### Since 45441.0.0 4545 4546#### Arguments 45471. `value` *(*)*: The value to recursively clone. 4548 4549#### Returns 4550*(*)*: Returns the deep cloned value. 4551 4552#### Example 4553```js 4554var objects = [{ 'a': 1 }, { 'b': 2 }]; 4555 4556var deep = _.cloneDeep(objects); 4557console.log(deep[0] === objects[0]); 4558// => false 4559``` 4560--- 4561 4562<!-- /div --> 4563 4564<!-- div --> 4565 4566<h3 id="_clonedeepwithvalue-customizer"><code>_.cloneDeepWith(value, [customizer])</code></h3> 4567[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11119 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package") [Ⓣ][1] 4568 4569This method is like `_.cloneWith` except that it recursively clones `value`. 4570 4571#### Since 45724.0.0 4573 4574#### Arguments 45751. `value` *(*)*: The value to recursively clone. 45762. `[customizer]` *(Function)*: The function to customize cloning. 4577 4578#### Returns 4579*(*)*: Returns the deep cloned value. 4580 4581#### Example 4582```js 4583function customizer(value) { 4584 if (_.isElement(value)) { 4585 return value.cloneNode(true); 4586 } 4587} 4588 4589var el = _.cloneDeepWith(document.body, customizer); 4590 4591console.log(el === document.body); 4592// => false 4593console.log(el.nodeName); 4594// => 'BODY' 4595console.log(el.childNodes.length); 4596// => 20 4597``` 4598--- 4599 4600<!-- /div --> 4601 4602<!-- div --> 4603 4604<h3 id="_clonewithvalue-customizer"><code>_.cloneWith(value, [customizer])</code></h3> 4605[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11064 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package") [Ⓣ][1] 4606 4607This method is like `_.clone` except that it accepts `customizer` which 4608is invoked to produce the cloned value. If `customizer` returns `undefined`, 4609cloning is handled by the method instead. The `customizer` is invoked with 4610up to four arguments; *(value [, index|key, object, stack])*. 4611 4612#### Since 46134.0.0 4614 4615#### Arguments 46161. `value` *(*)*: The value to clone. 46172. `[customizer]` *(Function)*: The function to customize cloning. 4618 4619#### Returns 4620*(*)*: Returns the cloned value. 4621 4622#### Example 4623```js 4624function customizer(value) { 4625 if (_.isElement(value)) { 4626 return value.cloneNode(false); 4627 } 4628} 4629 4630var el = _.cloneWith(document.body, customizer); 4631 4632console.log(el === document.body); 4633// => false 4634console.log(el.nodeName); 4635// => 'BODY' 4636console.log(el.childNodes.length); 4637// => 0 4638``` 4639--- 4640 4641<!-- /div --> 4642 4643<!-- div --> 4644 4645<h3 id="_conformstoobject-source"><code>_.conformsTo(object, source)</code></h3> 4646[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11148 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.conformsto "See the npm package") [Ⓣ][1] 4647 4648Checks if `object` conforms to `source` by invoking the predicate 4649properties of `source` with the corresponding property values of `object`. 4650<br> 4651<br> 4652**Note:** This method is equivalent to `_.conforms` when `source` is 4653partially applied. 4654 4655#### Since 46564.14.0 4657 4658#### Arguments 46591. `object` *(Object)*: The object to inspect. 46602. `source` *(Object)*: The object of property predicates to conform to. 4661 4662#### Returns 4663*(boolean)*: Returns `true` if `object` conforms, else `false`. 4664 4665#### Example 4666```js 4667var object = { 'a': 1, 'b': 2 }; 4668 4669_.conformsTo(object, { 'b': function(n) { return n > 1; } }); 4670// => true 4671 4672_.conformsTo(object, { 'b': function(n) { return n > 2; } }); 4673// => false 4674``` 4675--- 4676 4677<!-- /div --> 4678 4679<!-- div --> 4680 4681<h3 id="_eqvalue-other"><code>_.eq(value, other)</code></h3> 4682[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11184 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package") [Ⓣ][1] 4683 4684Performs a 4685[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 4686comparison between two values to determine if they are equivalent. 4687 4688#### Since 46894.0.0 4690 4691#### Arguments 46921. `value` *(*)*: The value to compare. 46932. `other` *(*)*: The other value to compare. 4694 4695#### Returns 4696*(boolean)*: Returns `true` if the values are equivalent, else `false`. 4697 4698#### Example 4699```js 4700var object = { 'a': 1 }; 4701var other = { 'a': 1 }; 4702 4703_.eq(object, object); 4704// => true 4705 4706_.eq(object, other); 4707// => false 4708 4709_.eq('a', 'a'); 4710// => true 4711 4712_.eq('a', Object('a')); 4713// => false 4714 4715_.eq(NaN, NaN); 4716// => true 4717``` 4718--- 4719 4720<!-- /div --> 4721 4722<!-- div --> 4723 4724<h3 id="_gtvalue-other"><code>_.gt(value, other)</code></h3> 4725[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11211 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package") [Ⓣ][1] 4726 4727Checks if `value` is greater than `other`. 4728 4729#### Since 47303.9.0 4731 4732#### Arguments 47331. `value` *(*)*: The value to compare. 47342. `other` *(*)*: The other value to compare. 4735 4736#### Returns 4737*(boolean)*: Returns `true` if `value` is greater than `other`, else `false`. 4738 4739#### Example 4740```js 4741_.gt(3, 1); 4742// => true 4743 4744_.gt(3, 3); 4745// => false 4746 4747_.gt(1, 3); 4748// => false 4749``` 4750--- 4751 4752<!-- /div --> 4753 4754<!-- div --> 4755 4756<h3 id="_gtevalue-other"><code>_.gte(value, other)</code></h3> 4757[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11236 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package") [Ⓣ][1] 4758 4759Checks if `value` is greater than or equal to `other`. 4760 4761#### Since 47623.9.0 4763 4764#### Arguments 47651. `value` *(*)*: The value to compare. 47662. `other` *(*)*: The other value to compare. 4767 4768#### Returns 4769*(boolean)*: Returns `true` if `value` is greater than or equal to `other`, else `false`. 4770 4771#### Example 4772```js 4773_.gte(3, 1); 4774// => true 4775 4776_.gte(3, 3); 4777// => true 4778 4779_.gte(1, 3); 4780// => false 4781``` 4782--- 4783 4784<!-- /div --> 4785 4786<!-- div --> 4787 4788<h3 id="_isargumentsvalue"><code>_.isArguments(value)</code></h3> 4789[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11258 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") [Ⓣ][1] 4790 4791Checks if `value` is likely an `arguments` object. 4792 4793#### Since 47940.1.0 4795 4796#### Arguments 47971. `value` *(*)*: The value to check. 4798 4799#### Returns 4800*(boolean)*: Returns `true` if `value` is an `arguments` object, else `false`. 4801 4802#### Example 4803```js 4804_.isArguments(function() { return arguments; }()); 4805// => true 4806 4807_.isArguments([1, 2, 3]); 4808// => false 4809``` 4810--- 4811 4812<!-- /div --> 4813 4814<!-- div --> 4815 4816<h3 id="_isarrayvalue"><code>_.isArray(value)</code></h3> 4817[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11286 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") [Ⓣ][1] 4818 4819Checks if `value` is classified as an `Array` object. 4820 4821#### Since 48220.1.0 4823 4824#### Arguments 48251. `value` *(*)*: The value to check. 4826 4827#### Returns 4828*(boolean)*: Returns `true` if `value` is an array, else `false`. 4829 4830#### Example 4831```js 4832_.isArray([1, 2, 3]); 4833// => true 4834 4835_.isArray(document.body.children); 4836// => false 4837 4838_.isArray('abc'); 4839// => false 4840 4841_.isArray(_.noop); 4842// => false 4843``` 4844--- 4845 4846<!-- /div --> 4847 4848<!-- div --> 4849 4850<h3 id="_isarraybuffervalue"><code>_.isArrayBuffer(value)</code></h3> 4851[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11305 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraybuffer "See the npm package") [Ⓣ][1] 4852 4853Checks if `value` is classified as an `ArrayBuffer` object. 4854 4855#### Since 48564.3.0 4857 4858#### Arguments 48591. `value` *(*)*: The value to check. 4860 4861#### Returns 4862*(boolean)*: Returns `true` if `value` is an array buffer, else `false`. 4863 4864#### Example 4865```js 4866_.isArrayBuffer(new ArrayBuffer(2)); 4867// => true 4868 4869_.isArrayBuffer(new Array(2)); 4870// => false 4871``` 4872--- 4873 4874<!-- /div --> 4875 4876<!-- div --> 4877 4878<h3 id="_isarraylikevalue"><code>_.isArrayLike(value)</code></h3> 4879[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11332 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package") [Ⓣ][1] 4880 4881Checks if `value` is array-like. A value is considered array-like if it's 4882not a function and has a `value.length` that's an integer greater than or 4883equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 4884 4885#### Since 48864.0.0 4887 4888#### Arguments 48891. `value` *(*)*: The value to check. 4890 4891#### Returns 4892*(boolean)*: Returns `true` if `value` is array-like, else `false`. 4893 4894#### Example 4895```js 4896_.isArrayLike([1, 2, 3]); 4897// => true 4898 4899_.isArrayLike(document.body.children); 4900// => true 4901 4902_.isArrayLike('abc'); 4903// => true 4904 4905_.isArrayLike(_.noop); 4906// => false 4907``` 4908--- 4909 4910<!-- /div --> 4911 4912<!-- div --> 4913 4914<h3 id="_isarraylikeobjectvalue"><code>_.isArrayLikeObject(value)</code></h3> 4915[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11361 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package") [Ⓣ][1] 4916 4917This method is like `_.isArrayLike` except that it also checks if `value` 4918is an object. 4919 4920#### Since 49214.0.0 4922 4923#### Arguments 49241. `value` *(*)*: The value to check. 4925 4926#### Returns 4927*(boolean)*: Returns `true` if `value` is an array-like object, else `false`. 4928 4929#### Example 4930```js 4931_.isArrayLikeObject([1, 2, 3]); 4932// => true 4933 4934_.isArrayLikeObject(document.body.children); 4935// => true 4936 4937_.isArrayLikeObject('abc'); 4938// => false 4939 4940_.isArrayLikeObject(_.noop); 4941// => false 4942``` 4943--- 4944 4945<!-- /div --> 4946 4947<!-- div --> 4948 4949<h3 id="_isbooleanvalue"><code>_.isBoolean(value)</code></h3> 4950[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11382 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") [Ⓣ][1] 4951 4952Checks if `value` is classified as a boolean primitive or object. 4953 4954#### Since 49550.1.0 4956 4957#### Arguments 49581. `value` *(*)*: The value to check. 4959 4960#### Returns 4961*(boolean)*: Returns `true` if `value` is a boolean, else `false`. 4962 4963#### Example 4964```js 4965_.isBoolean(false); 4966// => true 4967 4968_.isBoolean(null); 4969// => false 4970``` 4971--- 4972 4973<!-- /div --> 4974 4975<!-- div --> 4976 4977<h3 id="_isbuffervalue"><code>_.isBuffer(value)</code></h3> 4978[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11404 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isbuffer "See the npm package") [Ⓣ][1] 4979 4980Checks if `value` is a buffer. 4981 4982#### Since 49834.3.0 4984 4985#### Arguments 49861. `value` *(*)*: The value to check. 4987 4988#### Returns 4989*(boolean)*: Returns `true` if `value` is a buffer, else `false`. 4990 4991#### Example 4992```js 4993_.isBuffer(new Buffer(2)); 4994// => true 4995 4996_.isBuffer(new Uint8Array(2)); 4997// => false 4998``` 4999--- 5000 5001<!-- /div --> 5002 5003<!-- div --> 5004 5005<h3 id="_isdatevalue"><code>_.isDate(value)</code></h3> 5006[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11423 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") [Ⓣ][1] 5007 5008Checks if `value` is classified as a `Date` object. 5009 5010#### Since 50110.1.0 5012 5013#### Arguments 50141. `value` *(*)*: The value to check. 5015 5016#### Returns 5017*(boolean)*: Returns `true` if `value` is a date object, else `false`. 5018 5019#### Example 5020```js 5021_.isDate(new Date); 5022// => true 5023 5024_.isDate('Mon April 23 2012'); 5025// => false 5026``` 5027--- 5028 5029<!-- /div --> 5030 5031<!-- div --> 5032 5033<h3 id="_iselementvalue"><code>_.isElement(value)</code></h3> 5034[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11442 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") [Ⓣ][1] 5035 5036Checks if `value` is likely a DOM element. 5037 5038#### Since 50390.1.0 5040 5041#### Arguments 50421. `value` *(*)*: The value to check. 5043 5044#### Returns 5045*(boolean)*: Returns `true` if `value` is a DOM element, else `false`. 5046 5047#### Example 5048```js 5049_.isElement(document.body); 5050// => true 5051 5052_.isElement('<body>'); 5053// => false 5054``` 5055--- 5056 5057<!-- /div --> 5058 5059<!-- div --> 5060 5061<h3 id="_isemptyvalue"><code>_.isEmpty(value)</code></h3> 5062[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11479 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") [Ⓣ][1] 5063 5064Checks if `value` is an empty object, collection, map, or set. 5065<br> 5066<br> 5067Objects are considered empty if they have no own enumerable string keyed 5068properties. 5069<br> 5070<br> 5071Array-like values such as `arguments` objects, arrays, buffers, strings, or 5072jQuery-like collections are considered empty if they have a `length` of `0`. 5073Similarly, maps and sets are considered empty if they have a `size` of `0`. 5074 5075#### Since 50760.1.0 5077 5078#### Arguments 50791. `value` *(*)*: The value to check. 5080 5081#### Returns 5082*(boolean)*: Returns `true` if `value` is empty, else `false`. 5083 5084#### Example 5085```js 5086_.isEmpty(null); 5087// => true 5088 5089_.isEmpty(true); 5090// => true 5091 5092_.isEmpty(1); 5093// => true 5094 5095_.isEmpty([1, 2, 3]); 5096// => false 5097 5098_.isEmpty({ 'a': 1 }); 5099// => false 5100``` 5101--- 5102 5103<!-- /div --> 5104 5105<!-- div --> 5106 5107<h3 id="_isequalvalue-other"><code>_.isEqual(value, other)</code></h3> 5108[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11531 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") [Ⓣ][1] 5109 5110Performs a deep comparison between two values to determine if they are 5111equivalent. 5112<br> 5113<br> 5114**Note:** This method supports comparing arrays, array buffers, booleans, 5115date objects, error objects, maps, numbers, `Object` objects, regexes, 5116sets, strings, symbols, and typed arrays. `Object` objects are compared 5117by their own, not inherited, enumerable properties. Functions and DOM 5118nodes are compared by strict equality, i.e. `===`. 5119 5120#### Since 51210.1.0 5122 5123#### Arguments 51241. `value` *(*)*: The value to compare. 51252. `other` *(*)*: The other value to compare. 5126 5127#### Returns 5128*(boolean)*: Returns `true` if the values are equivalent, else `false`. 5129 5130#### Example 5131```js 5132var object = { 'a': 1 }; 5133var other = { 'a': 1 }; 5134 5135_.isEqual(object, other); 5136// => true 5137 5138object === other; 5139// => false 5140``` 5141--- 5142 5143<!-- /div --> 5144 5145<!-- div --> 5146 5147<h3 id="_isequalwithvalue-other-customizer"><code>_.isEqualWith(value, other, [customizer])</code></h3> 5148[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11567 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package") [Ⓣ][1] 5149 5150This method is like `_.isEqual` except that it accepts `customizer` which 5151is invoked to compare values. If `customizer` returns `undefined`, comparisons 5152are handled by the method instead. The `customizer` is invoked with up to 5153six arguments: *(objValue, othValue [, index|key, object, other, stack])*. 5154 5155#### Since 51564.0.0 5157 5158#### Arguments 51591. `value` *(*)*: The value to compare. 51602. `other` *(*)*: The other value to compare. 51613. `[customizer]` *(Function)*: The function to customize comparisons. 5162 5163#### Returns 5164*(boolean)*: Returns `true` if the values are equivalent, else `false`. 5165 5166#### Example 5167```js 5168function isGreeting(value) { 5169 return /^h(?:i|ello)$/.test(value); 5170} 5171 5172function customizer(objValue, othValue) { 5173 if (isGreeting(objValue) && isGreeting(othValue)) { 5174 return true; 5175 } 5176} 5177 5178var array = ['hello', 'goodbye']; 5179var other = ['hi', 'goodbye']; 5180 5181_.isEqualWith(array, other, customizer); 5182// => true 5183``` 5184--- 5185 5186<!-- /div --> 5187 5188<!-- div --> 5189 5190<h3 id="_iserrorvalue"><code>_.isError(value)</code></h3> 5191[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11591 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") [Ⓣ][1] 5192 5193Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 5194`SyntaxError`, `TypeError`, or `URIError` object. 5195 5196#### Since 51973.0.0 5198 5199#### Arguments 52001. `value` *(*)*: The value to check. 5201 5202#### Returns 5203*(boolean)*: Returns `true` if `value` is an error object, else `false`. 5204 5205#### Example 5206```js 5207_.isError(new Error); 5208// => true 5209 5210_.isError(Error); 5211// => false 5212``` 5213--- 5214 5215<!-- /div --> 5216 5217<!-- div --> 5218 5219<h3 id="_isfinitevalue"><code>_.isFinite(value)</code></h3> 5220[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11626 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") [Ⓣ][1] 5221 5222Checks if `value` is a finite primitive number. 5223<br> 5224<br> 5225**Note:** This method is based on 5226[`Number.isFinite`](https://mdn.io/Number/isFinite). 5227 5228#### Since 52290.1.0 5230 5231#### Arguments 52321. `value` *(*)*: The value to check. 5233 5234#### Returns 5235*(boolean)*: Returns `true` if `value` is a finite number, else `false`. 5236 5237#### Example 5238```js 5239_.isFinite(3); 5240// => true 5241 5242_.isFinite(Number.MIN_VALUE); 5243// => true 5244 5245_.isFinite(Infinity); 5246// => false 5247 5248_.isFinite('3'); 5249// => false 5250``` 5251--- 5252 5253<!-- /div --> 5254 5255<!-- div --> 5256 5257<h3 id="_isfunctionvalue"><code>_.isFunction(value)</code></h3> 5258[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11647 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") [Ⓣ][1] 5259 5260Checks if `value` is classified as a `Function` object. 5261 5262#### Since 52630.1.0 5264 5265#### Arguments 52661. `value` *(*)*: The value to check. 5267 5268#### Returns 5269*(boolean)*: Returns `true` if `value` is a function, else `false`. 5270 5271#### Example 5272```js 5273_.isFunction(_); 5274// => true 5275 5276_.isFunction(/abc/); 5277// => false 5278``` 5279--- 5280 5281<!-- /div --> 5282 5283<!-- div --> 5284 5285<h3 id="_isintegervalue"><code>_.isInteger(value)</code></h3> 5286[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11683 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package") [Ⓣ][1] 5287 5288Checks if `value` is an integer. 5289<br> 5290<br> 5291**Note:** This method is based on 5292[`Number.isInteger`](https://mdn.io/Number/isInteger). 5293 5294#### Since 52954.0.0 5296 5297#### Arguments 52981. `value` *(*)*: The value to check. 5299 5300#### Returns 5301*(boolean)*: Returns `true` if `value` is an integer, else `false`. 5302 5303#### Example 5304```js 5305_.isInteger(3); 5306// => true 5307 5308_.isInteger(Number.MIN_VALUE); 5309// => false 5310 5311_.isInteger(Infinity); 5312// => false 5313 5314_.isInteger('3'); 5315// => false 5316``` 5317--- 5318 5319<!-- /div --> 5320 5321<!-- div --> 5322 5323<h3 id="_islengthvalue"><code>_.isLength(value)</code></h3> 5324[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11713 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package") [Ⓣ][1] 5325 5326Checks if `value` is a valid array-like length. 5327<br> 5328<br> 5329**Note:** This method is loosely based on 5330[`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 5331 5332#### Since 53334.0.0 5334 5335#### Arguments 53361. `value` *(*)*: The value to check. 5337 5338#### Returns 5339*(boolean)*: Returns `true` if `value` is a valid length, else `false`. 5340 5341#### Example 5342```js 5343_.isLength(3); 5344// => true 5345 5346_.isLength(Number.MIN_VALUE); 5347// => false 5348 5349_.isLength(Infinity); 5350// => false 5351 5352_.isLength('3'); 5353// => false 5354``` 5355--- 5356 5357<!-- /div --> 5358 5359<!-- div --> 5360 5361<h3 id="_ismapvalue"><code>_.isMap(value)</code></h3> 5362[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11793 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismap "See the npm package") [Ⓣ][1] 5363 5364Checks if `value` is classified as a `Map` object. 5365 5366#### Since 53674.3.0 5368 5369#### Arguments 53701. `value` *(*)*: The value to check. 5371 5372#### Returns 5373*(boolean)*: Returns `true` if `value` is a map, else `false`. 5374 5375#### Example 5376```js 5377_.isMap(new Map); 5378// => true 5379 5380_.isMap(new WeakMap); 5381// => false 5382``` 5383--- 5384 5385<!-- /div --> 5386 5387<!-- div --> 5388 5389<h3 id="_ismatchobject-source"><code>_.isMatch(object, source)</code></h3> 5390[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11823 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") [Ⓣ][1] 5391 5392Performs a partial deep comparison between `object` and `source` to 5393determine if `object` contains equivalent property values. 5394<br> 5395<br> 5396**Note:** This method is equivalent to `_.matches` when `source` is 5397partially applied. 5398<br> 5399<br> 5400Partial comparisons will match empty array and empty object `source` 5401values against any array or object value, respectively. See `_.isEqual` 5402for a list of supported value comparisons. 5403 5404#### Since 54053.0.0 5406 5407#### Arguments 54081. `object` *(Object)*: The object to inspect. 54092. `source` *(Object)*: The object of property values to match. 5410 5411#### Returns 5412*(boolean)*: Returns `true` if `object` is a match, else `false`. 5413 5414#### Example 5415```js 5416var object = { 'a': 1, 'b': 2 }; 5417 5418_.isMatch(object, { 'b': 2 }); 5419// => true 5420 5421_.isMatch(object, { 'b': 1 }); 5422// => false 5423``` 5424--- 5425 5426<!-- /div --> 5427 5428<!-- div --> 5429 5430<h3 id="_ismatchwithobject-source-customizer"><code>_.isMatchWith(object, source, [customizer])</code></h3> 5431[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11859 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package") [Ⓣ][1] 5432 5433This method is like `_.isMatch` except that it accepts `customizer` which 5434is invoked to compare values. If `customizer` returns `undefined`, comparisons 5435are handled by the method instead. The `customizer` is invoked with five 5436arguments: *(objValue, srcValue, index|key, object, source)*. 5437 5438#### Since 54394.0.0 5440 5441#### Arguments 54421. `object` *(Object)*: The object to inspect. 54432. `source` *(Object)*: The object of property values to match. 54443. `[customizer]` *(Function)*: The function to customize comparisons. 5445 5446#### Returns 5447*(boolean)*: Returns `true` if `object` is a match, else `false`. 5448 5449#### Example 5450```js 5451function isGreeting(value) { 5452 return /^h(?:i|ello)$/.test(value); 5453} 5454 5455function customizer(objValue, srcValue) { 5456 if (isGreeting(objValue) && isGreeting(srcValue)) { 5457 return true; 5458 } 5459} 5460 5461var object = { 'greeting': 'hello' }; 5462var source = { 'greeting': 'hi' }; 5463 5464_.isMatchWith(object, source, customizer); 5465// => true 5466``` 5467--- 5468 5469<!-- /div --> 5470 5471<!-- div --> 5472 5473<h3 id="_isnanvalue"><code>_.isNaN(value)</code></h3> 5474[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11892 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") [Ⓣ][1] 5475 5476Checks if `value` is `NaN`. 5477<br> 5478<br> 5479**Note:** This method is based on 5480[`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 5481global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 5482`undefined` and other non-number values. 5483 5484#### Since 54850.1.0 5486 5487#### Arguments 54881. `value` *(*)*: The value to check. 5489 5490#### Returns 5491*(boolean)*: Returns `true` if `value` is `NaN`, else `false`. 5492 5493#### Example 5494```js 5495_.isNaN(NaN); 5496// => true 5497 5498_.isNaN(new Number(NaN)); 5499// => true 5500 5501isNaN(undefined); 5502// => true 5503 5504_.isNaN(undefined); 5505// => false 5506``` 5507--- 5508 5509<!-- /div --> 5510 5511<!-- div --> 5512 5513<h3 id="_isnativevalue"><code>_.isNative(value)</code></h3> 5514[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11925 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") [Ⓣ][1] 5515 5516Checks if `value` is a pristine native function. 5517<br> 5518<br> 5519**Note:** This method can't reliably detect native functions in the presence 5520of the core-js package because core-js circumvents this kind of detection. 5521Despite multiple requests, the core-js maintainer has made it clear: any 5522attempt to fix the detection will be obstructed. As a result, we're left 5523with little choice but to throw an error. Unfortunately, this also affects 5524packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 5525which rely on core-js. 5526 5527#### Since 55283.0.0 5529 5530#### Arguments 55311. `value` *(*)*: The value to check. 5532 5533#### Returns 5534*(boolean)*: Returns `true` if `value` is a native function, else `false`. 5535 5536#### Example 5537```js 5538_.isNative(Array.prototype.push); 5539// => true 5540 5541_.isNative(_); 5542// => false 5543``` 5544--- 5545 5546<!-- /div --> 5547 5548<!-- div --> 5549 5550<h3 id="_isnilvalue"><code>_.isNil(value)</code></h3> 5551[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11973 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package") [Ⓣ][1] 5552 5553Checks if `value` is `null` or `undefined`. 5554 5555#### Since 55564.0.0 5557 5558#### Arguments 55591. `value` *(*)*: The value to check. 5560 5561#### Returns 5562*(boolean)*: Returns `true` if `value` is nullish, else `false`. 5563 5564#### Example 5565```js 5566_.isNil(null); 5567// => true 5568 5569_.isNil(void 0); 5570// => true 5571 5572_.isNil(NaN); 5573// => false 5574``` 5575--- 5576 5577<!-- /div --> 5578 5579<!-- div --> 5580 5581<h3 id="_isnullvalue"><code>_.isNull(value)</code></h3> 5582[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11949 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") [Ⓣ][1] 5583 5584Checks if `value` is `null`. 5585 5586#### Since 55870.1.0 5588 5589#### Arguments 55901. `value` *(*)*: The value to check. 5591 5592#### Returns 5593*(boolean)*: Returns `true` if `value` is `null`, else `false`. 5594 5595#### Example 5596```js 5597_.isNull(null); 5598// => true 5599 5600_.isNull(void 0); 5601// => false 5602``` 5603--- 5604 5605<!-- /div --> 5606 5607<!-- div --> 5608 5609<h3 id="_isnumbervalue"><code>_.isNumber(value)</code></h3> 5610[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12003 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") [Ⓣ][1] 5611 5612Checks if `value` is classified as a `Number` primitive or object. 5613<br> 5614<br> 5615**Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 5616classified as numbers, use the `_.isFinite` method. 5617 5618#### Since 56190.1.0 5620 5621#### Arguments 56221. `value` *(*)*: The value to check. 5623 5624#### Returns 5625*(boolean)*: Returns `true` if `value` is a number, else `false`. 5626 5627#### Example 5628```js 5629_.isNumber(3); 5630// => true 5631 5632_.isNumber(Number.MIN_VALUE); 5633// => true 5634 5635_.isNumber(Infinity); 5636// => true 5637 5638_.isNumber('3'); 5639// => false 5640``` 5641--- 5642 5643<!-- /div --> 5644 5645<!-- div --> 5646 5647<h3 id="_isobjectvalue"><code>_.isObject(value)</code></h3> 5648[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11743 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") [Ⓣ][1] 5649 5650Checks if `value` is the 5651[language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 5652of `Object`. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* 5653 5654#### Since 56550.1.0 5656 5657#### Arguments 56581. `value` *(*)*: The value to check. 5659 5660#### Returns 5661*(boolean)*: Returns `true` if `value` is an object, else `false`. 5662 5663#### Example 5664```js 5665_.isObject({}); 5666// => true 5667 5668_.isObject([1, 2, 3]); 5669// => true 5670 5671_.isObject(_.noop); 5672// => true 5673 5674_.isObject(null); 5675// => false 5676``` 5677--- 5678 5679<!-- /div --> 5680 5681<!-- div --> 5682 5683<h3 id="_isobjectlikevalue"><code>_.isObjectLike(value)</code></h3> 5684[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11772 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package") [Ⓣ][1] 5685 5686Checks if `value` is object-like. A value is object-like if it's not `null` 5687and has a `typeof` result of "object". 5688 5689#### Since 56904.0.0 5691 5692#### Arguments 56931. `value` *(*)*: The value to check. 5694 5695#### Returns 5696*(boolean)*: Returns `true` if `value` is object-like, else `false`. 5697 5698#### Example 5699```js 5700_.isObjectLike({}); 5701// => true 5702 5703_.isObjectLike([1, 2, 3]); 5704// => true 5705 5706_.isObjectLike(_.noop); 5707// => false 5708 5709_.isObjectLike(null); 5710// => false 5711``` 5712--- 5713 5714<!-- /div --> 5715 5716<!-- div --> 5717 5718<h3 id="_isplainobjectvalue"><code>_.isPlainObject(value)</code></h3> 5719[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12036 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") [Ⓣ][1] 5720 5721Checks if `value` is a plain object, that is, an object created by the 5722`Object` constructor or one with a `[[Prototype]]` of `null`. 5723 5724#### Since 57250.8.0 5726 5727#### Arguments 57281. `value` *(*)*: The value to check. 5729 5730#### Returns 5731*(boolean)*: Returns `true` if `value` is a plain object, else `false`. 5732 5733#### Example 5734```js 5735function Foo() { 5736 this.a = 1; 5737} 5738 5739_.isPlainObject(new Foo); 5740// => false 5741 5742_.isPlainObject([1, 2, 3]); 5743// => false 5744 5745_.isPlainObject({ 'x': 0, 'y': 0 }); 5746// => true 5747 5748_.isPlainObject(Object.create(null)); 5749// => true 5750``` 5751--- 5752 5753<!-- /div --> 5754 5755<!-- div --> 5756 5757<h3 id="_isregexpvalue"><code>_.isRegExp(value)</code></h3> 5758[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12066 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") [Ⓣ][1] 5759 5760Checks if `value` is classified as a `RegExp` object. 5761 5762#### Since 57630.1.0 5764 5765#### Arguments 57661. `value` *(*)*: The value to check. 5767 5768#### Returns 5769*(boolean)*: Returns `true` if `value` is a regexp, else `false`. 5770 5771#### Example 5772```js 5773_.isRegExp(/abc/); 5774// => true 5775 5776_.isRegExp('/abc/'); 5777// => false 5778``` 5779--- 5780 5781<!-- /div --> 5782 5783<!-- div --> 5784 5785<h3 id="_issafeintegervalue"><code>_.isSafeInteger(value)</code></h3> 5786[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12095 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package") [Ⓣ][1] 5787 5788Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 5789double precision number which isn't the result of a rounded unsafe integer. 5790<br> 5791<br> 5792**Note:** This method is based on 5793[`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 5794 5795#### Since 57964.0.0 5797 5798#### Arguments 57991. `value` *(*)*: The value to check. 5800 5801#### Returns 5802*(boolean)*: Returns `true` if `value` is a safe integer, else `false`. 5803 5804#### Example 5805```js 5806_.isSafeInteger(3); 5807// => true 5808 5809_.isSafeInteger(Number.MIN_VALUE); 5810// => false 5811 5812_.isSafeInteger(Infinity); 5813// => false 5814 5815_.isSafeInteger('3'); 5816// => false 5817``` 5818--- 5819 5820<!-- /div --> 5821 5822<!-- div --> 5823 5824<h3 id="_issetvalue"><code>_.isSet(value)</code></h3> 5825[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12116 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isset "See the npm package") [Ⓣ][1] 5826 5827Checks if `value` is classified as a `Set` object. 5828 5829#### Since 58304.3.0 5831 5832#### Arguments 58331. `value` *(*)*: The value to check. 5834 5835#### Returns 5836*(boolean)*: Returns `true` if `value` is a set, else `false`. 5837 5838#### Example 5839```js 5840_.isSet(new Set); 5841// => true 5842 5843_.isSet(new WeakSet); 5844// => false 5845``` 5846--- 5847 5848<!-- /div --> 5849 5850<!-- div --> 5851 5852<h3 id="_isstringvalue"><code>_.isString(value)</code></h3> 5853[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12135 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") [Ⓣ][1] 5854 5855Checks if `value` is classified as a `String` primitive or object. 5856 5857#### Since 58580.1.0 5859 5860#### Arguments 58611. `value` *(*)*: The value to check. 5862 5863#### Returns 5864*(boolean)*: Returns `true` if `value` is a string, else `false`. 5865 5866#### Example 5867```js 5868_.isString('abc'); 5869// => true 5870 5871_.isString(1); 5872// => false 5873``` 5874--- 5875 5876<!-- /div --> 5877 5878<!-- div --> 5879 5880<h3 id="_issymbolvalue"><code>_.isSymbol(value)</code></h3> 5881[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12157 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package") [Ⓣ][1] 5882 5883Checks if `value` is classified as a `Symbol` primitive or object. 5884 5885#### Since 58864.0.0 5887 5888#### Arguments 58891. `value` *(*)*: The value to check. 5890 5891#### Returns 5892*(boolean)*: Returns `true` if `value` is a symbol, else `false`. 5893 5894#### Example 5895```js 5896_.isSymbol(Symbol.iterator); 5897// => true 5898 5899_.isSymbol('abc'); 5900// => false 5901``` 5902--- 5903 5904<!-- /div --> 5905 5906<!-- div --> 5907 5908<h3 id="_istypedarrayvalue"><code>_.isTypedArray(value)</code></h3> 5909[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12179 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") [Ⓣ][1] 5910 5911Checks if `value` is classified as a typed array. 5912 5913#### Since 59143.0.0 5915 5916#### Arguments 59171. `value` *(*)*: The value to check. 5918 5919#### Returns 5920*(boolean)*: Returns `true` if `value` is a typed array, else `false`. 5921 5922#### Example 5923```js 5924_.isTypedArray(new Uint8Array); 5925// => true 5926 5927_.isTypedArray([]); 5928// => false 5929``` 5930--- 5931 5932<!-- /div --> 5933 5934<!-- div --> 5935 5936<h3 id="_isundefinedvalue"><code>_.isUndefined(value)</code></h3> 5937[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12198 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") [Ⓣ][1] 5938 5939Checks if `value` is `undefined`. 5940 5941#### Since 59420.1.0 5943 5944#### Arguments 59451. `value` *(*)*: The value to check. 5946 5947#### Returns 5948*(boolean)*: Returns `true` if `value` is `undefined`, else `false`. 5949 5950#### Example 5951```js 5952_.isUndefined(void 0); 5953// => true 5954 5955_.isUndefined(null); 5956// => false 5957``` 5958--- 5959 5960<!-- /div --> 5961 5962<!-- div --> 5963 5964<h3 id="_isweakmapvalue"><code>_.isWeakMap(value)</code></h3> 5965[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12219 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isweakmap "See the npm package") [Ⓣ][1] 5966 5967Checks if `value` is classified as a `WeakMap` object. 5968 5969#### Since 59704.3.0 5971 5972#### Arguments 59731. `value` *(*)*: The value to check. 5974 5975#### Returns 5976*(boolean)*: Returns `true` if `value` is a weak map, else `false`. 5977 5978#### Example 5979```js 5980_.isWeakMap(new WeakMap); 5981// => true 5982 5983_.isWeakMap(new Map); 5984// => false 5985``` 5986--- 5987 5988<!-- /div --> 5989 5990<!-- div --> 5991 5992<h3 id="_isweaksetvalue"><code>_.isWeakSet(value)</code></h3> 5993[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12240 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isweakset "See the npm package") [Ⓣ][1] 5994 5995Checks if `value` is classified as a `WeakSet` object. 5996 5997#### Since 59984.3.0 5999 6000#### Arguments 60011. `value` *(*)*: The value to check. 6002 6003#### Returns 6004*(boolean)*: Returns `true` if `value` is a weak set, else `false`. 6005 6006#### Example 6007```js 6008_.isWeakSet(new WeakSet); 6009// => true 6010 6011_.isWeakSet(new Set); 6012// => false 6013``` 6014--- 6015 6016<!-- /div --> 6017 6018<!-- div --> 6019 6020<h3 id="_ltvalue-other"><code>_.lt(value, other)</code></h3> 6021[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12267 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package") [Ⓣ][1] 6022 6023Checks if `value` is less than `other`. 6024 6025#### Since 60263.9.0 6027 6028#### Arguments 60291. `value` *(*)*: The value to compare. 60302. `other` *(*)*: The other value to compare. 6031 6032#### Returns 6033*(boolean)*: Returns `true` if `value` is less than `other`, else `false`. 6034 6035#### Example 6036```js 6037_.lt(1, 3); 6038// => true 6039 6040_.lt(3, 3); 6041// => false 6042 6043_.lt(3, 1); 6044// => false 6045``` 6046--- 6047 6048<!-- /div --> 6049 6050<!-- div --> 6051 6052<h3 id="_ltevalue-other"><code>_.lte(value, other)</code></h3> 6053[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12292 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package") [Ⓣ][1] 6054 6055Checks if `value` is less than or equal to `other`. 6056 6057#### Since 60583.9.0 6059 6060#### Arguments 60611. `value` *(*)*: The value to compare. 60622. `other` *(*)*: The other value to compare. 6063 6064#### Returns 6065*(boolean)*: Returns `true` if `value` is less than or equal to `other`, else `false`. 6066 6067#### Example 6068```js 6069_.lte(1, 3); 6070// => true 6071 6072_.lte(3, 3); 6073// => true 6074 6075_.lte(3, 1); 6076// => false 6077``` 6078--- 6079 6080<!-- /div --> 6081 6082<!-- div --> 6083 6084<h3 id="_toarrayvalue"><code>_.toArray(value)</code></h3> 6085[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12319 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") [Ⓣ][1] 6086 6087Converts `value` to an array. 6088 6089#### Since 60900.1.0 6091 6092#### Arguments 60931. `value` *(*)*: The value to convert. 6094 6095#### Returns 6096*(Array)*: Returns the converted array. 6097 6098#### Example 6099```js 6100_.toArray({ 'a': 1, 'b': 2 }); 6101// => [1, 2] 6102 6103_.toArray('abc'); 6104// => ['a', 'b', 'c'] 6105 6106_.toArray(1); 6107// => [] 6108 6109_.toArray(null); 6110// => [] 6111``` 6112--- 6113 6114<!-- /div --> 6115 6116<!-- div --> 6117 6118<h3 id="_tofinitevalue"><code>_.toFinite(value)</code></h3> 6119[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12358 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tofinite "See the npm package") [Ⓣ][1] 6120 6121Converts `value` to a finite number. 6122 6123#### Since 61244.12.0 6125 6126#### Arguments 61271. `value` *(*)*: The value to convert. 6128 6129#### Returns 6130*(number)*: Returns the converted number. 6131 6132#### Example 6133```js 6134_.toFinite(3.2); 6135// => 3.2 6136 6137_.toFinite(Number.MIN_VALUE); 6138// => 5e-324 6139 6140_.toFinite(Infinity); 6141// => 1.7976931348623157e+308 6142 6143_.toFinite('3.2'); 6144// => 3.2 6145``` 6146--- 6147 6148<!-- /div --> 6149 6150<!-- div --> 6151 6152<h3 id="_tointegervalue"><code>_.toInteger(value)</code></h3> 6153[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12396 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package") [Ⓣ][1] 6154 6155Converts `value` to an integer. 6156<br> 6157<br> 6158**Note:** This method is loosely based on 6159[`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 6160 6161#### Since 61624.0.0 6163 6164#### Arguments 61651. `value` *(*)*: The value to convert. 6166 6167#### Returns 6168*(number)*: Returns the converted integer. 6169 6170#### Example 6171```js 6172_.toInteger(3.2); 6173// => 3 6174 6175_.toInteger(Number.MIN_VALUE); 6176// => 0 6177 6178_.toInteger(Infinity); 6179// => 1.7976931348623157e+308 6180 6181_.toInteger('3.2'); 6182// => 3 6183``` 6184--- 6185 6186<!-- /div --> 6187 6188<!-- div --> 6189 6190<h3 id="_tolengthvalue"><code>_.toLength(value)</code></h3> 6191[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12430 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package") [Ⓣ][1] 6192 6193Converts `value` to an integer suitable for use as the length of an 6194array-like object. 6195<br> 6196<br> 6197**Note:** This method is based on 6198[`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 6199 6200#### Since 62014.0.0 6202 6203#### Arguments 62041. `value` *(*)*: The value to convert. 6205 6206#### Returns 6207*(number)*: Returns the converted integer. 6208 6209#### Example 6210```js 6211_.toLength(3.2); 6212// => 3 6213 6214_.toLength(Number.MIN_VALUE); 6215// => 0 6216 6217_.toLength(Infinity); 6218// => 4294967295 6219 6220_.toLength('3.2'); 6221// => 3 6222``` 6223--- 6224 6225<!-- /div --> 6226 6227<!-- div --> 6228 6229<h3 id="_tonumbervalue"><code>_.toNumber(value)</code></h3> 6230[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12457 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package") [Ⓣ][1] 6231 6232Converts `value` to a number. 6233 6234#### Since 62354.0.0 6236 6237#### Arguments 62381. `value` *(*)*: The value to process. 6239 6240#### Returns 6241*(number)*: Returns the number. 6242 6243#### Example 6244```js 6245_.toNumber(3.2); 6246// => 3.2 6247 6248_.toNumber(Number.MIN_VALUE); 6249// => 5e-324 6250 6251_.toNumber(Infinity); 6252// => Infinity 6253 6254_.toNumber('3.2'); 6255// => 3.2 6256``` 6257--- 6258 6259<!-- /div --> 6260 6261<!-- div --> 6262 6263<h3 id="_toplainobjectvalue"><code>_.toPlainObject(value)</code></h3> 6264[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12502 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") [Ⓣ][1] 6265 6266Converts `value` to a plain object flattening inherited enumerable string 6267keyed properties of `value` to own properties of the plain object. 6268 6269#### Since 62703.0.0 6271 6272#### Arguments 62731. `value` *(*)*: The value to convert. 6274 6275#### Returns 6276*(Object)*: Returns the converted plain object. 6277 6278#### Example 6279```js 6280function Foo() { 6281 this.b = 2; 6282} 6283 6284Foo.prototype.c = 3; 6285 6286_.assign({ 'a': 1 }, new Foo); 6287// => { 'a': 1, 'b': 2 } 6288 6289_.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 6290// => { 'a': 1, 'b': 2, 'c': 3 } 6291``` 6292--- 6293 6294<!-- /div --> 6295 6296<!-- div --> 6297 6298<h3 id="_tosafeintegervalue"><code>_.toSafeInteger(value)</code></h3> 6299[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12530 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package") [Ⓣ][1] 6300 6301Converts `value` to a safe integer. A safe integer can be compared and 6302represented correctly. 6303 6304#### Since 63054.0.0 6306 6307#### Arguments 63081. `value` *(*)*: The value to convert. 6309 6310#### Returns 6311*(number)*: Returns the converted integer. 6312 6313#### Example 6314```js 6315_.toSafeInteger(3.2); 6316// => 3 6317 6318_.toSafeInteger(Number.MIN_VALUE); 6319// => 0 6320 6321_.toSafeInteger(Infinity); 6322// => 9007199254740991 6323 6324_.toSafeInteger('3.2'); 6325// => 3 6326``` 6327--- 6328 6329<!-- /div --> 6330 6331<!-- div --> 6332 6333<h3 id="_tostringvalue"><code>_.toString(value)</code></h3> 6334[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12557 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package") [Ⓣ][1] 6335 6336Converts `value` to a string. An empty string is returned for `null` 6337and `undefined` values. The sign of `-0` is preserved. 6338 6339#### Since 63404.0.0 6341 6342#### Arguments 63431. `value` *(*)*: The value to convert. 6344 6345#### Returns 6346*(string)*: Returns the converted string. 6347 6348#### Example 6349```js 6350_.toString(null); 6351// => '' 6352 6353_.toString(-0); 6354// => '-0' 6355 6356_.toString([1, 2, 3]); 6357// => '1,2,3' 6358``` 6359--- 6360 6361<!-- /div --> 6362 6363<!-- /div --> 6364 6365<!-- div --> 6366 6367## `“Math” Methods` 6368 6369<!-- div --> 6370 6371<h3 id="_addaugend-addend"><code>_.add(augend, addend)</code></h3> 6372[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16192 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") [Ⓣ][1] 6373 6374Adds two numbers. 6375 6376#### Since 63773.4.0 6378 6379#### Arguments 63801. `augend` *(number)*: The first number in an addition. 63812. `addend` *(number)*: The second number in an addition. 6382 6383#### Returns 6384*(number)*: Returns the total. 6385 6386#### Example 6387```js 6388_.add(6, 4); 6389// => 10 6390``` 6391--- 6392 6393<!-- /div --> 6394 6395<!-- div --> 6396 6397<h3 id="_ceilnumber-precision0"><code>_.ceil(number, [precision=0])</code></h3> 6398[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16217 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package") [Ⓣ][1] 6399 6400Computes `number` rounded up to `precision`. 6401 6402#### Since 64033.10.0 6404 6405#### Arguments 64061. `number` *(number)*: The number to round up. 64072. `[precision=0]` *(number)*: The precision to round up to. 6408 6409#### Returns 6410*(number)*: Returns the rounded up number. 6411 6412#### Example 6413```js 6414_.ceil(4.006); 6415// => 5 6416 6417_.ceil(6.004, 2); 6418// => 6.01 6419 6420_.ceil(6040, -2); 6421// => 6100 6422``` 6423--- 6424 6425<!-- /div --> 6426 6427<!-- div --> 6428 6429<h3 id="_dividedividend-divisor"><code>_.divide(dividend, divisor)</code></h3> 6430[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16234 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.divide "See the npm package") [Ⓣ][1] 6431 6432Divide two numbers. 6433 6434#### Since 64354.7.0 6436 6437#### Arguments 64381. `dividend` *(number)*: The first number in a division. 64392. `divisor` *(number)*: The second number in a division. 6440 6441#### Returns 6442*(number)*: Returns the quotient. 6443 6444#### Example 6445```js 6446_.divide(6, 4); 6447// => 1.5 6448``` 6449--- 6450 6451<!-- /div --> 6452 6453<!-- div --> 6454 6455<h3 id="_floornumber-precision0"><code>_.floor(number, [precision=0])</code></h3> 6456[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16259 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package") [Ⓣ][1] 6457 6458Computes `number` rounded down to `precision`. 6459 6460#### Since 64613.10.0 6462 6463#### Arguments 64641. `number` *(number)*: The number to round down. 64652. `[precision=0]` *(number)*: The precision to round down to. 6466 6467#### Returns 6468*(number)*: Returns the rounded down number. 6469 6470#### Example 6471```js 6472_.floor(4.006); 6473// => 4 6474 6475_.floor(0.046, 2); 6476// => 0.04 6477 6478_.floor(4060, -2); 6479// => 4000 6480``` 6481--- 6482 6483<!-- /div --> 6484 6485<!-- div --> 6486 6487<h3 id="_maxarray"><code>_.max(array)</code></h3> 6488[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16279 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") [Ⓣ][1] 6489 6490Computes the maximum value of `array`. If `array` is empty or falsey, 6491`undefined` is returned. 6492 6493#### Since 64940.1.0 6495 6496#### Arguments 64971. `array` *(Array)*: The array to iterate over. 6498 6499#### Returns 6500*(*)*: Returns the maximum value. 6501 6502#### Example 6503```js 6504_.max([4, 2, 8, 6]); 6505// => 8 6506 6507_.max([]); 6508// => undefined 6509``` 6510--- 6511 6512<!-- /div --> 6513 6514<!-- div --> 6515 6516<h3 id="_maxbyarray-iteratee_identity"><code>_.maxBy(array, [iteratee=_.identity])</code></h3> 6517[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16308 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package") [Ⓣ][1] 6518 6519This method is like `_.max` except that it accepts `iteratee` which is 6520invoked for each element in `array` to generate the criterion by which 6521the value is ranked. The iteratee is invoked with one argument: *(value)*. 6522 6523#### Since 65244.0.0 6525 6526#### Arguments 65271. `array` *(Array)*: The array to iterate over. 65282. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 6529 6530#### Returns 6531*(*)*: Returns the maximum value. 6532 6533#### Example 6534```js 6535var objects = [{ 'n': 1 }, { 'n': 2 }]; 6536 6537_.maxBy(objects, function(o) { return o.n; }); 6538// => { 'n': 2 } 6539 6540// The `_.property` iteratee shorthand. 6541_.maxBy(objects, 'n'); 6542// => { 'n': 2 } 6543``` 6544--- 6545 6546<!-- /div --> 6547 6548<!-- div --> 6549 6550<h3 id="_meanarray"><code>_.mean(array)</code></h3> 6551[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16328 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package") [Ⓣ][1] 6552 6553Computes the mean of the values in `array`. 6554 6555#### Since 65564.0.0 6557 6558#### Arguments 65591. `array` *(Array)*: The array to iterate over. 6560 6561#### Returns 6562*(number)*: Returns the mean. 6563 6564#### Example 6565```js 6566_.mean([4, 2, 8, 6]); 6567// => 5 6568``` 6569--- 6570 6571<!-- /div --> 6572 6573<!-- div --> 6574 6575<h3 id="_meanbyarray-iteratee_identity"><code>_.meanBy(array, [iteratee=_.identity])</code></h3> 6576[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16355 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.meanby "See the npm package") [Ⓣ][1] 6577 6578This method is like `_.mean` except that it accepts `iteratee` which is 6579invoked for each element in `array` to generate the value to be averaged. 6580The iteratee is invoked with one argument: *(value)*. 6581 6582#### Since 65834.7.0 6584 6585#### Arguments 65861. `array` *(Array)*: The array to iterate over. 65872. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 6588 6589#### Returns 6590*(number)*: Returns the mean. 6591 6592#### Example 6593```js 6594var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 6595 6596_.meanBy(objects, function(o) { return o.n; }); 6597// => 5 6598 6599// The `_.property` iteratee shorthand. 6600_.meanBy(objects, 'n'); 6601// => 5 6602``` 6603--- 6604 6605<!-- /div --> 6606 6607<!-- div --> 6608 6609<h3 id="_minarray"><code>_.min(array)</code></h3> 6610[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16377 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") [Ⓣ][1] 6611 6612Computes the minimum value of `array`. If `array` is empty or falsey, 6613`undefined` is returned. 6614 6615#### Since 66160.1.0 6617 6618#### Arguments 66191. `array` *(Array)*: The array to iterate over. 6620 6621#### Returns 6622*(*)*: Returns the minimum value. 6623 6624#### Example 6625```js 6626_.min([4, 2, 8, 6]); 6627// => 2 6628 6629_.min([]); 6630// => undefined 6631``` 6632--- 6633 6634<!-- /div --> 6635 6636<!-- div --> 6637 6638<h3 id="_minbyarray-iteratee_identity"><code>_.minBy(array, [iteratee=_.identity])</code></h3> 6639[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16406 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package") [Ⓣ][1] 6640 6641This method is like `_.min` except that it accepts `iteratee` which is 6642invoked for each element in `array` to generate the criterion by which 6643the value is ranked. The iteratee is invoked with one argument: *(value)*. 6644 6645#### Since 66464.0.0 6647 6648#### Arguments 66491. `array` *(Array)*: The array to iterate over. 66502. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 6651 6652#### Returns 6653*(*)*: Returns the minimum value. 6654 6655#### Example 6656```js 6657var objects = [{ 'n': 1 }, { 'n': 2 }]; 6658 6659_.minBy(objects, function(o) { return o.n; }); 6660// => { 'n': 1 } 6661 6662// The `_.property` iteratee shorthand. 6663_.minBy(objects, 'n'); 6664// => { 'n': 1 } 6665``` 6666--- 6667 6668<!-- /div --> 6669 6670<!-- div --> 6671 6672<h3 id="_multiplymultiplier-multiplicand"><code>_.multiply(multiplier, multiplicand)</code></h3> 6673[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16427 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.multiply "See the npm package") [Ⓣ][1] 6674 6675Multiply two numbers. 6676 6677#### Since 66784.7.0 6679 6680#### Arguments 66811. `multiplier` *(number)*: The first number in a multiplication. 66822. `multiplicand` *(number)*: The second number in a multiplication. 6683 6684#### Returns 6685*(number)*: Returns the product. 6686 6687#### Example 6688```js 6689_.multiply(6, 4); 6690// => 24 6691``` 6692--- 6693 6694<!-- /div --> 6695 6696<!-- div --> 6697 6698<h3 id="_roundnumber-precision0"><code>_.round(number, [precision=0])</code></h3> 6699[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16452 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package") [Ⓣ][1] 6700 6701Computes `number` rounded to `precision`. 6702 6703#### Since 67043.10.0 6705 6706#### Arguments 67071. `number` *(number)*: The number to round. 67082. `[precision=0]` *(number)*: The precision to round to. 6709 6710#### Returns 6711*(number)*: Returns the rounded number. 6712 6713#### Example 6714```js 6715_.round(4.006); 6716// => 4 6717 6718_.round(4.006, 2); 6719// => 4.01 6720 6721_.round(4060, -2); 6722// => 4100 6723``` 6724--- 6725 6726<!-- /div --> 6727 6728<!-- div --> 6729 6730<h3 id="_subtractminuend-subtrahend"><code>_.subtract(minuend, subtrahend)</code></h3> 6731[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16469 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package") [Ⓣ][1] 6732 6733Subtract two numbers. 6734 6735#### Since 67364.0.0 6737 6738#### Arguments 67391. `minuend` *(number)*: The first number in a subtraction. 67402. `subtrahend` *(number)*: The second number in a subtraction. 6741 6742#### Returns 6743*(number)*: Returns the difference. 6744 6745#### Example 6746```js 6747_.subtract(6, 4); 6748// => 2 6749``` 6750--- 6751 6752<!-- /div --> 6753 6754<!-- div --> 6755 6756<h3 id="_sumarray"><code>_.sum(array)</code></h3> 6757[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16487 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") [Ⓣ][1] 6758 6759Computes the sum of the values in `array`. 6760 6761#### Since 67623.4.0 6763 6764#### Arguments 67651. `array` *(Array)*: The array to iterate over. 6766 6767#### Returns 6768*(number)*: Returns the sum. 6769 6770#### Example 6771```js 6772_.sum([4, 2, 8, 6]); 6773// => 20 6774``` 6775--- 6776 6777<!-- /div --> 6778 6779<!-- div --> 6780 6781<h3 id="_sumbyarray-iteratee_identity"><code>_.sumBy(array, [iteratee=_.identity])</code></h3> 6782[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16516 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package") [Ⓣ][1] 6783 6784This method is like `_.sum` except that it accepts `iteratee` which is 6785invoked for each element in `array` to generate the value to be summed. 6786The iteratee is invoked with one argument: *(value)*. 6787 6788#### Since 67894.0.0 6790 6791#### Arguments 67921. `array` *(Array)*: The array to iterate over. 67932. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 6794 6795#### Returns 6796*(number)*: Returns the sum. 6797 6798#### Example 6799```js 6800var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 6801 6802_.sumBy(objects, function(o) { return o.n; }); 6803// => 20 6804 6805// The `_.property` iteratee shorthand. 6806_.sumBy(objects, 'n'); 6807// => 20 6808``` 6809--- 6810 6811<!-- /div --> 6812 6813<!-- /div --> 6814 6815<!-- div --> 6816 6817## `“Number” Methods` 6818 6819<!-- div --> 6820 6821<h3 id="_clampnumber-lower-upper"><code>_.clamp(number, [lower], upper)</code></h3> 6822[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13981 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package") [Ⓣ][1] 6823 6824Clamps `number` within the inclusive `lower` and `upper` bounds. 6825 6826#### Since 68274.0.0 6828 6829#### Arguments 68301. `number` *(number)*: The number to clamp. 68312. `[lower]` *(number)*: The lower bound. 68323. `upper` *(number)*: The upper bound. 6833 6834#### Returns 6835*(number)*: Returns the clamped number. 6836 6837#### Example 6838```js 6839_.clamp(-10, -5, 5); 6840// => -5 6841 6842_.clamp(10, -5, 5); 6843// => 5 6844``` 6845--- 6846 6847<!-- /div --> 6848 6849<!-- div --> 6850 6851<h3 id="_inrangenumber-start0-end"><code>_.inRange(number, [start=0], end)</code></h3> 6852[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14035 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") [Ⓣ][1] 6853 6854Checks if `n` is between `start` and up to, but not including, `end`. If 6855`end` is not specified, it's set to `start` with `start` then set to `0`. 6856If `start` is greater than `end` the params are swapped to support 6857negative ranges. 6858 6859#### Since 68603.3.0 6861 6862#### Arguments 68631. `number` *(number)*: The number to check. 68642. `[start=0]` *(number)*: The start of the range. 68653. `end` *(number)*: The end of the range. 6866 6867#### Returns 6868*(boolean)*: Returns `true` if `number` is in the range, else `false`. 6869 6870#### Example 6871```js 6872_.inRange(3, 2, 4); 6873// => true 6874 6875_.inRange(4, 8); 6876// => true 6877 6878_.inRange(4, 2); 6879// => false 6880 6881_.inRange(2, 2); 6882// => false 6883 6884_.inRange(1.2, 2); 6885// => true 6886 6887_.inRange(5.2, 4); 6888// => false 6889 6890_.inRange(-3, -2, -6); 6891// => true 6892``` 6893--- 6894 6895<!-- /div --> 6896 6897<!-- div --> 6898 6899<h3 id="_randomlower0-upper1-floating"><code>_.random([lower=0], [upper=1], [floating])</code></h3> 6900[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14078 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") [Ⓣ][1] 6901 6902Produces a random number between the inclusive `lower` and `upper` bounds. 6903If only one argument is provided a number between `0` and the given number 6904is returned. If `floating` is `true`, or either `lower` or `upper` are 6905floats, a floating-point number is returned instead of an integer. 6906<br> 6907<br> 6908**Note:** JavaScript follows the IEEE-754 standard for resolving 6909floating-point values which can produce unexpected results. 6910 6911#### Since 69120.7.0 6913 6914#### Arguments 69151. `[lower=0]` *(number)*: The lower bound. 69162. `[upper=1]` *(number)*: The upper bound. 69173. `[floating]` *(boolean)*: Specify returning a floating-point number. 6918 6919#### Returns 6920*(number)*: Returns the random number. 6921 6922#### Example 6923```js 6924_.random(0, 5); 6925// => an integer between 0 and 5 6926 6927_.random(5); 6928// => also an integer between 0 and 5 6929 6930_.random(5, true); 6931// => a floating-point number between 0 and 5 6932 6933_.random(1.2, 5.2); 6934// => a floating-point number between 1.2 and 5.2 6935``` 6936--- 6937 6938<!-- /div --> 6939 6940<!-- /div --> 6941 6942<!-- div --> 6943 6944## `“Object” Methods` 6945 6946<!-- div --> 6947 6948<h3 id="_assignobject-sources"><code>_.assign(object, [sources])</code></h3> 6949[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12595 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") [Ⓣ][1] 6950 6951Assigns own enumerable string keyed properties of source objects to the 6952destination object. Source objects are applied from left to right. 6953Subsequent sources overwrite property assignments of previous sources. 6954<br> 6955<br> 6956**Note:** This method mutates `object` and is loosely based on 6957[`Object.assign`](https://mdn.io/Object/assign). 6958 6959#### Since 69600.10.0 6961 6962#### Arguments 69631. `object` *(Object)*: The destination object. 69642. `[sources]` *(...Object)*: The source objects. 6965 6966#### Returns 6967*(Object)*: Returns `object`. 6968 6969#### Example 6970```js 6971function Foo() { 6972 this.a = 1; 6973} 6974 6975function Bar() { 6976 this.c = 3; 6977} 6978 6979Foo.prototype.b = 2; 6980Bar.prototype.d = 4; 6981 6982_.assign({ 'a': 0 }, new Foo, new Bar); 6983// => { 'a': 1, 'c': 3 } 6984``` 6985--- 6986 6987<!-- /div --> 6988 6989<!-- div --> 6990 6991<h3 id="_assigninobject-sources"><code>_.assignIn(object, [sources])</code></h3> 6992[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12638 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package") [Ⓣ][1] 6993 6994This method is like `_.assign` except that it iterates over own and 6995inherited source properties. 6996<br> 6997<br> 6998**Note:** This method mutates `object`. 6999 7000#### Since 70014.0.0 7002 7003#### Aliases 7004*_.extend* 7005 7006#### Arguments 70071. `object` *(Object)*: The destination object. 70082. `[sources]` *(...Object)*: The source objects. 7009 7010#### Returns 7011*(Object)*: Returns `object`. 7012 7013#### Example 7014```js 7015function Foo() { 7016 this.a = 1; 7017} 7018 7019function Bar() { 7020 this.c = 3; 7021} 7022 7023Foo.prototype.b = 2; 7024Bar.prototype.d = 4; 7025 7026_.assignIn({ 'a': 0 }, new Foo, new Bar); 7027// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 7028``` 7029--- 7030 7031<!-- /div --> 7032 7033<!-- div --> 7034 7035<h3 id="_assigninwithobject-sources-customizer"><code>_.assignInWith(object, sources, [customizer])</code></h3> 7036[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12671 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package") [Ⓣ][1] 7037 7038This method is like `_.assignIn` except that it accepts `customizer` 7039which is invoked to produce the assigned values. If `customizer` returns 7040`undefined`, assignment is handled by the method instead. The `customizer` 7041is invoked with five arguments: *(objValue, srcValue, key, object, source)*. 7042<br> 7043<br> 7044**Note:** This method mutates `object`. 7045 7046#### Since 70474.0.0 7048 7049#### Aliases 7050*_.extendWith* 7051 7052#### Arguments 70531. `object` *(Object)*: The destination object. 70542. `sources` *(...Object)*: The source objects. 70553. `[customizer]` *(Function)*: The function to customize assigned values. 7056 7057#### Returns 7058*(Object)*: Returns `object`. 7059 7060#### Example 7061```js 7062function customizer(objValue, srcValue) { 7063 return _.isUndefined(objValue) ? srcValue : objValue; 7064} 7065 7066var defaults = _.partialRight(_.assignInWith, customizer); 7067 7068defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 7069// => { 'a': 1, 'b': 2 } 7070``` 7071--- 7072 7073<!-- /div --> 7074 7075<!-- div --> 7076 7077<h3 id="_assignwithobject-sources-customizer"><code>_.assignWith(object, sources, [customizer])</code></h3> 7078[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12703 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package") [Ⓣ][1] 7079 7080This method is like `_.assign` except that it accepts `customizer` 7081which is invoked to produce the assigned values. If `customizer` returns 7082`undefined`, assignment is handled by the method instead. The `customizer` 7083is invoked with five arguments: *(objValue, srcValue, key, object, source)*. 7084<br> 7085<br> 7086**Note:** This method mutates `object`. 7087 7088#### Since 70894.0.0 7090 7091#### Arguments 70921. `object` *(Object)*: The destination object. 70932. `sources` *(...Object)*: The source objects. 70943. `[customizer]` *(Function)*: The function to customize assigned values. 7095 7096#### Returns 7097*(Object)*: Returns `object`. 7098 7099#### Example 7100```js 7101function customizer(objValue, srcValue) { 7102 return _.isUndefined(objValue) ? srcValue : objValue; 7103} 7104 7105var defaults = _.partialRight(_.assignWith, customizer); 7106 7107defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 7108// => { 'a': 1, 'b': 2 } 7109``` 7110--- 7111 7112<!-- /div --> 7113 7114<!-- div --> 7115 7116<h3 id="_atobject-paths"><code>_.at(object, [paths])</code></h3> 7117[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12724 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") [Ⓣ][1] 7118 7119Creates an array of values corresponding to `paths` of `object`. 7120 7121#### Since 71221.0.0 7123 7124#### Arguments 71251. `object` *(Object)*: The object to iterate over. 71262. `[paths]` *(...(string|string[]))*: The property paths to pick. 7127 7128#### Returns 7129*(Array)*: Returns the picked values. 7130 7131#### Example 7132```js 7133var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 7134 7135_.at(object, ['a[0].b.c', 'a[1]']); 7136// => [3, 4] 7137``` 7138--- 7139 7140<!-- /div --> 7141 7142<!-- div --> 7143 7144<h3 id="_createprototype-properties"><code>_.create(prototype, [properties])</code></h3> 7145[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12760 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") [Ⓣ][1] 7146 7147Creates an object that inherits from the `prototype` object. If a 7148`properties` object is given, its own enumerable string keyed properties 7149are assigned to the created object. 7150 7151#### Since 71522.3.0 7153 7154#### Arguments 71551. `prototype` *(Object)*: The object to inherit from. 71562. `[properties]` *(Object)*: The properties to assign to the object. 7157 7158#### Returns 7159*(Object)*: Returns the new object. 7160 7161#### Example 7162```js 7163function Shape() { 7164 this.x = 0; 7165 this.y = 0; 7166} 7167 7168function Circle() { 7169 Shape.call(this); 7170} 7171 7172Circle.prototype = _.create(Shape.prototype, { 7173 'constructor': Circle 7174}); 7175 7176var circle = new Circle; 7177circle instanceof Circle; 7178// => true 7179 7180circle instanceof Shape; 7181// => true 7182``` 7183--- 7184 7185<!-- /div --> 7186 7187<!-- div --> 7188 7189<h3 id="_defaultsobject-sources"><code>_.defaults(object, [sources])</code></h3> 7190[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12786 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") [Ⓣ][1] 7191 7192Assigns own and inherited enumerable string keyed properties of source 7193objects to the destination object for all destination properties that 7194resolve to `undefined`. Source objects are applied from left to right. 7195Once a property is set, additional values of the same property are ignored. 7196<br> 7197<br> 7198**Note:** This method mutates `object`. 7199 7200#### Since 72010.1.0 7202 7203#### Arguments 72041. `object` *(Object)*: The destination object. 72052. `[sources]` *(...Object)*: The source objects. 7206 7207#### Returns 7208*(Object)*: Returns `object`. 7209 7210#### Example 7211```js 7212_.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 7213// => { 'a': 1, 'b': 2 } 7214``` 7215--- 7216 7217<!-- /div --> 7218 7219<!-- div --> 7220 7221<h3 id="_defaultsdeepobject-sources"><code>_.defaultsDeep(object, [sources])</code></h3> 7222[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12836 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package") [Ⓣ][1] 7223 7224This method is like `_.defaults` except that it recursively assigns 7225default properties. 7226<br> 7227<br> 7228**Note:** This method mutates `object`. 7229 7230#### Since 72313.10.0 7232 7233#### Arguments 72341. `object` *(Object)*: The destination object. 72352. `[sources]` *(...Object)*: The source objects. 7236 7237#### Returns 7238*(Object)*: Returns `object`. 7239 7240#### Example 7241```js 7242_.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 7243// => { 'a': { 'b': 2, 'c': 3 } } 7244``` 7245--- 7246 7247<!-- /div --> 7248 7249<!-- div --> 7250 7251<h3 id="_findkeyobject-predicate_identity"><code>_.findKey(object, [predicate=_.identity])</code></h3> 7252[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12876 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") [Ⓣ][1] 7253 7254This method is like `_.find` except that it returns the key of the first 7255element `predicate` returns truthy for instead of the element itself. 7256 7257#### Since 72581.1.0 7259 7260#### Arguments 72611. `object` *(Object)*: The object to inspect. 72622. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 7263 7264#### Returns 7265*(*)*: Returns the key of the matched element, else `undefined`. 7266 7267#### Example 7268```js 7269var users = { 7270 'barney': { 'age': 36, 'active': true }, 7271 'fred': { 'age': 40, 'active': false }, 7272 'pebbles': { 'age': 1, 'active': true } 7273}; 7274 7275_.findKey(users, function(o) { return o.age < 40; }); 7276// => 'barney' (iteration order is not guaranteed) 7277 7278// The `_.matches` iteratee shorthand. 7279_.findKey(users, { 'age': 1, 'active': true }); 7280// => 'pebbles' 7281 7282// The `_.matchesProperty` iteratee shorthand. 7283_.findKey(users, ['active', false]); 7284// => 'fred' 7285 7286// The `_.property` iteratee shorthand. 7287_.findKey(users, 'active'); 7288// => 'barney' 7289``` 7290--- 7291 7292<!-- /div --> 7293 7294<!-- div --> 7295 7296<h3 id="_findlastkeyobject-predicate_identity"><code>_.findLastKey(object, [predicate=_.identity])</code></h3> 7297[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12915 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") [Ⓣ][1] 7298 7299This method is like `_.findKey` except that it iterates over elements of 7300a collection in the opposite order. 7301 7302#### Since 73032.0.0 7304 7305#### Arguments 73061. `object` *(Object)*: The object to inspect. 73072. `[predicate=_.identity]` *(Function)*: The function invoked per iteration. 7308 7309#### Returns 7310*(*)*: Returns the key of the matched element, else `undefined`. 7311 7312#### Example 7313```js 7314var users = { 7315 'barney': { 'age': 36, 'active': true }, 7316 'fred': { 'age': 40, 'active': false }, 7317 'pebbles': { 'age': 1, 'active': true } 7318}; 7319 7320_.findLastKey(users, function(o) { return o.age < 40; }); 7321// => returns 'pebbles' assuming `_.findKey` returns 'barney' 7322 7323// The `_.matches` iteratee shorthand. 7324_.findLastKey(users, { 'age': 36, 'active': true }); 7325// => 'barney' 7326 7327// The `_.matchesProperty` iteratee shorthand. 7328_.findLastKey(users, ['active', false]); 7329// => 'fred' 7330 7331// The `_.property` iteratee shorthand. 7332_.findLastKey(users, 'active'); 7333// => 'pebbles' 7334``` 7335--- 7336 7337<!-- /div --> 7338 7339<!-- div --> 7340 7341<h3 id="_forinobject-iteratee_identity"><code>_.forIn(object, [iteratee=_.identity])</code></h3> 7342[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12947 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") [Ⓣ][1] 7343 7344Iterates over own and inherited enumerable string keyed properties of an 7345object and invokes `iteratee` for each property. The iteratee is invoked 7346with three arguments: *(value, key, object)*. Iteratee functions may exit 7347iteration early by explicitly returning `false`. 7348 7349#### Since 73500.3.0 7351 7352#### Arguments 73531. `object` *(Object)*: The object to iterate over. 73542. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7355 7356#### Returns 7357*(Object)*: Returns `object`. 7358 7359#### Example 7360```js 7361function Foo() { 7362 this.a = 1; 7363 this.b = 2; 7364} 7365 7366Foo.prototype.c = 3; 7367 7368_.forIn(new Foo, function(value, key) { 7369 console.log(key); 7370}); 7371// => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 7372``` 7373--- 7374 7375<!-- /div --> 7376 7377<!-- div --> 7378 7379<h3 id="_forinrightobject-iteratee_identity"><code>_.forInRight(object, [iteratee=_.identity])</code></h3> 7380[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12979 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") [Ⓣ][1] 7381 7382This method is like `_.forIn` except that it iterates over properties of 7383`object` in the opposite order. 7384 7385#### Since 73862.0.0 7387 7388#### Arguments 73891. `object` *(Object)*: The object to iterate over. 73902. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7391 7392#### Returns 7393*(Object)*: Returns `object`. 7394 7395#### Example 7396```js 7397function Foo() { 7398 this.a = 1; 7399 this.b = 2; 7400} 7401 7402Foo.prototype.c = 3; 7403 7404_.forInRight(new Foo, function(value, key) { 7405 console.log(key); 7406}); 7407// => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 7408``` 7409--- 7410 7411<!-- /div --> 7412 7413<!-- div --> 7414 7415<h3 id="_forownobject-iteratee_identity"><code>_.forOwn(object, [iteratee=_.identity])</code></h3> 7416[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13013 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") [Ⓣ][1] 7417 7418Iterates over own enumerable string keyed properties of an object and 7419invokes `iteratee` for each property. The iteratee is invoked with three 7420arguments: *(value, key, object)*. Iteratee functions may exit iteration 7421early by explicitly returning `false`. 7422 7423#### Since 74240.3.0 7425 7426#### Arguments 74271. `object` *(Object)*: The object to iterate over. 74282. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7429 7430#### Returns 7431*(Object)*: Returns `object`. 7432 7433#### Example 7434```js 7435function Foo() { 7436 this.a = 1; 7437 this.b = 2; 7438} 7439 7440Foo.prototype.c = 3; 7441 7442_.forOwn(new Foo, function(value, key) { 7443 console.log(key); 7444}); 7445// => Logs 'a' then 'b' (iteration order is not guaranteed). 7446``` 7447--- 7448 7449<!-- /div --> 7450 7451<!-- div --> 7452 7453<h3 id="_forownrightobject-iteratee_identity"><code>_.forOwnRight(object, [iteratee=_.identity])</code></h3> 7454[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13043 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") [Ⓣ][1] 7455 7456This method is like `_.forOwn` except that it iterates over properties of 7457`object` in the opposite order. 7458 7459#### Since 74602.0.0 7461 7462#### Arguments 74631. `object` *(Object)*: The object to iterate over. 74642. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7465 7466#### Returns 7467*(Object)*: Returns `object`. 7468 7469#### Example 7470```js 7471function Foo() { 7472 this.a = 1; 7473 this.b = 2; 7474} 7475 7476Foo.prototype.c = 3; 7477 7478_.forOwnRight(new Foo, function(value, key) { 7479 console.log(key); 7480}); 7481// => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 7482``` 7483--- 7484 7485<!-- /div --> 7486 7487<!-- div --> 7488 7489<h3 id="_functionsobject"><code>_.functions(object)</code></h3> 7490[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13070 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") [Ⓣ][1] 7491 7492Creates an array of function property names from own enumerable properties 7493of `object`. 7494 7495#### Since 74960.1.0 7497 7498#### Arguments 74991. `object` *(Object)*: The object to inspect. 7500 7501#### Returns 7502*(Array)*: Returns the function names. 7503 7504#### Example 7505```js 7506function Foo() { 7507 this.a = _.constant('a'); 7508 this.b = _.constant('b'); 7509} 7510 7511Foo.prototype.c = _.constant('c'); 7512 7513_.functions(new Foo); 7514// => ['a', 'b'] 7515``` 7516--- 7517 7518<!-- /div --> 7519 7520<!-- div --> 7521 7522<h3 id="_functionsinobject"><code>_.functionsIn(object)</code></h3> 7523[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13097 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package") [Ⓣ][1] 7524 7525Creates an array of function property names from own and inherited 7526enumerable properties of `object`. 7527 7528#### Since 75294.0.0 7530 7531#### Arguments 75321. `object` *(Object)*: The object to inspect. 7533 7534#### Returns 7535*(Array)*: Returns the function names. 7536 7537#### Example 7538```js 7539function Foo() { 7540 this.a = _.constant('a'); 7541 this.b = _.constant('b'); 7542} 7543 7544Foo.prototype.c = _.constant('c'); 7545 7546_.functionsIn(new Foo); 7547// => ['a', 'b', 'c'] 7548``` 7549--- 7550 7551<!-- /div --> 7552 7553<!-- div --> 7554 7555<h3 id="_getobject-path-defaultvalue"><code>_.get(object, path, [defaultValue])</code></h3> 7556[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13126 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") [Ⓣ][1] 7557 7558Gets the value at `path` of `object`. If the resolved value is 7559`undefined`, the `defaultValue` is returned in its place. 7560 7561#### Since 75623.7.0 7563 7564#### Arguments 75651. `object` *(Object)*: The object to query. 75662. `path` *(Array|string)*: The path of the property to get. 75673. `[defaultValue]` *(*)*: The value returned for `undefined` resolved values. 7568 7569#### Returns 7570*(*)*: Returns the resolved value. 7571 7572#### Example 7573```js 7574var object = { 'a': [{ 'b': { 'c': 3 } }] }; 7575 7576_.get(object, 'a[0].b.c'); 7577// => 3 7578 7579_.get(object, ['a', '0', 'b', 'c']); 7580// => 3 7581 7582_.get(object, 'a.b.c', 'default'); 7583// => 'default' 7584``` 7585--- 7586 7587<!-- /div --> 7588 7589<!-- div --> 7590 7591<h3 id="_hasobject-path"><code>_.has(object, path)</code></h3> 7592[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13158 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") [Ⓣ][1] 7593 7594Checks if `path` is a direct property of `object`. 7595 7596#### Since 75970.1.0 7598 7599#### Arguments 76001. `object` *(Object)*: The object to query. 76012. `path` *(Array|string)*: The path to check. 7602 7603#### Returns 7604*(boolean)*: Returns `true` if `path` exists, else `false`. 7605 7606#### Example 7607```js 7608var object = { 'a': { 'b': 2 } }; 7609var other = _.create({ 'a': _.create({ 'b': 2 }) }); 7610 7611_.has(object, 'a'); 7612// => true 7613 7614_.has(object, 'a.b'); 7615// => true 7616 7617_.has(object, ['a', 'b']); 7618// => true 7619 7620_.has(other, 'a'); 7621// => false 7622``` 7623--- 7624 7625<!-- /div --> 7626 7627<!-- div --> 7628 7629<h3 id="_hasinobject-path"><code>_.hasIn(object, path)</code></h3> 7630[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13188 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package") [Ⓣ][1] 7631 7632Checks if `path` is a direct or inherited property of `object`. 7633 7634#### Since 76354.0.0 7636 7637#### Arguments 76381. `object` *(Object)*: The object to query. 76392. `path` *(Array|string)*: The path to check. 7640 7641#### Returns 7642*(boolean)*: Returns `true` if `path` exists, else `false`. 7643 7644#### Example 7645```js 7646var object = _.create({ 'a': _.create({ 'b': 2 }) }); 7647 7648_.hasIn(object, 'a'); 7649// => true 7650 7651_.hasIn(object, 'a.b'); 7652// => true 7653 7654_.hasIn(object, ['a', 'b']); 7655// => true 7656 7657_.hasIn(object, 'b'); 7658// => false 7659``` 7660--- 7661 7662<!-- /div --> 7663 7664<!-- div --> 7665 7666<h3 id="_invertobject"><code>_.invert(object)</code></h3> 7667[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13210 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") [Ⓣ][1] 7668 7669Creates an object composed of the inverted keys and values of `object`. 7670If `object` contains duplicate values, subsequent values overwrite 7671property assignments of previous values. 7672 7673#### Since 76740.7.0 7675 7676#### Arguments 76771. `object` *(Object)*: The object to invert. 7678 7679#### Returns 7680*(Object)*: Returns the new inverted object. 7681 7682#### Example 7683```js 7684var object = { 'a': 1, 'b': 2, 'c': 1 }; 7685 7686_.invert(object); 7687// => { '1': 'c', '2': 'b' } 7688``` 7689--- 7690 7691<!-- /div --> 7692 7693<!-- div --> 7694 7695<h3 id="_invertbyobject-iteratee_identity"><code>_.invertBy(object, [iteratee=_.identity])</code></h3> 7696[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13245 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invertby "See the npm package") [Ⓣ][1] 7697 7698This method is like `_.invert` except that the inverted object is generated 7699from the results of running each element of `object` thru `iteratee`. The 7700corresponding inverted value of each inverted key is an array of keys 7701responsible for generating the inverted value. The iteratee is invoked 7702with one argument: *(value)*. 7703 7704#### Since 77054.1.0 7706 7707#### Arguments 77081. `object` *(Object)*: The object to invert. 77092. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element. 7710 7711#### Returns 7712*(Object)*: Returns the new inverted object. 7713 7714#### Example 7715```js 7716var object = { 'a': 1, 'b': 2, 'c': 1 }; 7717 7718_.invertBy(object); 7719// => { '1': ['a', 'c'], '2': ['b'] } 7720 7721_.invertBy(object, function(value) { 7722 return 'group' + value; 7723}); 7724// => { 'group1': ['a', 'c'], 'group2': ['b'] } 7725``` 7726--- 7727 7728<!-- /div --> 7729 7730<!-- div --> 7731 7732<h3 id="_invokeobject-path-args"><code>_.invoke(object, path, [args])</code></h3> 7733[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13276 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") [Ⓣ][1] 7734 7735Invokes the method at `path` of `object`. 7736 7737#### Since 77384.0.0 7739 7740#### Arguments 77411. `object` *(Object)*: The object to query. 77422. `path` *(Array|string)*: The path of the method to invoke. 77433. `[args]` *(...*)*: The arguments to invoke the method with. 7744 7745#### Returns 7746*(*)*: Returns the result of the invoked method. 7747 7748#### Example 7749```js 7750var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 7751 7752_.invoke(object, 'a[0].b.c.slice', 1, 3); 7753// => [2, 3] 7754``` 7755--- 7756 7757<!-- /div --> 7758 7759<!-- div --> 7760 7761<h3 id="_keysobject"><code>_.keys(object)</code></h3> 7762[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13306 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") [Ⓣ][1] 7763 7764Creates an array of the own enumerable property names of `object`. 7765<br> 7766<br> 7767**Note:** Non-object values are coerced to objects. See the 7768[ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 7769for more details. 7770 7771#### Since 77720.1.0 7773 7774#### Arguments 77751. `object` *(Object)*: The object to query. 7776 7777#### Returns 7778*(Array)*: Returns the array of property names. 7779 7780#### Example 7781```js 7782function Foo() { 7783 this.a = 1; 7784 this.b = 2; 7785} 7786 7787Foo.prototype.c = 3; 7788 7789_.keys(new Foo); 7790// => ['a', 'b'] (iteration order is not guaranteed) 7791 7792_.keys('hi'); 7793// => ['0', '1'] 7794``` 7795--- 7796 7797<!-- /div --> 7798 7799<!-- div --> 7800 7801<h3 id="_keysinobject"><code>_.keysIn(object)</code></h3> 7802[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13333 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") [Ⓣ][1] 7803 7804Creates an array of the own and inherited enumerable property names of `object`. 7805<br> 7806<br> 7807**Note:** Non-object values are coerced to objects. 7808 7809#### Since 78103.0.0 7811 7812#### Arguments 78131. `object` *(Object)*: The object to query. 7814 7815#### Returns 7816*(Array)*: Returns the array of property names. 7817 7818#### Example 7819```js 7820function Foo() { 7821 this.a = 1; 7822 this.b = 2; 7823} 7824 7825Foo.prototype.c = 3; 7826 7827_.keysIn(new Foo); 7828// => ['a', 'b', 'c'] (iteration order is not guaranteed) 7829``` 7830--- 7831 7832<!-- /div --> 7833 7834<!-- div --> 7835 7836<h3 id="_mapkeysobject-iteratee_identity"><code>_.mapKeys(object, [iteratee=_.identity])</code></h3> 7837[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13358 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package") [Ⓣ][1] 7838 7839The opposite of `_.mapValues`; this method creates an object with the 7840same values as `object` and keys generated by running each own enumerable 7841string keyed property of `object` thru `iteratee`. The iteratee is invoked 7842with three arguments: *(value, key, object)*. 7843 7844#### Since 78453.8.0 7846 7847#### Arguments 78481. `object` *(Object)*: The object to iterate over. 78492. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7850 7851#### Returns 7852*(Object)*: Returns the new mapped object. 7853 7854#### Example 7855```js 7856_.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 7857 return key + value; 7858}); 7859// => { 'a1': 1, 'b2': 2 } 7860``` 7861--- 7862 7863<!-- /div --> 7864 7865<!-- div --> 7866 7867<h3 id="_mapvaluesobject-iteratee_identity"><code>_.mapValues(object, [iteratee=_.identity])</code></h3> 7868[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13396 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") [Ⓣ][1] 7869 7870Creates an object with the same keys as `object` and values generated 7871by running each own enumerable string keyed property of `object` thru 7872`iteratee`. The iteratee is invoked with three arguments:<br> 7873*(value, key, object)*. 7874 7875#### Since 78762.4.0 7877 7878#### Arguments 78791. `object` *(Object)*: The object to iterate over. 78802. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 7881 7882#### Returns 7883*(Object)*: Returns the new mapped object. 7884 7885#### Example 7886```js 7887var users = { 7888 'fred': { 'user': 'fred', 'age': 40 }, 7889 'pebbles': { 'user': 'pebbles', 'age': 1 } 7890}; 7891 7892_.mapValues(users, function(o) { return o.age; }); 7893// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 7894 7895// The `_.property` iteratee shorthand. 7896_.mapValues(users, 'age'); 7897// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 7898``` 7899--- 7900 7901<!-- /div --> 7902 7903<!-- div --> 7904 7905<h3 id="_mergeobject-sources"><code>_.merge(object, [sources])</code></h3> 7906[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13437 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") [Ⓣ][1] 7907 7908This method is like `_.assign` except that it recursively merges own and 7909inherited enumerable string keyed properties of source objects into the 7910destination object. Source properties that resolve to `undefined` are 7911skipped if a destination value exists. Array and plain object properties 7912are merged recursively. Other objects and value types are overridden by 7913assignment. Source objects are applied from left to right. Subsequent 7914sources overwrite property assignments of previous sources. 7915<br> 7916<br> 7917**Note:** This method mutates `object`. 7918 7919#### Since 79200.5.0 7921 7922#### Arguments 79231. `object` *(Object)*: The destination object. 79242. `[sources]` *(...Object)*: The source objects. 7925 7926#### Returns 7927*(Object)*: Returns `object`. 7928 7929#### Example 7930```js 7931var object = { 7932 'a': [{ 'b': 2 }, { 'd': 4 }] 7933}; 7934 7935var other = { 7936 'a': [{ 'c': 3 }, { 'e': 5 }] 7937}; 7938 7939_.merge(object, other); 7940// => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 7941``` 7942--- 7943 7944<!-- /div --> 7945 7946<!-- div --> 7947 7948<h3 id="_mergewithobject-sources-customizer"><code>_.mergeWith(object, sources, customizer)</code></h3> 7949[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13472 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package") [Ⓣ][1] 7950 7951This method is like `_.merge` except that it accepts `customizer` which 7952is invoked to produce the merged values of the destination and source 7953properties. If `customizer` returns `undefined`, merging is handled by the 7954method instead. The `customizer` is invoked with six arguments:<br> 7955*(objValue, srcValue, key, object, source, stack)*. 7956<br> 7957<br> 7958**Note:** This method mutates `object`. 7959 7960#### Since 79614.0.0 7962 7963#### Arguments 79641. `object` *(Object)*: The destination object. 79652. `sources` *(...Object)*: The source objects. 79663. `customizer` *(Function)*: The function to customize assigned values. 7967 7968#### Returns 7969*(Object)*: Returns `object`. 7970 7971#### Example 7972```js 7973function customizer(objValue, srcValue) { 7974 if (_.isArray(objValue)) { 7975 return objValue.concat(srcValue); 7976 } 7977} 7978 7979var object = { 'a': [1], 'b': [2] }; 7980var other = { 'a': [3], 'b': [4] }; 7981 7982_.mergeWith(object, other, customizer); 7983// => { 'a': [1, 3], 'b': [2, 4] } 7984``` 7985--- 7986 7987<!-- /div --> 7988 7989<!-- div --> 7990 7991<h3 id="_omitobject-paths"><code>_.omit(object, [paths])</code></h3> 7992[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13496 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") [Ⓣ][1] 7993 7994The opposite of `_.pick`; this method creates an object composed of the 7995own and inherited enumerable property paths of `object` that are not omitted. 7996<br> 7997<br> 7998**Note:** This method is considerably slower than `_.pick`. 7999 8000#### Since 80010.1.0 8002 8003#### Arguments 80041. `object` *(Object)*: The source object. 80052. `[paths]` *(...(string|string[]))*: The property paths to omit. 8006 8007#### Returns 8008*(Object)*: Returns the new object. 8009 8010#### Example 8011```js 8012var object = { 'a': 1, 'b': '2', 'c': 3 }; 8013 8014_.omit(object, ['a', 'c']); 8015// => { 'b': '2' } 8016``` 8017--- 8018 8019<!-- /div --> 8020 8021<!-- div --> 8022 8023<h3 id="_omitbyobject-predicate_identity"><code>_.omitBy(object, [predicate=_.identity])</code></h3> 8024[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13538 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package") [Ⓣ][1] 8025 8026The opposite of `_.pickBy`; this method creates an object composed of 8027the own and inherited enumerable string keyed properties of `object` that 8028`predicate` doesn't return truthy for. The predicate is invoked with two 8029arguments: *(value, key)*. 8030 8031#### Since 80324.0.0 8033 8034#### Arguments 80351. `object` *(Object)*: The source object. 80362. `[predicate=_.identity]` *(Function)*: The function invoked per property. 8037 8038#### Returns 8039*(Object)*: Returns the new object. 8040 8041#### Example 8042```js 8043var object = { 'a': 1, 'b': '2', 'c': 3 }; 8044 8045_.omitBy(object, _.isNumber); 8046// => { 'b': '2' } 8047``` 8048--- 8049 8050<!-- /div --> 8051 8052<!-- div --> 8053 8054<h3 id="_pickobject-paths"><code>_.pick(object, [paths])</code></h3> 8055[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13559 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") [Ⓣ][1] 8056 8057Creates an object composed of the picked `object` properties. 8058 8059#### Since 80600.1.0 8061 8062#### Arguments 80631. `object` *(Object)*: The source object. 80642. `[paths]` *(...(string|string[]))*: The property paths to pick. 8065 8066#### Returns 8067*(Object)*: Returns the new object. 8068 8069#### Example 8070```js 8071var object = { 'a': 1, 'b': '2', 'c': 3 }; 8072 8073_.pick(object, ['a', 'c']); 8074// => { 'a': 1, 'c': 3 } 8075``` 8076--- 8077 8078<!-- /div --> 8079 8080<!-- div --> 8081 8082<h3 id="_pickbyobject-predicate_identity"><code>_.pickBy(object, [predicate=_.identity])</code></h3> 8083[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13581 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package") [Ⓣ][1] 8084 8085Creates an object composed of the `object` properties `predicate` returns 8086truthy for. The predicate is invoked with two arguments: *(value, key)*. 8087 8088#### Since 80894.0.0 8090 8091#### Arguments 80921. `object` *(Object)*: The source object. 80932. `[predicate=_.identity]` *(Function)*: The function invoked per property. 8094 8095#### Returns 8096*(Object)*: Returns the new object. 8097 8098#### Example 8099```js 8100var object = { 'a': 1, 'b': '2', 'c': 3 }; 8101 8102_.pickBy(object, _.isNumber); 8103// => { 'a': 1, 'c': 3 } 8104``` 8105--- 8106 8107<!-- /div --> 8108 8109<!-- div --> 8110 8111<h3 id="_resultobject-path-defaultvalue"><code>_.result(object, path, [defaultValue])</code></h3> 8112[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13623 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") [Ⓣ][1] 8113 8114This method is like `_.get` except that if the resolved value is a 8115function it's invoked with the `this` binding of its parent object and 8116its result is returned. 8117 8118#### Since 81190.1.0 8120 8121#### Arguments 81221. `object` *(Object)*: The object to query. 81232. `path` *(Array|string)*: The path of the property to resolve. 81243. `[defaultValue]` *(*)*: The value returned for `undefined` resolved values. 8125 8126#### Returns 8127*(*)*: Returns the resolved value. 8128 8129#### Example 8130```js 8131var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 8132 8133_.result(object, 'a[0].b.c1'); 8134// => 3 8135 8136_.result(object, 'a[0].b.c2'); 8137// => 4 8138 8139_.result(object, 'a[0].b.c3', 'default'); 8140// => 'default' 8141 8142_.result(object, 'a[0].b.c3', _.constant('default')); 8143// => 'default' 8144``` 8145--- 8146 8147<!-- /div --> 8148 8149<!-- div --> 8150 8151<h3 id="_setobject-path-value"><code>_.set(object, path, value)</code></h3> 8152[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13673 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") [Ⓣ][1] 8153 8154Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 8155it's created. Arrays are created for missing index properties while objects 8156are created for all other missing properties. Use `_.setWith` to customize 8157`path` creation. 8158<br> 8159<br> 8160**Note:** This method mutates `object`. 8161 8162#### Since 81633.7.0 8164 8165#### Arguments 81661. `object` *(Object)*: The object to modify. 81672. `path` *(Array|string)*: The path of the property to set. 81683. `value` *(*)*: The value to set. 8169 8170#### Returns 8171*(Object)*: Returns `object`. 8172 8173#### Example 8174```js 8175var object = { 'a': [{ 'b': { 'c': 3 } }] }; 8176 8177_.set(object, 'a[0].b.c', 4); 8178console.log(object.a[0].b.c); 8179// => 4 8180 8181_.set(object, ['x', '0', 'y', 'z'], 5); 8182console.log(object.x[0].y.z); 8183// => 5 8184``` 8185--- 8186 8187<!-- /div --> 8188 8189<!-- div --> 8190 8191<h3 id="_setwithobject-path-value-customizer"><code>_.setWith(object, path, value, [customizer])</code></h3> 8192[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13701 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package") [Ⓣ][1] 8193 8194This method is like `_.set` except that it accepts `customizer` which is 8195invoked to produce the objects of `path`. If `customizer` returns `undefined` 8196path creation is handled by the method instead. The `customizer` is invoked 8197with three arguments: *(nsValue, key, nsObject)*. 8198<br> 8199<br> 8200**Note:** This method mutates `object`. 8201 8202#### Since 82034.0.0 8204 8205#### Arguments 82061. `object` *(Object)*: The object to modify. 82072. `path` *(Array|string)*: The path of the property to set. 82083. `value` *(*)*: The value to set. 82094. `[customizer]` *(Function)*: The function to customize assigned values. 8210 8211#### Returns 8212*(Object)*: Returns `object`. 8213 8214#### Example 8215```js 8216var object = {}; 8217 8218_.setWith(object, '[0][1]', 'a', Object); 8219// => { '0': { '1': 'a' } } 8220``` 8221--- 8222 8223<!-- /div --> 8224 8225<!-- div --> 8226 8227<h3 id="_topairsobject"><code>_.toPairs(object)</code></h3> 8228[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13730 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package") [Ⓣ][1] 8229 8230Creates an array of own enumerable string keyed-value pairs for `object` 8231which can be consumed by `_.fromPairs`. If `object` is a map or set, its 8232entries are returned. 8233 8234#### Since 82354.0.0 8236 8237#### Aliases 8238*_.entries* 8239 8240#### Arguments 82411. `object` *(Object)*: The object to query. 8242 8243#### Returns 8244*(Array)*: Returns the key-value pairs. 8245 8246#### Example 8247```js 8248function Foo() { 8249 this.a = 1; 8250 this.b = 2; 8251} 8252 8253Foo.prototype.c = 3; 8254 8255_.toPairs(new Foo); 8256// => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 8257``` 8258--- 8259 8260<!-- /div --> 8261 8262<!-- div --> 8263 8264<h3 id="_topairsinobject"><code>_.toPairsIn(object)</code></h3> 8265[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13756 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package") [Ⓣ][1] 8266 8267Creates an array of own and inherited enumerable string keyed-value pairs 8268for `object` which can be consumed by `_.fromPairs`. If `object` is a map 8269or set, its entries are returned. 8270 8271#### Since 82724.0.0 8273 8274#### Aliases 8275*_.entriesIn* 8276 8277#### Arguments 82781. `object` *(Object)*: The object to query. 8279 8280#### Returns 8281*(Array)*: Returns the key-value pairs. 8282 8283#### Example 8284```js 8285function Foo() { 8286 this.a = 1; 8287 this.b = 2; 8288} 8289 8290Foo.prototype.c = 3; 8291 8292_.toPairsIn(new Foo); 8293// => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 8294``` 8295--- 8296 8297<!-- /div --> 8298 8299<!-- div --> 8300 8301<h3 id="_transformobject-iteratee_identity-accumulator"><code>_.transform(object, [iteratee=_.identity], [accumulator])</code></h3> 8302[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13788 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") [Ⓣ][1] 8303 8304An alternative to `_.reduce`; this method transforms `object` to a new 8305`accumulator` object which is the result of running each of its own 8306enumerable string keyed properties thru `iteratee`, with each invocation 8307potentially mutating the `accumulator` object. If `accumulator` is not 8308provided, a new object with the same `[[Prototype]]` will be used. The 8309iteratee is invoked with four arguments: *(accumulator, value, key, object)*. 8310Iteratee functions may exit iteration early by explicitly returning `false`. 8311 8312#### Since 83131.3.0 8314 8315#### Arguments 83161. `object` *(Object)*: The object to iterate over. 83172. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 83183. `[accumulator]` *(*)*: The custom accumulator value. 8319 8320#### Returns 8321*(*)*: Returns the accumulated value. 8322 8323#### Example 8324```js 8325_.transform([2, 3, 4], function(result, n) { 8326 result.push(n *= n); 8327 return n % 2 == 0; 8328}, []); 8329// => [4, 9] 8330 8331_.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 8332 (result[value] || (result[value] = [])).push(key); 8333}, {}); 8334// => { '1': ['a', 'c'], '2': ['b'] } 8335``` 8336--- 8337 8338<!-- /div --> 8339 8340<!-- div --> 8341 8342<h3 id="_unsetobject-path"><code>_.unset(object, path)</code></h3> 8343[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13838 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package") [Ⓣ][1] 8344 8345Removes the property at `path` of `object`. 8346<br> 8347<br> 8348**Note:** This method mutates `object`. 8349 8350#### Since 83514.0.0 8352 8353#### Arguments 83541. `object` *(Object)*: The object to modify. 83552. `path` *(Array|string)*: The path of the property to unset. 8356 8357#### Returns 8358*(boolean)*: Returns `true` if the property is deleted, else `false`. 8359 8360#### Example 8361```js 8362var object = { 'a': [{ 'b': { 'c': 7 } }] }; 8363_.unset(object, 'a[0].b.c'); 8364// => true 8365 8366console.log(object); 8367// => { 'a': [{ 'b': {} }] }; 8368 8369_.unset(object, ['a', '0', 'b', 'c']); 8370// => true 8371 8372console.log(object); 8373// => { 'a': [{ 'b': {} }] }; 8374``` 8375--- 8376 8377<!-- /div --> 8378 8379<!-- div --> 8380 8381<h3 id="_updateobject-path-updater"><code>_.update(object, path, updater)</code></h3> 8382[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13869 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.update "See the npm package") [Ⓣ][1] 8383 8384This method is like `_.set` except that accepts `updater` to produce the 8385value to set. Use `_.updateWith` to customize `path` creation. The `updater` 8386is invoked with one argument: *(value)*. 8387<br> 8388<br> 8389**Note:** This method mutates `object`. 8390 8391#### Since 83924.6.0 8393 8394#### Arguments 83951. `object` *(Object)*: The object to modify. 83962. `path` *(Array|string)*: The path of the property to set. 83973. `updater` *(Function)*: The function to produce the updated value. 8398 8399#### Returns 8400*(Object)*: Returns `object`. 8401 8402#### Example 8403```js 8404var object = { 'a': [{ 'b': { 'c': 3 } }] }; 8405 8406_.update(object, 'a[0].b.c', function(n) { return n * n; }); 8407console.log(object.a[0].b.c); 8408// => 9 8409 8410_.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 8411console.log(object.x[0].y.z); 8412// => 0 8413``` 8414--- 8415 8416<!-- /div --> 8417 8418<!-- div --> 8419 8420<h3 id="_updatewithobject-path-updater-customizer"><code>_.updateWith(object, path, updater, [customizer])</code></h3> 8421[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13897 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.updatewith "See the npm package") [Ⓣ][1] 8422 8423This method is like `_.update` except that it accepts `customizer` which is 8424invoked to produce the objects of `path`. If `customizer` returns `undefined` 8425path creation is handled by the method instead. The `customizer` is invoked 8426with three arguments: *(nsValue, key, nsObject)*. 8427<br> 8428<br> 8429**Note:** This method mutates `object`. 8430 8431#### Since 84324.6.0 8433 8434#### Arguments 84351. `object` *(Object)*: The object to modify. 84362. `path` *(Array|string)*: The path of the property to set. 84373. `updater` *(Function)*: The function to produce the updated value. 84384. `[customizer]` *(Function)*: The function to customize assigned values. 8439 8440#### Returns 8441*(Object)*: Returns `object`. 8442 8443#### Example 8444```js 8445var object = {}; 8446 8447_.updateWith(object, '[0][1]', _.constant('a'), Object); 8448// => { '0': { '1': 'a' } } 8449``` 8450--- 8451 8452<!-- /div --> 8453 8454<!-- div --> 8455 8456<h3 id="_valuesobject"><code>_.values(object)</code></h3> 8457[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13928 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") [Ⓣ][1] 8458 8459Creates an array of the own enumerable string keyed property values of `object`. 8460<br> 8461<br> 8462**Note:** Non-object values are coerced to objects. 8463 8464#### Since 84650.1.0 8466 8467#### Arguments 84681. `object` *(Object)*: The object to query. 8469 8470#### Returns 8471*(Array)*: Returns the array of property values. 8472 8473#### Example 8474```js 8475function Foo() { 8476 this.a = 1; 8477 this.b = 2; 8478} 8479 8480Foo.prototype.c = 3; 8481 8482_.values(new Foo); 8483// => [1, 2] (iteration order is not guaranteed) 8484 8485_.values('hi'); 8486// => ['h', 'i'] 8487``` 8488--- 8489 8490<!-- /div --> 8491 8492<!-- div --> 8493 8494<h3 id="_valuesinobject"><code>_.valuesIn(object)</code></h3> 8495[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13956 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") [Ⓣ][1] 8496 8497Creates an array of the own and inherited enumerable string keyed property 8498values of `object`. 8499<br> 8500<br> 8501**Note:** Non-object values are coerced to objects. 8502 8503#### Since 85043.0.0 8505 8506#### Arguments 85071. `object` *(Object)*: The object to query. 8508 8509#### Returns 8510*(Array)*: Returns the array of property values. 8511 8512#### Example 8513```js 8514function Foo() { 8515 this.a = 1; 8516 this.b = 2; 8517} 8518 8519Foo.prototype.c = 3; 8520 8521_.valuesIn(new Foo); 8522// => [1, 2, 3] (iteration order is not guaranteed) 8523``` 8524--- 8525 8526<!-- /div --> 8527 8528<!-- /div --> 8529 8530<!-- div --> 8531 8532## `“Seq” Methods` 8533 8534<!-- div --> 8535 8536<h3 id="_value"><code>_(value)</code></h3> 8537[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1648 "View in source") [Ⓣ][1] 8538 8539Creates a `lodash` object which wraps `value` to enable implicit method 8540chain sequences. Methods that operate on and return arrays, collections, 8541and functions can be chained together. Methods that retrieve a single value 8542or may return a primitive value will automatically end the chain sequence 8543and return the unwrapped value. Otherwise, the value must be unwrapped 8544with `_#value`. 8545<br> 8546<br> 8547Explicit chain sequences, which must be unwrapped with `_#value`, may be 8548enabled using `_.chain`. 8549<br> 8550<br> 8551The execution of chained methods is lazy, that is, it's deferred until 8552`_#value` is implicitly or explicitly called. 8553<br> 8554<br> 8555Lazy evaluation allows several methods to support shortcut fusion. 8556Shortcut fusion is an optimization to merge iteratee calls; this avoids 8557the creation of intermediate arrays and can greatly reduce the number of 8558iteratee executions. Sections of a chain sequence qualify for shortcut 8559fusion if the section is applied to an array and iteratees accept only 8560one argument. The heuristic for whether a section qualifies for shortcut 8561fusion is subject to change. 8562<br> 8563<br> 8564Chaining is supported in custom builds as long as the `_#value` method is 8565directly or indirectly included in the build. 8566<br> 8567<br> 8568In addition to lodash methods, wrappers have `Array` and `String` methods. 8569<br> 8570<br> 8571The wrapper `Array` methods are:<br> 8572`concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 8573<br> 8574<br> 8575The wrapper `String` methods are:<br> 8576`replace` and `split` 8577<br> 8578<br> 8579The wrapper methods that support shortcut fusion are:<br> 8580`at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 8581`findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 8582`tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 8583<br> 8584<br> 8585The chainable wrapper methods are:<br> 8586`after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 8587`before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 8588`commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 8589`curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 8590`difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 8591`dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 8592`flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 8593`flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 8594`functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 8595`intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 8596`keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 8597`memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 8598`nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 8599`overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 8600`pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 8601`pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 8602`remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 8603`slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 8604`takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 8605`toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 8606`union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 8607`unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 8608`valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 8609`zipObject`, `zipObjectDeep`, and `zipWith` 8610<br> 8611<br> 8612The wrapper methods that are **not** chainable by default are:<br> 8613`add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 8614`cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 8615`defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 8616`escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 8617`findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 8618`forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 8619`hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 8620`isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 8621`isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 8622`isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 8623`isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 8624`isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 8625`isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 8626`isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 8627`lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 8628`min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 8629`padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 8630`repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 8631`snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 8632`sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 8633`stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 8634`template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 8635`toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 8636`trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 8637`upperFirst`, `value`, and `words` 8638 8639#### Arguments 86401. `value` *(*)*: The value to wrap in a `lodash` instance. 8641 8642#### Returns 8643*(Object)*: Returns the new `lodash` wrapper instance. 8644 8645#### Example 8646```js 8647function square(n) { 8648 return n * n; 8649} 8650 8651var wrapped = _([1, 2, 3]); 8652 8653// Returns an unwrapped value. 8654wrapped.reduce(_.add); 8655// => 6 8656 8657// Returns a wrapped value. 8658var squares = wrapped.map(square); 8659 8660_.isArray(squares); 8661// => false 8662 8663_.isArray(squares.value()); 8664// => true 8665``` 8666--- 8667 8668<!-- /div --> 8669 8670<!-- div --> 8671 8672<h3 id="_chainvalue"><code>_.chain(value)</code></h3> 8673[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8737 "View in source") [Ⓣ][1] 8674 8675Creates a `lodash` wrapper instance that wraps `value` with explicit method 8676chain sequences enabled. The result of such sequences must be unwrapped 8677with `_#value`. 8678 8679#### Since 86801.3.0 8681 8682#### Arguments 86831. `value` *(*)*: The value to wrap. 8684 8685#### Returns 8686*(Object)*: Returns the new `lodash` wrapper instance. 8687 8688#### Example 8689```js 8690var users = [ 8691 { 'user': 'barney', 'age': 36 }, 8692 { 'user': 'fred', 'age': 40 }, 8693 { 'user': 'pebbles', 'age': 1 } 8694]; 8695 8696var youngest = _ 8697 .chain(users) 8698 .sortBy('age') 8699 .map(function(o) { 8700 return o.user + ' is ' + o.age; 8701 }) 8702 .head() 8703 .value(); 8704// => 'pebbles is 1' 8705``` 8706--- 8707 8708<!-- /div --> 8709 8710<!-- div --> 8711 8712<h3 id="_tapvalue-interceptor"><code>_.tap(value, interceptor)</code></h3> 8713[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8766 "View in source") [Ⓣ][1] 8714 8715This method invokes `interceptor` and returns `value`. The interceptor 8716is invoked with one argument; *(value)*. The purpose of this method is to 8717"tap into" a method chain sequence in order to modify intermediate results. 8718 8719#### Since 87200.1.0 8721 8722#### Arguments 87231. `value` *(*)*: The value to provide to `interceptor`. 87242. `interceptor` *(Function)*: The function to invoke. 8725 8726#### Returns 8727*(*)*: Returns `value`. 8728 8729#### Example 8730```js 8731_([1, 2, 3]) 8732 .tap(function(array) { 8733 // Mutate input array. 8734 array.pop(); 8735 }) 8736 .reverse() 8737 .value(); 8738// => [2, 1] 8739``` 8740--- 8741 8742<!-- /div --> 8743 8744<!-- div --> 8745 8746<h3 id="_thruvalue-interceptor"><code>_.thru(value, interceptor)</code></h3> 8747[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8794 "View in source") [Ⓣ][1] 8748 8749This method is like `_.tap` except that it returns the result of `interceptor`. 8750The purpose of this method is to "pass thru" values replacing intermediate 8751results in a method chain sequence. 8752 8753#### Since 87543.0.0 8755 8756#### Arguments 87571. `value` *(*)*: The value to provide to `interceptor`. 87582. `interceptor` *(Function)*: The function to invoke. 8759 8760#### Returns 8761*(*)*: Returns the result of `interceptor`. 8762 8763#### Example 8764```js 8765_(' abc ') 8766 .chain() 8767 .trim() 8768 .thru(function(value) { 8769 return [value]; 8770 }) 8771 .value(); 8772// => ['abc'] 8773``` 8774--- 8775 8776<!-- /div --> 8777 8778<!-- div --> 8779 8780<h3 id="_prototypesymboliterator"><code>_.prototype[Symbol.iterator]()</code></h3> 8781[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8949 "View in source") [Ⓣ][1] 8782 8783Enables the wrapper to be iterable. 8784 8785#### Since 87864.0.0 8787 8788#### Returns 8789*(Object)*: Returns the wrapper object. 8790 8791#### Example 8792```js 8793var wrapped = _([1, 2]); 8794 8795wrapped[Symbol.iterator]() === wrapped; 8796// => true 8797 8798Array.from(wrapped); 8799// => [1, 2] 8800``` 8801--- 8802 8803<!-- /div --> 8804 8805<!-- div --> 8806 8807<h3 id="_prototypeatpaths"><code>_.prototype.at([paths])</code></h3> 8808[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8814 "View in source") [Ⓣ][1] 8809 8810This method is the wrapper version of `_.at`. 8811 8812#### Since 88131.0.0 8814 8815#### Arguments 88161. `[paths]` *(...(string|string[]))*: The property paths to pick. 8817 8818#### Returns 8819*(Object)*: Returns the new `lodash` wrapper instance. 8820 8821#### Example 8822```js 8823var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 8824 8825_(object).at(['a[0].b.c', 'a[1]']).value(); 8826// => [3, 4] 8827``` 8828--- 8829 8830<!-- /div --> 8831 8832<!-- div --> 8833 8834<h3 id="_prototypechain"><code>_.prototype.chain()</code></h3> 8835[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8865 "View in source") [Ⓣ][1] 8836 8837Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 8838 8839#### Since 88400.1.0 8841 8842#### Returns 8843*(Object)*: Returns the new `lodash` wrapper instance. 8844 8845#### Example 8846```js 8847var users = [ 8848 { 'user': 'barney', 'age': 36 }, 8849 { 'user': 'fred', 'age': 40 } 8850]; 8851 8852// A sequence without explicit chaining. 8853_(users).head(); 8854// => { 'user': 'barney', 'age': 36 } 8855 8856// A sequence with explicit chaining. 8857_(users) 8858 .chain() 8859 .head() 8860 .pick('user') 8861 .value(); 8862// => { 'user': 'barney' } 8863``` 8864--- 8865 8866<!-- /div --> 8867 8868<!-- div --> 8869 8870<h3 id="_prototypecommit"><code>_.prototype.commit()</code></h3> 8871[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8895 "View in source") [Ⓣ][1] 8872 8873Executes the chain sequence and returns the wrapped result. 8874 8875#### Since 88763.2.0 8877 8878#### Returns 8879*(Object)*: Returns the new `lodash` wrapper instance. 8880 8881#### Example 8882```js 8883var array = [1, 2]; 8884var wrapped = _(array).push(3); 8885 8886console.log(array); 8887// => [1, 2] 8888 8889wrapped = wrapped.commit(); 8890console.log(array); 8891// => [1, 2, 3] 8892 8893wrapped.last(); 8894// => 3 8895 8896console.log(array); 8897// => [1, 2, 3] 8898``` 8899--- 8900 8901<!-- /div --> 8902 8903<!-- div --> 8904 8905<h3 id="_prototypenext"><code>_.prototype.next()</code></h3> 8906[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8921 "View in source") [Ⓣ][1] 8907 8908Gets the next value on a wrapped object following the 8909[iterator protocol](https://mdn.io/iteration_protocols#iterator). 8910 8911#### Since 89124.0.0 8913 8914#### Returns 8915*(Object)*: Returns the next iterator value. 8916 8917#### Example 8918```js 8919var wrapped = _([1, 2]); 8920 8921wrapped.next(); 8922// => { 'done': false, 'value': 1 } 8923 8924wrapped.next(); 8925// => { 'done': false, 'value': 2 } 8926 8927wrapped.next(); 8928// => { 'done': true, 'value': undefined } 8929``` 8930--- 8931 8932<!-- /div --> 8933 8934<!-- div --> 8935 8936<h3 id="_prototypeplantvalue"><code>_.prototype.plant(value)</code></h3> 8937[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L8977 "View in source") [Ⓣ][1] 8938 8939Creates a clone of the chain sequence planting `value` as the wrapped value. 8940 8941#### Since 89423.2.0 8943 8944#### Arguments 89451. `value` *(*)*: The value to plant. 8946 8947#### Returns 8948*(Object)*: Returns the new `lodash` wrapper instance. 8949 8950#### Example 8951```js 8952function square(n) { 8953 return n * n; 8954} 8955 8956var wrapped = _([1, 2]).map(square); 8957var other = wrapped.plant([3, 4]); 8958 8959other.value(); 8960// => [9, 16] 8961 8962wrapped.value(); 8963// => [1, 4] 8964``` 8965--- 8966 8967<!-- /div --> 8968 8969<!-- div --> 8970 8971<h3 id="_prototypereverse"><code>_.prototype.reverse()</code></h3> 8972[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9017 "View in source") [Ⓣ][1] 8973 8974This method is the wrapper version of `_.reverse`. 8975<br> 8976<br> 8977**Note:** This method mutates the wrapped array. 8978 8979#### Since 89800.1.0 8981 8982#### Returns 8983*(Object)*: Returns the new `lodash` wrapper instance. 8984 8985#### Example 8986```js 8987var array = [1, 2, 3]; 8988 8989_(array).reverse().value() 8990// => [3, 2, 1] 8991 8992console.log(array); 8993// => [3, 2, 1] 8994``` 8995--- 8996 8997<!-- /div --> 8998 8999<!-- div --> 9000 9001<h3 id="_prototypevalue"><code>_.prototype.value()</code></h3> 9002[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9049 "View in source") [Ⓣ][1] 9003 9004Executes the chain sequence to resolve the unwrapped value. 9005 9006#### Since 90070.1.0 9008 9009#### Aliases 9010*_.prototype.toJSON, _.prototype.valueOf* 9011 9012#### Returns 9013*(*)*: Returns the resolved unwrapped value. 9014 9015#### Example 9016```js 9017_([1, 2, 3]).value(); 9018// => [1, 2, 3] 9019``` 9020--- 9021 9022<!-- /div --> 9023 9024<!-- /div --> 9025 9026<!-- div --> 9027 9028## `“String” Methods` 9029 9030<!-- div --> 9031 9032<h3 id="_camelcasestring"><code>_.camelCase([string=''])</code></h3> 9033[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14139 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") [Ⓣ][1] 9034 9035Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 9036 9037#### Since 90383.0.0 9039 9040#### Arguments 90411. `[string='']` *(string)*: The string to convert. 9042 9043#### Returns 9044*(string)*: Returns the camel cased string. 9045 9046#### Example 9047```js 9048_.camelCase('Foo Bar'); 9049// => 'fooBar' 9050 9051_.camelCase('--foo-bar--'); 9052// => 'fooBar' 9053 9054_.camelCase('__FOO_BAR__'); 9055// => 'fooBar' 9056``` 9057--- 9058 9059<!-- /div --> 9060 9061<!-- div --> 9062 9063<h3 id="_capitalizestring"><code>_.capitalize([string=''])</code></h3> 9064[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14159 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") [Ⓣ][1] 9065 9066Converts the first character of `string` to upper case and the remaining 9067to lower case. 9068 9069#### Since 90703.0.0 9071 9072#### Arguments 90731. `[string='']` *(string)*: The string to capitalize. 9074 9075#### Returns 9076*(string)*: Returns the capitalized string. 9077 9078#### Example 9079```js 9080_.capitalize('FRED'); 9081// => 'Fred' 9082``` 9083--- 9084 9085<!-- /div --> 9086 9087<!-- div --> 9088 9089<h3 id="_deburrstring"><code>_.deburr([string=''])</code></h3> 9090[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14181 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") [Ⓣ][1] 9091 9092Deburrs `string` by converting 9093[Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 9094and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 9095letters to basic Latin letters and removing 9096[combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 9097 9098#### Since 90993.0.0 9100 9101#### Arguments 91021. `[string='']` *(string)*: The string to deburr. 9103 9104#### Returns 9105*(string)*: Returns the deburred string. 9106 9107#### Example 9108```js 9109_.deburr('déjà vu'); 9110// => 'deja vu' 9111``` 9112--- 9113 9114<!-- /div --> 9115 9116<!-- div --> 9117 9118<h3 id="_endswithstring-target-positionstringlength"><code>_.endsWith([string=''], [target], [position=string.length])</code></h3> 9119[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14209 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") [Ⓣ][1] 9120 9121Checks if `string` ends with the given target string. 9122 9123#### Since 91243.0.0 9125 9126#### Arguments 91271. `[string='']` *(string)*: The string to inspect. 91282. `[target]` *(string)*: The string to search for. 91293. `[position=string.length]` *(number)*: The position to search up to. 9130 9131#### Returns 9132*(boolean)*: Returns `true` if `string` ends with `target`, else `false`. 9133 9134#### Example 9135```js 9136_.endsWith('abc', 'c'); 9137// => true 9138 9139_.endsWith('abc', 'b'); 9140// => false 9141 9142_.endsWith('abc', 'b', 2); 9143// => true 9144``` 9145--- 9146 9147<!-- /div --> 9148 9149<!-- div --> 9150 9151<h3 id="_escapestring"><code>_.escape([string=''])</code></h3> 9152[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14251 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") [Ⓣ][1] 9153 9154Converts the characters "&", "<", ">", '"', and "'" in `string` to their 9155corresponding HTML entities. 9156<br> 9157<br> 9158**Note:** No other characters are escaped. To escape additional 9159characters use a third-party library like [_he_](https://mths.be/he). 9160<br> 9161<br> 9162Though the ">" character is escaped for symmetry, characters like 9163">" and "/" don't need escaping in HTML and have no special meaning 9164unless they're part of a tag or unquoted attribute value. See 9165[Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 9166*(under "semi-related fun fact")* for more details. 9167<br> 9168<br> 9169When working with HTML you should always 9170[quote attribute values](http://wonko.com/post/html-escaping) to reduce 9171XSS vectors. 9172 9173#### Since 91740.1.0 9175 9176#### Arguments 91771. `[string='']` *(string)*: The string to escape. 9178 9179#### Returns 9180*(string)*: Returns the escaped string. 9181 9182#### Example 9183```js 9184_.escape('fred, barney, & pebbles'); 9185// => 'fred, barney, & pebbles' 9186``` 9187--- 9188 9189<!-- /div --> 9190 9191<!-- div --> 9192 9193<h3 id="_escaperegexpstring"><code>_.escapeRegExp([string=''])</code></h3> 9194[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14273 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") [Ⓣ][1] 9195 9196Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 9197"?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 9198 9199#### Since 92003.0.0 9201 9202#### Arguments 92031. `[string='']` *(string)*: The string to escape. 9204 9205#### Returns 9206*(string)*: Returns the escaped string. 9207 9208#### Example 9209```js 9210_.escapeRegExp('[lodash](https://lodash.com/)'); 9211// => '\[lodash\]\(https://lodash\.com/\)' 9212``` 9213--- 9214 9215<!-- /div --> 9216 9217<!-- div --> 9218 9219<h3 id="_kebabcasestring"><code>_.kebabCase([string=''])</code></h3> 9220[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14301 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") [Ⓣ][1] 9221 9222Converts `string` to 9223[kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 9224 9225#### Since 92263.0.0 9227 9228#### Arguments 92291. `[string='']` *(string)*: The string to convert. 9230 9231#### Returns 9232*(string)*: Returns the kebab cased string. 9233 9234#### Example 9235```js 9236_.kebabCase('Foo Bar'); 9237// => 'foo-bar' 9238 9239_.kebabCase('fooBar'); 9240// => 'foo-bar' 9241 9242_.kebabCase('__FOO_BAR__'); 9243// => 'foo-bar' 9244``` 9245--- 9246 9247<!-- /div --> 9248 9249<!-- div --> 9250 9251<h3 id="_lowercasestring"><code>_.lowerCase([string=''])</code></h3> 9252[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14325 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package") [Ⓣ][1] 9253 9254Converts `string`, as space separated words, to lower case. 9255 9256#### Since 92574.0.0 9258 9259#### Arguments 92601. `[string='']` *(string)*: The string to convert. 9261 9262#### Returns 9263*(string)*: Returns the lower cased string. 9264 9265#### Example 9266```js 9267_.lowerCase('--Foo-Bar--'); 9268// => 'foo bar' 9269 9270_.lowerCase('fooBar'); 9271// => 'foo bar' 9272 9273_.lowerCase('__FOO_BAR__'); 9274// => 'foo bar' 9275``` 9276--- 9277 9278<!-- /div --> 9279 9280<!-- div --> 9281 9282<h3 id="_lowerfirststring"><code>_.lowerFirst([string=''])</code></h3> 9283[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14346 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package") [Ⓣ][1] 9284 9285Converts the first character of `string` to lower case. 9286 9287#### Since 92884.0.0 9289 9290#### Arguments 92911. `[string='']` *(string)*: The string to convert. 9292 9293#### Returns 9294*(string)*: Returns the converted string. 9295 9296#### Example 9297```js 9298_.lowerFirst('Fred'); 9299// => 'fred' 9300 9301_.lowerFirst('FRED'); 9302// => 'fRED' 9303``` 9304--- 9305 9306<!-- /div --> 9307 9308<!-- div --> 9309 9310<h3 id="_padstring-length0-chars"><code>_.pad([string=''], [length=0], [chars=' '])</code></h3> 9311[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14371 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") [Ⓣ][1] 9312 9313Pads `string` on the left and right sides if it's shorter than `length`. 9314Padding characters are truncated if they can't be evenly divided by `length`. 9315 9316#### Since 93173.0.0 9318 9319#### Arguments 93201. `[string='']` *(string)*: The string to pad. 93212. `[length=0]` *(number)*: The padding length. 93223. `[chars=' ']` *(string)*: The string used as padding. 9323 9324#### Returns 9325*(string)*: Returns the padded string. 9326 9327#### Example 9328```js 9329_.pad('abc', 8); 9330// => ' abc ' 9331 9332_.pad('abc', 8, '_-'); 9333// => '_-abc_-_' 9334 9335_.pad('abc', 3); 9336// => 'abc' 9337``` 9338--- 9339 9340<!-- /div --> 9341 9342<!-- div --> 9343 9344<h3 id="_padendstring-length0-chars"><code>_.padEnd([string=''], [length=0], [chars=' '])</code></h3> 9345[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14410 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package") [Ⓣ][1] 9346 9347Pads `string` on the right side if it's shorter than `length`. Padding 9348characters are truncated if they exceed `length`. 9349 9350#### Since 93514.0.0 9352 9353#### Arguments 93541. `[string='']` *(string)*: The string to pad. 93552. `[length=0]` *(number)*: The padding length. 93563. `[chars=' ']` *(string)*: The string used as padding. 9357 9358#### Returns 9359*(string)*: Returns the padded string. 9360 9361#### Example 9362```js 9363_.padEnd('abc', 6); 9364// => 'abc ' 9365 9366_.padEnd('abc', 6, '_-'); 9367// => 'abc_-_' 9368 9369_.padEnd('abc', 3); 9370// => 'abc' 9371``` 9372--- 9373 9374<!-- /div --> 9375 9376<!-- div --> 9377 9378<h3 id="_padstartstring-length0-chars"><code>_.padStart([string=''], [length=0], [chars=' '])</code></h3> 9379[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14443 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package") [Ⓣ][1] 9380 9381Pads `string` on the left side if it's shorter than `length`. Padding 9382characters are truncated if they exceed `length`. 9383 9384#### Since 93854.0.0 9386 9387#### Arguments 93881. `[string='']` *(string)*: The string to pad. 93892. `[length=0]` *(number)*: The padding length. 93903. `[chars=' ']` *(string)*: The string used as padding. 9391 9392#### Returns 9393*(string)*: Returns the padded string. 9394 9395#### Example 9396```js 9397_.padStart('abc', 6); 9398// => ' abc' 9399 9400_.padStart('abc', 6, '_-'); 9401// => '_-_abc' 9402 9403_.padStart('abc', 3); 9404// => 'abc' 9405``` 9406--- 9407 9408<!-- /div --> 9409 9410<!-- div --> 9411 9412<h3 id="_parseintstring-radix10"><code>_.parseInt(string, [radix=10])</code></h3> 9413[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14477 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") [Ⓣ][1] 9414 9415Converts `string` to an integer of the specified radix. If `radix` is 9416`undefined` or `0`, a `radix` of `10` is used unless `value` is a 9417hexadecimal, in which case a `radix` of `16` is used. 9418<br> 9419<br> 9420**Note:** This method aligns with the 9421[ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 9422 9423#### Since 94241.1.0 9425 9426#### Arguments 94271. `string` *(string)*: The string to convert. 94282. `[radix=10]` *(number)*: The radix to interpret `value` by. 9429 9430#### Returns 9431*(number)*: Returns the converted integer. 9432 9433#### Example 9434```js 9435_.parseInt('08'); 9436// => 8 9437 9438_.map(['6', '08', '10'], _.parseInt); 9439// => [6, 8, 10] 9440``` 9441--- 9442 9443<!-- /div --> 9444 9445<!-- div --> 9446 9447<h3 id="_repeatstring-n1"><code>_.repeat([string=''], [n=1])</code></h3> 9448[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14508 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") [Ⓣ][1] 9449 9450Repeats the given string `n` times. 9451 9452#### Since 94533.0.0 9454 9455#### Arguments 94561. `[string='']` *(string)*: The string to repeat. 94572. `[n=1]` *(number)*: The number of times to repeat the string. 9458 9459#### Returns 9460*(string)*: Returns the repeated string. 9461 9462#### Example 9463```js 9464_.repeat('*', 3); 9465// => '***' 9466 9467_.repeat('abc', 2); 9468// => 'abcabc' 9469 9470_.repeat('abc', 0); 9471// => '' 9472``` 9473--- 9474 9475<!-- /div --> 9476 9477<!-- div --> 9478 9479<h3 id="_replacestring-pattern-replacement"><code>_.replace([string=''], pattern, replacement)</code></h3> 9480[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14536 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package") [Ⓣ][1] 9481 9482Replaces matches for `pattern` in `string` with `replacement`. 9483<br> 9484<br> 9485**Note:** This method is based on 9486[`String#replace`](https://mdn.io/String/replace). 9487 9488#### Since 94894.0.0 9490 9491#### Arguments 94921. `[string='']` *(string)*: The string to modify. 94932. `pattern` *(RegExp|string)*: The pattern to replace. 94943. `replacement` *(Function|string)*: The match replacement. 9495 9496#### Returns 9497*(string)*: Returns the modified string. 9498 9499#### Example 9500```js 9501_.replace('Hi Fred', 'Fred', 'Barney'); 9502// => 'Hi Barney' 9503``` 9504--- 9505 9506<!-- /div --> 9507 9508<!-- div --> 9509 9510<h3 id="_snakecasestring"><code>_.snakeCase([string=''])</code></h3> 9511[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14564 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") [Ⓣ][1] 9512 9513Converts `string` to 9514[snake case](https://en.wikipedia.org/wiki/Snake_case). 9515 9516#### Since 95173.0.0 9518 9519#### Arguments 95201. `[string='']` *(string)*: The string to convert. 9521 9522#### Returns 9523*(string)*: Returns the snake cased string. 9524 9525#### Example 9526```js 9527_.snakeCase('Foo Bar'); 9528// => 'foo_bar' 9529 9530_.snakeCase('fooBar'); 9531// => 'foo_bar' 9532 9533_.snakeCase('--FOO-BAR--'); 9534// => 'foo_bar' 9535``` 9536--- 9537 9538<!-- /div --> 9539 9540<!-- div --> 9541 9542<h3 id="_splitstring-separator-limit"><code>_.split([string=''], separator, [limit])</code></h3> 9543[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14587 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package") [Ⓣ][1] 9544 9545Splits `string` by `separator`. 9546<br> 9547<br> 9548**Note:** This method is based on 9549[`String#split`](https://mdn.io/String/split). 9550 9551#### Since 95524.0.0 9553 9554#### Arguments 95551. `[string='']` *(string)*: The string to split. 95562. `separator` *(RegExp|string)*: The separator pattern to split by. 95573. `[limit]` *(number)*: The length to truncate results to. 9558 9559#### Returns 9560*(Array)*: Returns the string segments. 9561 9562#### Example 9563```js 9564_.split('a-b-c', '-', 2); 9565// => ['a', 'b'] 9566``` 9567--- 9568 9569<!-- /div --> 9570 9571<!-- div --> 9572 9573<h3 id="_startcasestring"><code>_.startCase([string=''])</code></h3> 9574[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14629 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") [Ⓣ][1] 9575 9576Converts `string` to 9577[start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 9578 9579#### Since 95803.1.0 9581 9582#### Arguments 95831. `[string='']` *(string)*: The string to convert. 9584 9585#### Returns 9586*(string)*: Returns the start cased string. 9587 9588#### Example 9589```js 9590_.startCase('--foo-bar--'); 9591// => 'Foo Bar' 9592 9593_.startCase('fooBar'); 9594// => 'Foo Bar' 9595 9596_.startCase('__FOO_BAR__'); 9597// => 'FOO BAR' 9598``` 9599--- 9600 9601<!-- /div --> 9602 9603<!-- div --> 9604 9605<h3 id="_startswithstring-target-position0"><code>_.startsWith([string=''], [target], [position=0])</code></h3> 9606[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14656 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") [Ⓣ][1] 9607 9608Checks if `string` starts with the given target string. 9609 9610#### Since 96113.0.0 9612 9613#### Arguments 96141. `[string='']` *(string)*: The string to inspect. 96152. `[target]` *(string)*: The string to search for. 96163. `[position=0]` *(number)*: The position to search from. 9617 9618#### Returns 9619*(boolean)*: Returns `true` if `string` starts with `target`, else `false`. 9620 9621#### Example 9622```js 9623_.startsWith('abc', 'a'); 9624// => true 9625 9626_.startsWith('abc', 'b'); 9627// => false 9628 9629_.startsWith('abc', 'b', 1); 9630// => true 9631``` 9632--- 9633 9634<!-- /div --> 9635 9636<!-- div --> 9637 9638<h3 id="_templatestring-options"><code>_.template([string=''], [options={}])</code></h3> 9639[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14770 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") [Ⓣ][1] 9640 9641Creates a compiled template function that can interpolate data properties 9642in "interpolate" delimiters, HTML-escape interpolated data properties in 9643"escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 9644properties may be accessed as free variables in the template. If a setting 9645object is given, it takes precedence over `_.templateSettings` values. 9646<br> 9647<br> 9648**Note:** In the development build `_.template` utilizes 9649[sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 9650for easier debugging. 9651<br> 9652<br> 9653For more information on precompiling templates see 9654[lodash's custom builds documentation](https://lodash.com/custom-builds). 9655<br> 9656<br> 9657For more information on Chrome extension sandboxes see 9658[Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 9659 9660#### Since 96610.1.0 9662 9663#### Arguments 96641. `[string='']` *(string)*: The template string. 96652. `[options={}]` *(Object)*: The options object. 96663. `[options.escape=_.templateSettings.escape]` *(RegExp)*: The HTML "escape" delimiter. 96674. `[options.evaluate=_.templateSettings.evaluate]` *(RegExp)*: The "evaluate" delimiter. 96685. `[options.imports=_.templateSettings.imports]` *(Object)*: An object to import into the template as free variables. 96696. `[options.interpolate=_.templateSettings.interpolate]` *(RegExp)*: The "interpolate" delimiter. 96707. `[options.sourceURL='lodash.templateSources[n]']` *(string)*: The sourceURL of the compiled template. 96718. `[options.variable='obj']` *(string)*: The data object variable name. 9672 9673#### Returns 9674*(Function)*: Returns the compiled template function. 9675 9676#### Example 9677```js 9678// Use the "interpolate" delimiter to create a compiled template. 9679var compiled = _.template('hello <%= user %>!'); 9680compiled({ 'user': 'fred' }); 9681// => 'hello fred!' 9682 9683// Use the HTML "escape" delimiter to escape data property values. 9684var compiled = _.template('<b><%- value %></b>'); 9685compiled({ 'value': '<script>' }); 9686// => '<b><script></b>' 9687 9688// Use the "evaluate" delimiter to execute JavaScript and generate HTML. 9689var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 9690compiled({ 'users': ['fred', 'barney'] }); 9691// => '<li>fred</li><li>barney</li>' 9692 9693// Use the internal `print` function in "evaluate" delimiters. 9694var compiled = _.template('<% print("hello " + user); %>!'); 9695compiled({ 'user': 'barney' }); 9696// => 'hello barney!' 9697 9698// Use the ES template literal delimiter as an "interpolate" delimiter. 9699// Disable support by replacing the "interpolate" delimiter. 9700var compiled = _.template('hello ${ user }!'); 9701compiled({ 'user': 'pebbles' }); 9702// => 'hello pebbles!' 9703 9704// Use backslashes to treat delimiters as plain text. 9705var compiled = _.template('<%= "\\<%- value %\\>" %>'); 9706compiled({ 'value': 'ignored' }); 9707// => '<%- value %>' 9708 9709// Use the `imports` option to import `jQuery` as `jq`. 9710var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 9711var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 9712compiled({ 'users': ['fred', 'barney'] }); 9713// => '<li>fred</li><li>barney</li>' 9714 9715// Use the `sourceURL` option to specify a custom sourceURL for the template. 9716var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 9717compiled(data); 9718// => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 9719 9720// Use the `variable` option to ensure a with-statement isn't used in the compiled template. 9721var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 9722compiled.source; 9723// => function(data) { 9724// var __t, __p = ''; 9725// __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 9726// return __p; 9727// } 9728 9729// Use custom template delimiters. 9730_.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 9731var compiled = _.template('hello {{ user }}!'); 9732compiled({ 'user': 'mustache' }); 9733// => 'hello mustache!' 9734 9735// Use the `source` property to inline compiled templates for meaningful 9736// line numbers in error messages and stack traces. 9737fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 9738 var JST = {\ 9739 "main": ' + _.template(mainText).source + '\ 9740 };\ 9741'); 9742``` 9743--- 9744 9745<!-- /div --> 9746 9747<!-- div --> 9748 9749<h3 id="_tolowerstring"><code>_.toLower([string=''])</code></h3> 9750[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14904 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package") [Ⓣ][1] 9751 9752Converts `string`, as a whole, to lower case just like 9753[String#toLowerCase](https://mdn.io/toLowerCase). 9754 9755#### Since 97564.0.0 9757 9758#### Arguments 97591. `[string='']` *(string)*: The string to convert. 9760 9761#### Returns 9762*(string)*: Returns the lower cased string. 9763 9764#### Example 9765```js 9766_.toLower('--Foo-Bar--'); 9767// => '--foo-bar--' 9768 9769_.toLower('fooBar'); 9770// => 'foobar' 9771 9772_.toLower('__FOO_BAR__'); 9773// => '__foo_bar__' 9774``` 9775--- 9776 9777<!-- /div --> 9778 9779<!-- div --> 9780 9781<h3 id="_toupperstring"><code>_.toUpper([string=''])</code></h3> 9782[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14929 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package") [Ⓣ][1] 9783 9784Converts `string`, as a whole, to upper case just like 9785[String#toUpperCase](https://mdn.io/toUpperCase). 9786 9787#### Since 97884.0.0 9789 9790#### Arguments 97911. `[string='']` *(string)*: The string to convert. 9792 9793#### Returns 9794*(string)*: Returns the upper cased string. 9795 9796#### Example 9797```js 9798_.toUpper('--foo-bar--'); 9799// => '--FOO-BAR--' 9800 9801_.toUpper('fooBar'); 9802// => 'FOOBAR' 9803 9804_.toUpper('__foo_bar__'); 9805// => '__FOO_BAR__' 9806``` 9807--- 9808 9809<!-- /div --> 9810 9811<!-- div --> 9812 9813<h3 id="_trimstring-charswhitespace"><code>_.trim([string=''], [chars=whitespace])</code></h3> 9814[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14955 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") [Ⓣ][1] 9815 9816Removes leading and trailing whitespace or specified characters from `string`. 9817 9818#### Since 98193.0.0 9820 9821#### Arguments 98221. `[string='']` *(string)*: The string to trim. 98232. `[chars=whitespace]` *(string)*: The characters to trim. 9824 9825#### Returns 9826*(string)*: Returns the trimmed string. 9827 9828#### Example 9829```js 9830_.trim(' abc '); 9831// => 'abc' 9832 9833_.trim('-_-abc-_-', '_-'); 9834// => 'abc' 9835 9836_.map([' foo ', ' bar '], _.trim); 9837// => ['foo', 'bar'] 9838``` 9839--- 9840 9841<!-- /div --> 9842 9843<!-- div --> 9844 9845<h3 id="_trimendstring-charswhitespace"><code>_.trimEnd([string=''], [chars=whitespace])</code></h3> 9846[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L14990 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package") [Ⓣ][1] 9847 9848Removes trailing whitespace or specified characters from `string`. 9849 9850#### Since 98514.0.0 9852 9853#### Arguments 98541. `[string='']` *(string)*: The string to trim. 98552. `[chars=whitespace]` *(string)*: The characters to trim. 9856 9857#### Returns 9858*(string)*: Returns the trimmed string. 9859 9860#### Example 9861```js 9862_.trimEnd(' abc '); 9863// => ' abc' 9864 9865_.trimEnd('-_-abc-_-', '_-'); 9866// => '-_-abc' 9867``` 9868--- 9869 9870<!-- /div --> 9871 9872<!-- div --> 9873 9874<h3 id="_trimstartstring-charswhitespace"><code>_.trimStart([string=''], [chars=whitespace])</code></h3> 9875[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15023 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package") [Ⓣ][1] 9876 9877Removes leading whitespace or specified characters from `string`. 9878 9879#### Since 98804.0.0 9881 9882#### Arguments 98831. `[string='']` *(string)*: The string to trim. 98842. `[chars=whitespace]` *(string)*: The characters to trim. 9885 9886#### Returns 9887*(string)*: Returns the trimmed string. 9888 9889#### Example 9890```js 9891_.trimStart(' abc '); 9892// => 'abc ' 9893 9894_.trimStart('-_-abc-_-', '_-'); 9895// => 'abc-_-' 9896``` 9897--- 9898 9899<!-- /div --> 9900 9901<!-- div --> 9902 9903<h3 id="_truncatestring-options"><code>_.truncate([string=''], [options={}])</code></h3> 9904[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15074 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package") [Ⓣ][1] 9905 9906Truncates `string` if it's longer than the given maximum string length. 9907The last characters of the truncated string are replaced with the omission 9908string which defaults to "...". 9909 9910#### Since 99114.0.0 9912 9913#### Arguments 99141. `[string='']` *(string)*: The string to truncate. 99152. `[options={}]` *(Object)*: The options object. 99163. `[options.length=30]` *(number)*: The maximum string length. 99174. `[options.omission='...']` *(string)*: The string to indicate text is omitted. 99185. `[options.separator]` *(RegExp|string)*: The separator pattern to truncate to. 9919 9920#### Returns 9921*(string)*: Returns the truncated string. 9922 9923#### Example 9924```js 9925_.truncate('hi-diddly-ho there, neighborino'); 9926// => 'hi-diddly-ho there, neighbo...' 9927 9928_.truncate('hi-diddly-ho there, neighborino', { 9929 'length': 24, 9930 'separator': ' ' 9931}); 9932// => 'hi-diddly-ho there,...' 9933 9934_.truncate('hi-diddly-ho there, neighborino', { 9935 'length': 24, 9936 'separator': /,? +/ 9937}); 9938// => 'hi-diddly-ho there...' 9939 9940_.truncate('hi-diddly-ho there, neighborino', { 9941 'omission': ' [...]' 9942}); 9943// => 'hi-diddly-ho there, neig [...]' 9944``` 9945--- 9946 9947<!-- /div --> 9948 9949<!-- div --> 9950 9951<h3 id="_unescapestring"><code>_.unescape([string=''])</code></h3> 9952[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15149 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") [Ⓣ][1] 9953 9954The inverse of `_.escape`; this method converts the HTML entities 9955`&`, `<`, `>`, `"`, and `'` in `string` to 9956their corresponding characters. 9957<br> 9958<br> 9959**Note:** No other HTML entities are unescaped. To unescape additional 9960HTML entities use a third-party library like [_he_](https://mths.be/he). 9961 9962#### Since 99630.6.0 9964 9965#### Arguments 99661. `[string='']` *(string)*: The string to unescape. 9967 9968#### Returns 9969*(string)*: Returns the unescaped string. 9970 9971#### Example 9972```js 9973_.unescape('fred, barney, & pebbles'); 9974// => 'fred, barney, & pebbles' 9975``` 9976--- 9977 9978<!-- /div --> 9979 9980<!-- div --> 9981 9982<h3 id="_uppercasestring"><code>_.upperCase([string=''])</code></h3> 9983[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15176 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package") [Ⓣ][1] 9984 9985Converts `string`, as space separated words, to upper case. 9986 9987#### Since 99884.0.0 9989 9990#### Arguments 99911. `[string='']` *(string)*: The string to convert. 9992 9993#### Returns 9994*(string)*: Returns the upper cased string. 9995 9996#### Example 9997```js 9998_.upperCase('--foo-bar'); 9999// => 'FOO BAR' 10000 10001_.upperCase('fooBar'); 10002// => 'FOO BAR' 10003 10004_.upperCase('__foo_bar__'); 10005// => 'FOO BAR' 10006``` 10007--- 10008 10009<!-- /div --> 10010 10011<!-- div --> 10012 10013<h3 id="_upperfirststring"><code>_.upperFirst([string=''])</code></h3> 10014[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15197 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package") [Ⓣ][1] 10015 10016Converts the first character of `string` to upper case. 10017 10018#### Since 100194.0.0 10020 10021#### Arguments 100221. `[string='']` *(string)*: The string to convert. 10023 10024#### Returns 10025*(string)*: Returns the converted string. 10026 10027#### Example 10028```js 10029_.upperFirst('fred'); 10030// => 'Fred' 10031 10032_.upperFirst('FRED'); 10033// => 'FRED' 10034``` 10035--- 10036 10037<!-- /div --> 10038 10039<!-- div --> 10040 10041<h3 id="_wordsstring-pattern"><code>_.words([string=''], [pattern])</code></h3> 10042[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15218 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") [Ⓣ][1] 10043 10044Splits `string` into an array of its words. 10045 10046#### Since 100473.0.0 10048 10049#### Arguments 100501. `[string='']` *(string)*: The string to inspect. 100512. `[pattern]` *(RegExp|string)*: The pattern to match words. 10052 10053#### Returns 10054*(Array)*: Returns the words of `string`. 10055 10056#### Example 10057```js 10058_.words('fred, barney, & pebbles'); 10059// => ['fred', 'barney', 'pebbles'] 10060 10061_.words('fred, barney, & pebbles', /[^, ]+/g); 10062// => ['fred', 'barney', '&', 'pebbles'] 10063``` 10064--- 10065 10066<!-- /div --> 10067 10068<!-- /div --> 10069 10070<!-- div --> 10071 10072## `“Util” Methods` 10073 10074<!-- div --> 10075 10076<h3 id="_attemptfunc-args"><code>_.attempt(func, [args])</code></h3> 10077[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15252 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") [Ⓣ][1] 10078 10079Attempts to invoke `func`, returning either the result or the caught error 10080object. Any additional arguments are provided to `func` when it's invoked. 10081 10082#### Since 100833.0.0 10084 10085#### Arguments 100861. `func` *(Function)*: The function to attempt. 100872. `[args]` *(...*)*: The arguments to invoke `func` with. 10088 10089#### Returns 10090*(*)*: Returns the `func` result or error object. 10091 10092#### Example 10093```js 10094// Avoid throwing errors for invalid selectors. 10095var elements = _.attempt(function(selector) { 10096 return document.querySelectorAll(selector); 10097}, '>_>'); 10098 10099if (_.isError(elements)) { 10100 elements = []; 10101} 10102``` 10103--- 10104 10105<!-- /div --> 10106 10107<!-- div --> 10108 10109<h3 id="_bindallobject-methodnames"><code>_.bindAll(object, methodNames)</code></h3> 10110[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15286 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") [Ⓣ][1] 10111 10112Binds methods of an object to the object itself, overwriting the existing 10113method. 10114<br> 10115<br> 10116**Note:** This method doesn't set the "length" property of bound functions. 10117 10118#### Since 101190.1.0 10120 10121#### Arguments 101221. `object` *(Object)*: The object to bind and assign the bound methods to. 101232. `methodNames` *(...(string|string[]))*: The object method names to bind. 10124 10125#### Returns 10126*(Object)*: Returns `object`. 10127 10128#### Example 10129```js 10130var view = { 10131 'label': 'docs', 10132 'click': function() { 10133 console.log('clicked ' + this.label); 10134 } 10135}; 10136 10137_.bindAll(view, ['click']); 10138jQuery(element).on('click', view.click); 10139// => Logs 'clicked docs' when clicked. 10140``` 10141--- 10142 10143<!-- /div --> 10144 10145<!-- div --> 10146 10147<h3 id="_condpairs"><code>_.cond(pairs)</code></h3> 10148[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15323 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package") [Ⓣ][1] 10149 10150Creates a function that iterates over `pairs` and invokes the corresponding 10151function of the first predicate to return truthy. The predicate-function 10152pairs are invoked with the `this` binding and arguments of the created 10153function. 10154 10155#### Since 101564.0.0 10157 10158#### Arguments 101591. `pairs` *(Array)*: The predicate-function pairs. 10160 10161#### Returns 10162*(Function)*: Returns the new composite function. 10163 10164#### Example 10165```js 10166var func = _.cond([ 10167 [_.matches({ 'a': 1 }), _.constant('matches A')], 10168 [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 10169 [_.stubTrue, _.constant('no match')] 10170]); 10171 10172func({ 'a': 1, 'b': 2 }); 10173// => 'matches A' 10174 10175func({ 'a': 0, 'b': 1 }); 10176// => 'matches B' 10177 10178func({ 'a': '1', 'b': '2' }); 10179// => 'no match' 10180``` 10181--- 10182 10183<!-- /div --> 10184 10185<!-- div --> 10186 10187<h3 id="_conformssource"><code>_.conforms(source)</code></h3> 10188[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15369 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package") [Ⓣ][1] 10189 10190Creates a function that invokes the predicate properties of `source` with 10191the corresponding property values of a given object, returning `true` if 10192all predicates return truthy, else `false`. 10193<br> 10194<br> 10195**Note:** The created function is equivalent to `_.conformsTo` with 10196`source` partially applied. 10197 10198#### Since 101994.0.0 10200 10201#### Arguments 102021. `source` *(Object)*: The object of property predicates to conform to. 10203 10204#### Returns 10205*(Function)*: Returns the new spec function. 10206 10207#### Example 10208```js 10209var objects = [ 10210 { 'a': 2, 'b': 1 }, 10211 { 'a': 1, 'b': 2 } 10212]; 10213 10214_.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 10215// => [{ 'a': 1, 'b': 2 }] 10216``` 10217--- 10218 10219<!-- /div --> 10220 10221<!-- div --> 10222 10223<h3 id="_constantvalue"><code>_.constant(value)</code></h3> 10224[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15392 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") [Ⓣ][1] 10225 10226Creates a function that returns `value`. 10227 10228#### Since 102292.4.0 10230 10231#### Arguments 102321. `value` *(*)*: The value to return from the new function. 10233 10234#### Returns 10235*(Function)*: Returns the new constant function. 10236 10237#### Example 10238```js 10239var objects = _.times(2, _.constant({ 'a': 1 })); 10240 10241console.log(objects); 10242// => [{ 'a': 1 }, { 'a': 1 }] 10243 10244console.log(objects[0] === objects[1]); 10245// => true 10246``` 10247--- 10248 10249<!-- /div --> 10250 10251<!-- div --> 10252 10253<h3 id="_defaulttovalue-defaultvalue"><code>_.defaultTo(value, defaultValue)</code></h3> 10254[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15418 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaultto "See the npm package") [Ⓣ][1] 10255 10256Checks `value` to determine whether a default value should be returned in 10257its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 10258or `undefined`. 10259 10260#### Since 102614.14.0 10262 10263#### Arguments 102641. `value` *(*)*: The value to check. 102652. `defaultValue` *(*)*: The default value. 10266 10267#### Returns 10268*(*)*: Returns the resolved value. 10269 10270#### Example 10271```js 10272_.defaultTo(1, 10); 10273// => 1 10274 10275_.defaultTo(undefined, 10); 10276// => 10 10277``` 10278--- 10279 10280<!-- /div --> 10281 10282<!-- div --> 10283 10284<h3 id="_flowfuncs"><code>_.flow([funcs])</code></h3> 10285[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15444 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") [Ⓣ][1] 10286 10287Creates a function that returns the result of invoking the given functions 10288with the `this` binding of the created function, where each successive 10289invocation is supplied the return value of the previous. 10290 10291#### Since 102923.0.0 10293 10294#### Arguments 102951. `[funcs]` *(...(Function|Function[]))*: The functions to invoke. 10296 10297#### Returns 10298*(Function)*: Returns the new composite function. 10299 10300#### Example 10301```js 10302function square(n) { 10303 return n * n; 10304} 10305 10306var addSquare = _.flow([_.add, square]); 10307addSquare(1, 2); 10308// => 9 10309``` 10310--- 10311 10312<!-- /div --> 10313 10314<!-- div --> 10315 10316<h3 id="_flowrightfuncs"><code>_.flowRight([funcs])</code></h3> 10317[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15467 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") [Ⓣ][1] 10318 10319This method is like `_.flow` except that it creates a function that 10320invokes the given functions from right to left. 10321 10322#### Since 103233.0.0 10324 10325#### Arguments 103261. `[funcs]` *(...(Function|Function[]))*: The functions to invoke. 10327 10328#### Returns 10329*(Function)*: Returns the new composite function. 10330 10331#### Example 10332```js 10333function square(n) { 10334 return n * n; 10335} 10336 10337var addSquare = _.flowRight([square, _.add]); 10338addSquare(1, 2); 10339// => 9 10340``` 10341--- 10342 10343<!-- /div --> 10344 10345<!-- div --> 10346 10347<h3 id="_identityvalue"><code>_.identity(value)</code></h3> 10348[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15485 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") [Ⓣ][1] 10349 10350This method returns the first argument it receives. 10351 10352#### Since 103530.1.0 10354 10355#### Arguments 103561. `value` *(*)*: Any value. 10357 10358#### Returns 10359*(*)*: Returns `value`. 10360 10361#### Example 10362```js 10363var object = { 'a': 1 }; 10364 10365console.log(_.identity(object) === object); 10366// => true 10367``` 10368--- 10369 10370<!-- /div --> 10371 10372<!-- div --> 10373 10374<h3 id="_iterateefunc_identity"><code>_.iteratee([func=_.identity])</code></h3> 10375[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15531 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package") [Ⓣ][1] 10376 10377Creates a function that invokes `func` with the arguments of the created 10378function. If `func` is a property name, the created function returns the 10379property value for a given element. If `func` is an array or object, the 10380created function returns `true` for elements that contain the equivalent 10381source properties, otherwise it returns `false`. 10382 10383#### Since 103844.0.0 10385 10386#### Arguments 103871. `[func=_.identity]` *(*)*: The value to convert to a callback. 10388 10389#### Returns 10390*(Function)*: Returns the callback. 10391 10392#### Example 10393```js 10394var users = [ 10395 { 'user': 'barney', 'age': 36, 'active': true }, 10396 { 'user': 'fred', 'age': 40, 'active': false } 10397]; 10398 10399// The `_.matches` iteratee shorthand. 10400_.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 10401// => [{ 'user': 'barney', 'age': 36, 'active': true }] 10402 10403// The `_.matchesProperty` iteratee shorthand. 10404_.filter(users, _.iteratee(['user', 'fred'])); 10405// => [{ 'user': 'fred', 'age': 40 }] 10406 10407// The `_.property` iteratee shorthand. 10408_.map(users, _.iteratee('user')); 10409// => ['barney', 'fred'] 10410 10411// Create custom iteratee shorthands. 10412_.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 10413 return !_.isRegExp(func) ? iteratee(func) : function(string) { 10414 return func.test(string); 10415 }; 10416}); 10417 10418_.filter(['abc', 'def'], /ef/); 10419// => ['def'] 10420``` 10421--- 10422 10423<!-- /div --> 10424 10425<!-- div --> 10426 10427<h3 id="_matchessource"><code>_.matches(source)</code></h3> 10428[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15563 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") [Ⓣ][1] 10429 10430Creates a function that performs a partial deep comparison between a given 10431object and `source`, returning `true` if the given object has equivalent 10432property values, else `false`. 10433<br> 10434<br> 10435**Note:** The created function is equivalent to `_.isMatch` with `source` 10436partially applied. 10437<br> 10438<br> 10439Partial comparisons will match empty array and empty object `source` 10440values against any array or object value, respectively. See `_.isEqual` 10441for a list of supported value comparisons. 10442 10443#### Since 104443.0.0 10445 10446#### Arguments 104471. `source` *(Object)*: The object of property values to match. 10448 10449#### Returns 10450*(Function)*: Returns the new spec function. 10451 10452#### Example 10453```js 10454var objects = [ 10455 { 'a': 1, 'b': 2, 'c': 3 }, 10456 { 'a': 4, 'b': 5, 'c': 6 } 10457]; 10458 10459_.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 10460// => [{ 'a': 4, 'b': 5, 'c': 6 }] 10461``` 10462--- 10463 10464<!-- /div --> 10465 10466<!-- div --> 10467 10468<h3 id="_matchespropertypath-srcvalue"><code>_.matchesProperty(path, srcValue)</code></h3> 10469[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15593 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") [Ⓣ][1] 10470 10471Creates a function that performs a partial deep comparison between the 10472value at `path` of a given object to `srcValue`, returning `true` if the 10473object value is equivalent, else `false`. 10474<br> 10475<br> 10476**Note:** Partial comparisons will match empty array and empty object 10477`srcValue` values against any array or object value, respectively. See 10478`_.isEqual` for a list of supported value comparisons. 10479 10480#### Since 104813.2.0 10482 10483#### Arguments 104841. `path` *(Array|string)*: The path of the property to get. 104852. `srcValue` *(*)*: The value to match. 10486 10487#### Returns 10488*(Function)*: Returns the new spec function. 10489 10490#### Example 10491```js 10492var objects = [ 10493 { 'a': 1, 'b': 2, 'c': 3 }, 10494 { 'a': 4, 'b': 5, 'c': 6 } 10495]; 10496 10497_.find(objects, _.matchesProperty('a', 4)); 10498// => { 'a': 4, 'b': 5, 'c': 6 } 10499``` 10500--- 10501 10502<!-- /div --> 10503 10504<!-- div --> 10505 10506<h3 id="_methodpath-args"><code>_.method(path, [args])</code></h3> 10507[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15621 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") [Ⓣ][1] 10508 10509Creates a function that invokes the method at `path` of a given object. 10510Any additional arguments are provided to the invoked method. 10511 10512#### Since 105133.7.0 10514 10515#### Arguments 105161. `path` *(Array|string)*: The path of the method to invoke. 105172. `[args]` *(...*)*: The arguments to invoke the method with. 10518 10519#### Returns 10520*(Function)*: Returns the new invoker function. 10521 10522#### Example 10523```js 10524var objects = [ 10525 { 'a': { 'b': _.constant(2) } }, 10526 { 'a': { 'b': _.constant(1) } } 10527]; 10528 10529_.map(objects, _.method('a.b')); 10530// => [2, 1] 10531 10532_.map(objects, _.method(['a', 'b'])); 10533// => [2, 1] 10534``` 10535--- 10536 10537<!-- /div --> 10538 10539<!-- div --> 10540 10541<h3 id="_methodofobject-args"><code>_.methodOf(object, [args])</code></h3> 10542[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15650 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") [Ⓣ][1] 10543 10544The opposite of `_.method`; this method creates a function that invokes 10545the method at a given path of `object`. Any additional arguments are 10546provided to the invoked method. 10547 10548#### Since 105493.7.0 10550 10551#### Arguments 105521. `object` *(Object)*: The object to query. 105532. `[args]` *(...*)*: The arguments to invoke the method with. 10554 10555#### Returns 10556*(Function)*: Returns the new invoker function. 10557 10558#### Example 10559```js 10560var array = _.times(3, _.constant), 10561 object = { 'a': array, 'b': array, 'c': array }; 10562 10563_.map(['a[2]', 'c[0]'], _.methodOf(object)); 10564// => [2, 0] 10565 10566_.map([['a', '2'], ['c', '0']], _.methodOf(object)); 10567// => [2, 0] 10568``` 10569--- 10570 10571<!-- /div --> 10572 10573<!-- div --> 10574 10575<h3 id="_mixinobjectlodash-source-options"><code>_.mixin([object=lodash], source, [options={}])</code></h3> 10576[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15692 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") [Ⓣ][1] 10577 10578Adds all own enumerable string keyed function properties of a source 10579object to the destination object. If `object` is a function, then methods 10580are added to its prototype as well. 10581<br> 10582<br> 10583**Note:** Use `_.runInContext` to create a pristine `lodash` function to 10584avoid conflicts caused by modifying the original. 10585 10586#### Since 105870.1.0 10588 10589#### Arguments 105901. `[object=lodash]` *(Function|Object)*: The destination object. 105912. `source` *(Object)*: The object of functions to add. 105923. `[options={}]` *(Object)*: The options object. 105934. `[options.chain=true]` *(boolean)*: Specify whether mixins are chainable. 10594 10595#### Returns 10596*(*)*: Returns `object`. 10597 10598#### Example 10599```js 10600function vowels(string) { 10601 return _.filter(string, function(v) { 10602 return /[aeiou]/i.test(v); 10603 }); 10604} 10605 10606_.mixin({ 'vowels': vowels }); 10607_.vowels('fred'); 10608// => ['e'] 10609 10610_('fred').vowels().value(); 10611// => ['e'] 10612 10613_.mixin({ 'vowels': vowels }, { 'chain': false }); 10614_('fred').vowels(); 10615// => ['e'] 10616``` 10617--- 10618 10619<!-- /div --> 10620 10621<!-- div --> 10622 10623<h3 id="_noconflict"><code>_.noConflict()</code></h3> 10624[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15741 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") [Ⓣ][1] 10625 10626Reverts the `_` variable to its previous value and returns a reference to 10627the `lodash` function. 10628 10629#### Since 106300.1.0 10631 10632#### Returns 10633*(Function)*: Returns the `lodash` function. 10634 10635#### Example 10636```js 10637var lodash = _.noConflict(); 10638``` 10639--- 10640 10641<!-- /div --> 10642 10643<!-- div --> 10644 10645<h3 id="_noop"><code>_.noop()</code></h3> 10646[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15760 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") [Ⓣ][1] 10647 10648This method returns `undefined`. 10649 10650#### Since 106512.3.0 10652 10653#### Example 10654```js 10655_.times(2, _.noop); 10656// => [undefined, undefined] 10657``` 10658--- 10659 10660<!-- /div --> 10661 10662<!-- div --> 10663 10664<h3 id="_nthargn0"><code>_.nthArg([n=0])</code></h3> 10665[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15784 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package") [Ⓣ][1] 10666 10667Creates a function that gets the argument at index `n`. If `n` is negative, 10668the nth argument from the end is returned. 10669 10670#### Since 106714.0.0 10672 10673#### Arguments 106741. `[n=0]` *(number)*: The index of the argument to return. 10675 10676#### Returns 10677*(Function)*: Returns the new pass-thru function. 10678 10679#### Example 10680```js 10681var func = _.nthArg(1); 10682func('a', 'b', 'c', 'd'); 10683// => 'b' 10684 10685var func = _.nthArg(-2); 10686func('a', 'b', 'c', 'd'); 10687// => 'c' 10688``` 10689--- 10690 10691<!-- /div --> 10692 10693<!-- div --> 10694 10695<h3 id="_overiteratees_identity"><code>_.over([iteratees=[_.identity]])</code></h3> 10696[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15809 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package") [Ⓣ][1] 10697 10698Creates a function that invokes `iteratees` with the arguments it receives 10699and returns their results. 10700 10701#### Since 107024.0.0 10703 10704#### Arguments 107051. `[iteratees=[_.identity]]` *(...(Function|Function[]))*: The iteratees to invoke. 10706 10707#### Returns 10708*(Function)*: Returns the new function. 10709 10710#### Example 10711```js 10712var func = _.over([Math.max, Math.min]); 10713 10714func(1, 2, 3, 4); 10715// => [4, 1] 10716``` 10717--- 10718 10719<!-- /div --> 10720 10721<!-- div --> 10722 10723<h3 id="_overeverypredicates_identity"><code>_.overEvery([predicates=[_.identity]])</code></h3> 10724[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15835 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package") [Ⓣ][1] 10725 10726Creates a function that checks if **all** of the `predicates` return 10727truthy when invoked with the arguments it receives. 10728 10729#### Since 107304.0.0 10731 10732#### Arguments 107331. `[predicates=[_.identity]]` *(...(Function|Function[]))*: The predicates to check. 10734 10735#### Returns 10736*(Function)*: Returns the new function. 10737 10738#### Example 10739```js 10740var func = _.overEvery([Boolean, isFinite]); 10741 10742func('1'); 10743// => true 10744 10745func(null); 10746// => false 10747 10748func(NaN); 10749// => false 10750``` 10751--- 10752 10753<!-- /div --> 10754 10755<!-- div --> 10756 10757<h3 id="_oversomepredicates_identity"><code>_.overSome([predicates=[_.identity]])</code></h3> 10758[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15861 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package") [Ⓣ][1] 10759 10760Creates a function that checks if **any** of the `predicates` return 10761truthy when invoked with the arguments it receives. 10762 10763#### Since 107644.0.0 10765 10766#### Arguments 107671. `[predicates=[_.identity]]` *(...(Function|Function[]))*: The predicates to check. 10768 10769#### Returns 10770*(Function)*: Returns the new function. 10771 10772#### Example 10773```js 10774var func = _.overSome([Boolean, isFinite]); 10775 10776func('1'); 10777// => true 10778 10779func(null); 10780// => true 10781 10782func(NaN); 10783// => false 10784``` 10785--- 10786 10787<!-- /div --> 10788 10789<!-- div --> 10790 10791<h3 id="_propertypath"><code>_.property(path)</code></h3> 10792[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15885 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") [Ⓣ][1] 10793 10794Creates a function that returns the value at `path` of a given object. 10795 10796#### Since 107972.4.0 10798 10799#### Arguments 108001. `path` *(Array|string)*: The path of the property to get. 10801 10802#### Returns 10803*(Function)*: Returns the new accessor function. 10804 10805#### Example 10806```js 10807var objects = [ 10808 { 'a': { 'b': 2 } }, 10809 { 'a': { 'b': 1 } } 10810]; 10811 10812_.map(objects, _.property('a.b')); 10813// => [2, 1] 10814 10815_.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 10816// => [1, 2] 10817``` 10818--- 10819 10820<!-- /div --> 10821 10822<!-- div --> 10823 10824<h3 id="_propertyofobject"><code>_.propertyOf(object)</code></h3> 10825[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15910 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") [Ⓣ][1] 10826 10827The opposite of `_.property`; this method creates a function that returns 10828the value at a given path of `object`. 10829 10830#### Since 108313.0.0 10832 10833#### Arguments 108341. `object` *(Object)*: The object to query. 10835 10836#### Returns 10837*(Function)*: Returns the new accessor function. 10838 10839#### Example 10840```js 10841var array = [0, 1, 2], 10842 object = { 'a': array, 'b': array, 'c': array }; 10843 10844_.map(['a[2]', 'c[0]'], _.propertyOf(object)); 10845// => [2, 0] 10846 10847_.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 10848// => [2, 0] 10849``` 10850--- 10851 10852<!-- /div --> 10853 10854<!-- div --> 10855 10856<h3 id="_rangestart0-end-step1"><code>_.range([start=0], end, [step=1])</code></h3> 10857[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15957 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") [Ⓣ][1] 10858 10859Creates an array of numbers *(positive and/or negative)* progressing from 10860`start` up to, but not including, `end`. A step of `-1` is used if a negative 10861`start` is specified without an `end` or `step`. If `end` is not specified, 10862it's set to `start` with `start` then set to `0`. 10863<br> 10864<br> 10865**Note:** JavaScript follows the IEEE-754 standard for resolving 10866floating-point values which can produce unexpected results. 10867 10868#### Since 108690.1.0 10870 10871#### Arguments 108721. `[start=0]` *(number)*: The start of the range. 108732. `end` *(number)*: The end of the range. 108743. `[step=1]` *(number)*: The value to increment or decrement by. 10875 10876#### Returns 10877*(Array)*: Returns the range of numbers. 10878 10879#### Example 10880```js 10881_.range(4); 10882// => [0, 1, 2, 3] 10883 10884_.range(-4); 10885// => [0, -1, -2, -3] 10886 10887_.range(1, 5); 10888// => [1, 2, 3, 4] 10889 10890_.range(0, 20, 5); 10891// => [0, 5, 10, 15] 10892 10893_.range(0, -4, -1); 10894// => [0, -1, -2, -3] 10895 10896_.range(1, 4, 0); 10897// => [1, 1, 1] 10898 10899_.range(0); 10900// => [] 10901``` 10902--- 10903 10904<!-- /div --> 10905 10906<!-- div --> 10907 10908<h3 id="_rangerightstart0-end-step1"><code>_.rangeRight([start=0], end, [step=1])</code></h3> 10909[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L15995 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package") [Ⓣ][1] 10910 10911This method is like `_.range` except that it populates values in 10912descending order. 10913 10914#### Since 109154.0.0 10916 10917#### Arguments 109181. `[start=0]` *(number)*: The start of the range. 109192. `end` *(number)*: The end of the range. 109203. `[step=1]` *(number)*: The value to increment or decrement by. 10921 10922#### Returns 10923*(Array)*: Returns the range of numbers. 10924 10925#### Example 10926```js 10927_.rangeRight(4); 10928// => [3, 2, 1, 0] 10929 10930_.rangeRight(-4); 10931// => [-3, -2, -1, 0] 10932 10933_.rangeRight(1, 5); 10934// => [4, 3, 2, 1] 10935 10936_.rangeRight(0, 20, 5); 10937// => [15, 10, 5, 0] 10938 10939_.rangeRight(0, -4, -1); 10940// => [-3, -2, -1, 0] 10941 10942_.rangeRight(1, 4, 0); 10943// => [1, 1, 1] 10944 10945_.rangeRight(0); 10946// => [] 10947``` 10948--- 10949 10950<!-- /div --> 10951 10952<!-- div --> 10953 10954<h3 id="_runincontextcontextroot"><code>_.runInContext([context=root])</code></h3> 10955[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1406 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") [Ⓣ][1] 10956 10957Create a new pristine `lodash` function using the `context` object. 10958 10959#### Since 109601.1.0 10961 10962#### Arguments 109631. `[context=root]` *(Object)*: The context object. 10964 10965#### Returns 10966*(Function)*: Returns a new `lodash` function. 10967 10968#### Example 10969```js 10970_.mixin({ 'foo': _.constant('foo') }); 10971 10972var lodash = _.runInContext(); 10973lodash.mixin({ 'bar': lodash.constant('bar') }); 10974 10975_.isFunction(_.foo); 10976// => true 10977_.isFunction(_.bar); 10978// => false 10979 10980lodash.isFunction(lodash.foo); 10981// => false 10982lodash.isFunction(lodash.bar); 10983// => true 10984 10985// Create a suped-up `defer` in Node.js. 10986var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 10987``` 10988--- 10989 10990<!-- /div --> 10991 10992<!-- div --> 10993 10994<h3 id="_stubarray"><code>_.stubArray()</code></h3> 10995[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16015 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubarray "See the npm package") [Ⓣ][1] 10996 10997This method returns a new empty array. 10998 10999#### Since 110004.13.0 11001 11002#### Returns 11003*(Array)*: Returns the new empty array. 11004 11005#### Example 11006```js 11007var arrays = _.times(2, _.stubArray); 11008 11009console.log(arrays); 11010// => [[], []] 11011 11012console.log(arrays[0] === arrays[1]); 11013// => false 11014``` 11015--- 11016 11017<!-- /div --> 11018 11019<!-- div --> 11020 11021<h3 id="_stubfalse"><code>_.stubFalse()</code></h3> 11022[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16032 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubfalse "See the npm package") [Ⓣ][1] 11023 11024This method returns `false`. 11025 11026#### Since 110274.13.0 11028 11029#### Returns 11030*(boolean)*: Returns `false`. 11031 11032#### Example 11033```js 11034_.times(2, _.stubFalse); 11035// => [false, false] 11036``` 11037--- 11038 11039<!-- /div --> 11040 11041<!-- div --> 11042 11043<h3 id="_stubobject"><code>_.stubObject()</code></h3> 11044[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16054 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubobject "See the npm package") [Ⓣ][1] 11045 11046This method returns a new empty object. 11047 11048#### Since 110494.13.0 11050 11051#### Returns 11052*(Object)*: Returns the new empty object. 11053 11054#### Example 11055```js 11056var objects = _.times(2, _.stubObject); 11057 11058console.log(objects); 11059// => [{}, {}] 11060 11061console.log(objects[0] === objects[1]); 11062// => false 11063``` 11064--- 11065 11066<!-- /div --> 11067 11068<!-- div --> 11069 11070<h3 id="_stubstring"><code>_.stubString()</code></h3> 11071[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16071 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubstring "See the npm package") [Ⓣ][1] 11072 11073This method returns an empty string. 11074 11075#### Since 110764.13.0 11077 11078#### Returns 11079*(string)*: Returns the empty string. 11080 11081#### Example 11082```js 11083_.times(2, _.stubString); 11084// => ['', ''] 11085``` 11086--- 11087 11088<!-- /div --> 11089 11090<!-- div --> 11091 11092<h3 id="_stubtrue"><code>_.stubTrue()</code></h3> 11093[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16088 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubtrue "See the npm package") [Ⓣ][1] 11094 11095This method returns `true`. 11096 11097#### Since 110984.13.0 11099 11100#### Returns 11101*(boolean)*: Returns `true`. 11102 11103#### Example 11104```js 11105_.times(2, _.stubTrue); 11106// => [true, true] 11107``` 11108--- 11109 11110<!-- /div --> 11111 11112<!-- div --> 11113 11114<h3 id="_timesn-iteratee_identity"><code>_.times(n, [iteratee=_.identity])</code></h3> 11115[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16111 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") [Ⓣ][1] 11116 11117Invokes the iteratee `n` times, returning an array of the results of 11118each invocation. The iteratee is invoked with one argument; *(index)*. 11119 11120#### Since 111210.1.0 11122 11123#### Arguments 111241. `n` *(number)*: The number of times to invoke `iteratee`. 111252. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 11126 11127#### Returns 11128*(Array)*: Returns the array of results. 11129 11130#### Example 11131```js 11132_.times(3, String); 11133// => ['0', '1', '2'] 11134 11135 _.times(4, _.constant(0)); 11136// => [0, 0, 0, 0] 11137``` 11138--- 11139 11140<!-- /div --> 11141 11142<!-- div --> 11143 11144<h3 id="_topathvalue"><code>_.toPath(value)</code></h3> 11145[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16146 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package") [Ⓣ][1] 11146 11147Converts `value` to a property path array. 11148 11149#### Since 111504.0.0 11151 11152#### Arguments 111531. `value` *(*)*: The value to convert. 11154 11155#### Returns 11156*(Array)*: Returns the new property path array. 11157 11158#### Example 11159```js 11160_.toPath('a.b.c'); 11161// => ['a', 'b', 'c'] 11162 11163_.toPath('a[0].b.c'); 11164// => ['a', '0', 'b', 'c'] 11165``` 11166--- 11167 11168<!-- /div --> 11169 11170<!-- div --> 11171 11172<h3 id="_uniqueidprefix"><code>_.uniqueId([prefix=''])</code></h3> 11173[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16170 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") [Ⓣ][1] 11174 11175Generates a unique ID. If `prefix` is given, the ID is appended to it. 11176 11177#### Since 111780.1.0 11179 11180#### Arguments 111811. `[prefix='']` *(string)*: The value to prefix the ID with. 11182 11183#### Returns 11184*(string)*: Returns the unique ID. 11185 11186#### Example 11187```js 11188_.uniqueId('contact_'); 11189// => 'contact_104' 11190 11191_.uniqueId(); 11192// => '105' 11193``` 11194--- 11195 11196<!-- /div --> 11197 11198<!-- /div --> 11199 11200<!-- div --> 11201 11202## `Properties` 11203 11204<!-- div --> 11205 11206<h3 id="_version"><code>_.VERSION</code></h3> 11207[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L16861 "View in source") [Ⓣ][1] 11208 11209(string): The semantic version number. 11210 11211--- 11212 11213<!-- /div --> 11214 11215<!-- div --> 11216 11217<h3 id="_templatesettings"><code>_.templateSettings</code></h3> 11218[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1717 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") [Ⓣ][1] 11219 11220(Object): By default, the template delimiters used by lodash are like those in 11221embedded Ruby *(ERB)* as well as ES2015 template strings. Change the 11222following template settings to use alternative delimiters. 11223 11224--- 11225 11226<!-- /div --> 11227 11228<!-- div --> 11229 11230<h3 id="_templatesettingsescape"><code>_.templateSettings.escape</code></h3> 11231[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1725 "View in source") [Ⓣ][1] 11232 11233(RegExp): Used to detect `data` property values to be HTML-escaped. 11234 11235--- 11236 11237<!-- /div --> 11238 11239<!-- div --> 11240 11241<h3 id="_templatesettingsevaluate"><code>_.templateSettings.evaluate</code></h3> 11242[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1733 "View in source") [Ⓣ][1] 11243 11244(RegExp): Used to detect code to be evaluated. 11245 11246--- 11247 11248<!-- /div --> 11249 11250<!-- div --> 11251 11252<h3 id="_templatesettingsimports"><code>_.templateSettings.imports</code></h3> 11253[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1757 "View in source") [Ⓣ][1] 11254 11255(Object): Used to import variables into the compiled template. 11256 11257--- 11258 11259<!-- /div --> 11260 11261<!-- div --> 11262 11263<h3 id="_templatesettingsinterpolate"><code>_.templateSettings.interpolate</code></h3> 11264[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1741 "View in source") [Ⓣ][1] 11265 11266(RegExp): Used to detect `data` property values to inject. 11267 11268--- 11269 11270<!-- /div --> 11271 11272<!-- div --> 11273 11274<h3 id="_templatesettingsvariable"><code>_.templateSettings.variable</code></h3> 11275[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1749 "View in source") [Ⓣ][1] 11276 11277(string): Used to reference the data object in the template text. 11278 11279--- 11280 11281<!-- /div --> 11282 11283<!-- /div --> 11284 11285<!-- div --> 11286 11287## `Methods` 11288 11289<!-- div --> 11290 11291<h3 id="_templatesettingsimports_"><code>_.templateSettings.imports._</code></h3> 11292[Ⓢ](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L1765 "View in source") [Ⓣ][1] 11293 11294A reference to the `lodash` function. 11295 11296--- 11297 11298<!-- /div --> 11299 11300<!-- /div --> 11301 11302<!-- /div --> 11303 11304 [1]: #array "Jump back to the TOC." 11305