See the v4.0.0 release notes for an overview of what’s new in 4.0.0. Use lodash-migrate, lodash-codemods, & eslint-plugin-lodash to help migrate pre-4 lodash code to the latest release.
_.template
's variable optiontoNumber
, trim
and trimEnd
on large input strings_.sortedIndexBy
methods to short-circuit for empty arrays_.orderBy
accepts iteratee path arrays_.isEqual
returns accurate results without depending on parameter order for circular referencessourceURL
in _.template
_.zipObjectDeep
"type"
field in package.json
of lodash-es
_createRound
_.ceil
, _.floor
, & _round
handle Infinity
consistently_.debounce
clears old timers before starting new ones_.mergeWith
always provides a stack
to customizer
Object.prototype
don’t break lodash
initialization_.defaultsDeep
_.template
options_.merge
handles function properties consistently regardless of number of sourcesObject.prototype
is not augmented by _.merge
fp.convert()
results_.words
implementation_.clone
supports subclassed arrays_.cloneDeep
works with cyclical maps & sets_.defaults
avoids unnecessary source property access_.invert
doesn’t error on inverted values without toString
methods_.merge
& _.mergeWith
avoid augmenting __proto__
properties_.set
supports paths with symbols_.words
detects ordinals in compound wordsfp.update
works with paths that refer to functions_.omit
with deep paths doesn’t mutate object
_.isEqual
getSymbols
helper only gets enumerable symbols_.startsWith
avoids coercing position
of undefined
fp.reduceRight
_.pick
picks keys over paths_.spread
doesn’t include arguments after those spread_.omit
performance regression_.omit
copies shallow path values by reference_.pick
supports path arrays_.pickBy
doesn’t treat keys with dots or brackets as deep paths_.omit
& _.pick
fp.assignAllWith
& fp.mergeAllWith
accept more than two sourcesprocess.binding
detection more cautious to avoid chatty debugging_.xor
returns an empty array when comparing the same array_.words
_.xor
works with more than two arraysfp.convert
handles aliased & remapped methodstoStringTag
spoofing_.isEmpty
exit early for nullish values_.isError
checks to avoid false positives for plain objects_.isElement
_.transform
_.isEmpty
_.toString
works on an array of symbols_.merge
regression with buffers_.isArguments
out for older & newer environments_.runInContext
check in the “fp” browser build_.defaultsDeep
& _.merge
consistently assign undefined
values_.isFunction
detection of Proxy
in Safari 10_.isEqual
treat buffers differently than Uint8Array
values_.sampleSize
performance regressionBuffer
APIs when available_.escape
& _.unescape
fp.rangeStep
& fp.rangeStepRight
_.memoize
use_.isElement
, _.isObject
, & _.isObjectLike
_.escape
& _.unescape
__proto__
is treated as a regular key in assignments_.bind
& _.partial
performance regression_.concat
_.deburr
_.isEmpty
& _.toNumber
Date.now
, clearTimeout
, & setTimeout
fp.nthArg
returns a curried function_.initial
, _.merge
, & _.tail
_.random
& “range” methods coerce arguments to finite numbers_.cloneDeep
global
prerequisite for exports
detectionfp/assign
, fp/defaults
,fp/merge
, & fp/zip
methodscancel
uses clearTimeout
_.first
supports shortcut fusion_.assignWith
respects customizer
results of undefined
_.divide
& _.multiply
return 1
when no arguments are specified_.isEqual
has transitive equivalence for circular referencesfp/zipObjectDeep
toString
results more debuggableSymbol.isConcatSpreadable
_.isEqual
treat invalid dates as equivalentLARGE_ARRAY_SIZE
check in stackSet
align with others_.endsWith
, _.negate
, & _.startsWith
_.find
& _.findLast
provide the correct key
param when iterating objectsfromIndex
param to _.find
, _.findIndex
, _.findLast
, & _.findLastIndex
_.pullAll
works with the same value for array
& values
_.round
works with large precision
values_.throttle
works with a system time of 0
_.isNative
throw if core-js
is detectedfp/findFrom
, fp/findIndexFrom
, fp/findLastFrom
, fp/findLastIndexFrom
, fp/indexOfFrom
, & fp/lastIndexOfFrom
fp/differenceBy
, fp/differenceWith
, fp/intersectionBy
, fp/intersectionWith
, fp/without
, fp/unionBy
, fp/unionWith
, fp/xorBy
, & fp/xorWith
_.toPairs
& _.toPairsIn
_.merge
doesn’t skip trailing function sourcesfp/forEach
, fp/forIn
, & fp/forOwn
cap their iteratee argumentsfp/update
does not convert end of path
to an object_.concat
_.pullAt
correctly sorts indexes greater than 9
_.words
doesn’t treat punctuation as words-0
works as path arguments_.uniq
& _.xor
convert -0
to 0
fp/pluck
as an alias of fp/map
_.debounce
defers invoking func
when leading
is false
& wait
is 0
_.matchesProperty
shorthand support to _.sortBy
_.words
createRecurryWrapper
& mergeData
fp/over
doesn’t cap its iteratee arguments_.head
avoid accessing array
when its length is 0
isIterateeCall
check to _.split
fp/paths
& fp/props
as aliases of fp/at
fp/propEq
as an alias of fp/matchesProperty
_.debounce
queues a trailing call for subsequent debounced calls after maxWait
_.split
handles a limit
of 0
correctly in Node.js v0.10fp/mapObj
& fp/propOf
aliases_.matchesProperty
shorthand support to “over” methods_.split
works with emojisfp/toString
& fp/valueOf
modules_.matchesProperty
shorthand support for “over” methodsfp/_falseOptions
fp/placeholder
module & fp/__
aliasconvert
to unconverted “fp” methods_.matchesProperty
shorthand support to “over” methodsPromise
to a string_.has
returns false
for nested nullish object values_.has
treats nested sparse arrays consistentlyfp/overArgs
_.chunk
, _.repeat
, & _.sampleSize
default n
to 1
instead of 0
_.matchesProperty
shorthandfp/invokeArgs
, fp/invokeArgsMap
, fp/padChars
, fp/padCharsEnd
, fp/padCharsStart
, fp/restFrom
, & fp/spreadFrom
_.entries
as an alias of _.toPairs
_.entriesIn
as an alias of _.toPairsIn
_.isEmpty
_.isEmpty
& _.size
_.omit
, _.toNumber
, & _.toPath
baseIteratee
_.concat
casts non-array array
values to arrays_.has
returns false
for nested inherited properties_.isEqual
compares promises by reference_.isPlainObject
returns false
for objects with a custom [[Prototype]]
_.mergeWith
sources are cloned when customizer
returns undefined
_.startCase
only uppercases the first character of each word_.words
detects words where an all caps word is next to a capitalized wordfp/bind
, fp/bindKey
, & fp/isEqualWith
fp/all
, fp/any
, & fp/anyPass
_.result
resolve values of functions as it deep crawls over themstringToPath
_.pad
, _.padEnd
, _.padStart
, & _.toNumber
_.debounce
to simplify, reduce timers, & fix bugsbaseClone
to avoid cloning symbols for internal usecore.min.js
& lodash.min.js
to the “fp” module ignored list_.defaultsDeep
does not overwrite regexp values_.isEqual
works with maps & sets with circular referenceslodash
as the default placeholderstack
is popped after a recursive merge so that it doesn’t affect sibling propertiesbaseIsEqualDeep
by removing a typed array check & unnecessary stack creation_.assign
, _.assignIn
, & _.intersection
_.merge
to avoid deep cloning sources if a customizer
is providedgetNative
Symbol
checks with Symbol
methods checkscore.min.js
& lodash.min.js
to the npm packageassignValue
assigns values if they aren’t the same own valuefp/omitBy
& fp/pickBy
provide value
& key
params to iterateesfp/orderBy
getPrototypeOf
to set inheritance when constructor
is a functionfp/convert
wrappers support iteratee shorthandsfp/inRange
& fp/zipWith
fp/convert
to auto wrap lodash
in the browserfp/convert
to work when given lodash
with options
fp/convert
options works when applied individuallyfp/convert
works with category modules_.isError
works with subclassed values_.merge
deep clones array, typed-array, & plain-object sourcesmaxWait
timeout isn’t processed on a leading call when leading
is false
& there isn’t a max delay queuedfp/convert
_.add
& _.subtract
return 0
when no arguments are givenfp/gt
, fp/gte
, fp/lt
, & fp/lte
don’t have rearg
applied_.debounce
& _.throttle
fp/trim
as fp/trimChars
for chars
param support_.bind
, _.curry
, & _.partial
support placeholdersfp/_baseConvert
uses _.spread
for _.partial
wrapperfp/add
& fp/subtract
don’t have rearg
appliedfp/assoc
& fp/assocPath
as aliases of fp/set
fp/dissoc
& fp/dissocPath
as aliases of fp/unset
start
param to _.spread
_.attempt
preserves custom errorsfp/partial
& fp/partialRight
accept an args
paramfp/unset
is immutable_.iteratee
clones sources for _.matchesProperty
shorthand_.flatMap
a “Collection” methodglobal
references from the npm packagefp/convert
works with aliases_.clone
& _.cloneDeep
work on prototype objects_.mergeWith
overwrites primitives with source object clones_.sum
& _.sumBy
return 0
for empty arrays_.isEmpty
for objectsfp/assign
, fp/defaults
, & fp/merge
_.matches
to the core build_.concat
returns an empty array for nullish values_.each
& _.eachRight
aliases have the correct chain behavior_.defaultsDeep
doesn’t convert function properties to objects_.fromPairs
can consume results of _.toPairs
_.isEqual
compares objects unordered_.noConflict
restores _
only if lodash
is the current value_.words
captures all-caps words_.words
treats all-lower & all-upper postfixes as separate words_.omitBy
& _.pickBy
provide a key
param to iterateesRemoved Bower & Component package support in favor of npm
Dropped IE 6-8 support
_#times
, _#forEach
, _#forIn
, _#forOwn
, & their right-forms implicitly end chain sequencesvar wrapped = _([1, 2, 3]); // in 3.10.1 wrapped.forEach(function(n) { console.log(n); }); // ➜ returns the lodash wrapper without logging until `value` is called wrapped.forEach(function(n) { console.log(n); }).value(); // ➜ logs each value from left to right and returns the array // in 4.0.0 wrapped.forEach(function(n) { console.log(n); }); // ➜ logs each value from left to right and returns the array
// in 3.10.1 var chunk = require('lodash/array/chunk'); // in 4.0.0 var chunk = require('lodash/chunk');
_.pluck
in favor of _.map
with iteratee shorthandvar objects = [{ 'a': 1 }, { 'a': 2 }]; // in 3.10.1 _.pluck(objects, 'a'); // ➜ [1, 2] _.map(objects, 'a'); // ➜ [1, 2] // in 4.0.0 _.map(objects, 'a'); // ➜ [1, 2]
thisArg
params from most methods because they were largely unused, complicated implementations, & can be tackled with _.bind
, Function#bind
, or arrow functionsvar objects = [{ 'a': 1 }, { 'a': 2 }]; var context = { 'b': 5 }; function callback(item) { return item.a + this.b; } // in 3.10.1 _.map(objects, callback, context); // in 4.0.0 _.map(objects, _.bind(callback, context));
var array = [1, 2, 3], objects = [{ 'a': 1 }, { 'a': 2 }]; // in 3.10.1 _.max(array); // ➜ 3 _.max(objects, 'a'); // ➜ { 'a': 2 } _.min(array); // ➜ 1 _.min(objects, 'a'); // ➜ { 'a': 1 } // in 4.0.0 _.max(array); // ➜ 3 _.maxBy(objects, 'a'); // ➜ { 'a': 2 } _.min(array); // ➜ 1 _.minBy(objects, 'a'); // ➜ { 'a': 1 }
_.support
_.findWhere
in favor of _.find
with iteratee shorthand_.where
in favor of _.filter
with iteratee shorthand_.pluck
in favor of _.map
with iteratee shorthand_.first
to _.head
_.indexBy
to _.keyBy
_.invoke
to _.invokeMap
_.modArgs
to _.overArgs
_.padLeft
& _.padRight
to _.padStart
& _.padEnd
_.pairs
to _.toPairs
_.rest
to _.tail
_.restParam
to _.rest
_.sortByOrder
to _.orderBy
_.trimLeft
& _.trimRight
to _.trimStart
& _.trimEnd
_.trunc
to _.truncate
_.assign
& _.assignIn
into _.assignWith
& _.assignInWith
_.clone
& _.cloneDeep
into _.cloneWith
& _.cloneDeepWith
_.indexOf
& _.lastIndexOf
into _.sortedIndexOf
& _.sortedLastIndexOf
_.invert
into _.invertBy
(see v4.1.0)_.isEqual
into _.isEqualWith
_.isMatch
into _.isMatchWith
_.max
& _.min
into _.maxBy
& _.minBy
_.merge
into _.mergeWith
_.omit
& _.pick
into _.omitBy
& _.pickBy
_.sample
into _.sampleSize
_.sortedIndex
into _.sortedIndexBy
_.sortedLastIndex
into _.sortedLastIndexBy
_.sum
into _.sumBy
_.uniq
into _.sortedUniq
, _.sortedUniqBy
, & _.uniqBy
_.zipObject
into _.fromPairs
_.sortByAll
into _.sortBy
_.at
to “Object”_.bindAll
to “Util”_.matchesProperty
shorthand to an array of [path, srcValue]
_.merge
to assign undefined
if the destination property doesn’t exist_.groupBy
& _.sortBy
provide a single param to iteratees_.add
, _.max
, _.min
, & _.sum
no longer coerce values to numbers_.capitalize
uppercase the first character & lowercase the rest (see _.upperFirst)_.eq
its own method instead of an alias for _.isEqual
_.functions
return only own method names_.max
& _.min
return undefined
when passed an empty array_.words
chainable by default./lodash.js
to ./dist/lodash.js
in the master
branch./index.js
to ./lodash.js
in the npm
branchisDeep
params from _.clone
& _.flatten
multiValue
param from _.invert
_.bindAll
func
-first param signature from _.before
& _.after
options
param support in _.debounce
, _.mixin
, & _.throttle
orders
param in _.orderBy
_.escapeRegExp
align to the defunct ES7 proposal_.max
, _.min
, & _.sum
support arrays onlyoptions
param signature from _.template
Core build
_.assignIn
, _.before
, _.bind
, _.chain
, _.clone
, _.compact
, _.concat
, _.create
, _.defaults
, _.defer
, _.delay
, _.each
, _.escape
, _.every
, _.filter
, _.find
, _.first
, _.flatten
, _.flattenDeep
, _.forEach
, _.has
, _.head
, _.identity
, _.indexOf
, _.isArguments
, _.isArray
, _.isBoolean
, _.isDate
, _.isEmpty
, _.isEqual
, _.isFinite
, _.isFunction
, _.isNaN
, _.isNull
, _.isNumber
, _.isObject
, _.isRegExp
, _.isString
, _.isUndefined
, _.iteratee
, _.keys
, _.last
, _.map
, _.matches
, _max
, _.min
, _.mixin
, _.negate
, _.noConflict
, _.noop
, _.once
, _.pick
, _.reduce
, _.result
, _.size
, _.slice
, _.some
, _.sortBy
, _.tap
, _.thru
, _.toArray
, _.uniqueId
, _#value
, & _.values
Object
objects_.matchesProperty
is removedAdded 80 methods
22 array methods:
_.concat, _.differenceBy, _.differenceWith, _.fromPairs, _.intersectionBy, _.intersectionWith, _.join, _.pullAll, _.pullAllBy, _.reverse, _.sortedIndexBy, _.sortedIndexOf, _.sortedLastIndexBy, _.sortedLastIndexOf, _.sortedUniq, _.sortedUniqBy, _.unionBy, _.unionWith, _.uniqBy, _.uniqWith, _.xorBy, & _.xorWith
18 lang methods:
_.cloneDeepWith, _.cloneWith, _.eq, _.isArrayLike, _.isArrayLikeObject, _.isEqualWith, _.isInteger, _.isLength, _.isMatchWith, _.isNil, _.isObjectLike, _.isSafeInteger, _.isSymbol, _.toInteger, _.toLength, _.toNumber, _.toSafeInteger, & _.toString
13 object methods:
_.assignIn, _.assignInWith, _.assignWith, _.functionsIn, _.hasIn, _.invoke, _.mergeWith, _.omitBy, _.pickBy, _.setWith, _.toPairs, _.toPairsIn, & _.unset
8 string methods:
_.lowerCase, _.lowerFirst, _.replace, _.split, _.upperCase, _.upperFirst, _.toLower, & _.toUpper
8 utility methods:
_.cond, _.conforms, _.nthArg, _.over, _.overEvery, _.overSome, _.rangeRight, & _.toPath
2 collection methods:
_.flatMap (see v4.2.0) & _.sampleSize
2 number methods:
_.clamp & _.subtract
1 chain method:
_#next
Added 3 aliases
_.extend
as an alias of _.assignIn
_.extendWith
as an alias of _.assignInWith
_.first
as an alias of _.head
Removed 17 aliases
_.all
in favor of _.every
_.any
in favor of _.some
_.backflow
in favor of _.flowRight
_.callback
in favor of _.iteratee
_.collect
in favor of _.map
_.compose
in favor of _.flowRight
_.contains
in favor of _.includes
_.detect
in favor of _.find
_.foldl
in favor of _.reduce
_.foldr
in favor of _.reduceRight
_.include
in favor of _.includes
_.inject
in favor of _.reduce
_.methods
in favor of _.functions
_.object
in favor of _.fromPairs
or _.zipObject
_#run
in favor of _#value
_.select
in favor of _.filter
_.unique
in favor of _.uniq
insteadPerformance improvements
_.at
, _.find
& _.findLast
object
& source
identical_.isEqual
to avoid stack crawls when arrays or objects are different sizesEmoji support
Functional goodies
lodash-fp
into lodash
as require('lodash/fp')
for immutable auto-curried iteratee-first data-last methodsclear
method to _.memoize.Cache
flush
method to debounced & throttled functions_.clone
, _.isEqual
, & _.toArray
_.isEqual
_.toArray
_.zipObject
window
or self
when available regardless of other exports_.flow
& _.flowRight
to accept an array of functionscancel
clears args
& thisArg
references_.add
& _.sum
don’t skip NaN
values_.assign
, _.defaults
, & _.merge
coerce object
values to objects_.bindKey
bound functions call object[key]
when called with the new
operator_.clone
treats generators like functions_.clone
produces clones with the source’s [[Prototype]]
_.defaults
assigns properties that shadow Object.prototype
_.defaultsDeep
doesn’t merge a string into an array_.defaultsDeep
& _.merge
don’t modify sources_.defaultsDeep
works with circular references_.isFunction
returns true
for generator functions_.keys
skips “length” on strict mode arguments
objects in Safari 9_.merge
assigns typed arrays directly_.merge
doesn’t convert strings to arrays_.merge
merges plain-objects onto non plain-objects_#plant
resets iterator data of cloned sequences_.random
swaps min
& max
if min
is greater than max
_.range
preserves the sign of start
of -0
_.reduce
& _.reduceRight
use getIteratee
in their array branchprecision
param of _.floor
_(...)
an iterator & iterable_.drop
, _.take
, & right forms coerce n
of undefined
to 0
func
is a function before calling getData
_.clone
provides the correct number of arguments to customizer
_#reverse
doesn’t modify the original array when called after _#slice
_.ceil
, _.defaultsDeep
, _.floor
, _.modArgs
, & _.round
_.bind
works with all built-in constructors_#concat
treats sparse arrays as dense_.chunk
floors size
values_.debounce
& _.throttle
reset lastCall
after cancelling_.flow
& _.flowRight
work with functions combined with _.first
_.indexOf
returns -1
for unmatched binary searches_.noConflict
operates on root
& not context
_.escapeRegExp
more robust_.sortByOrder
support orders of “asc” & “desc”_.flatten
, _.max
, & _.min
_.isArguments
, _.isFunction
, & _.isPlainObject
_.isElement
, _.isFinite
, _.isNative
, _.now
, _.parseInt
, & _.sum
parseFloat
assigned from the context
param of _.runInContext
_.set
handles non-index property names that start with numbers correctlyisLaziable
work with wrapped lodash methods_.isEqual
_.sample
_.gt
, _.gte
, _.lt
, & _.lte
ImmutableMap
to _.memoize.Cache
require
in source comments to improve browserify build timesbaseCreate
works in ExtendScriptcustomizer
results are respected by _.isEqual
LodashWrapper.prototype.thru
exists before creating a wrapper in flow
_.bind
works with ES2015 class constructors_.get
can return null
values_.intersection
works with a single array_.has
treats sparse arrays as dense_.merge
skips undefined
array values if a destination value existsnull
sort behind undefined
& NaN
_.eq
an alias of _.isEqual
_.isEqual
_.max
& _.min
when invoked with iteratees_.pullAt
& _.remove
hasOwnProperty
for the creation of reIsNative
to avoid issues with core-js_.mapKeys
, _.unzipWith
, & _.zipWith
_.difference
, _.intersection
, _.uniq
, & _.xor
accept array-like values_.get
& _.set
baseAt
, basePullAt
, & pullAt
handle nullish valuesbaseGet
only returns undefined
for incomplete paths_.padLeft
& _.padRight
handle empty strings correctly_.isEqual
treat -0
& 0
as equivalent_.flow
& _.flowRight
slice
for start
of 0
Object.assign
use to strict mode only_.get
, _.method
, _.methodOf
, & _.set
_.intersection
of a single array returns an empty array_.remove
mutates array
after the predicate
pass_.has
& _.get
can access index values of stringscreateAssigner
& _.sortByAll
use _.restParam
_.add
coerce augend
& addend
params to numbers_.assign
use built-in Object.assign
when available_.inRange
swap start
& end
params when start
is greater than end
_.has
, _.get
, _.callback
, _.invoke
, _.matchesProperty
, _.method
, _.methodOf
, _.property
, _.propertyOf
, _.result
, & _.set
_.restParam
isIterateeCall
guards to _.every
, _.includes
, & _.some
iteratee
& thisArg
params to _.sum
_.flow
& _.flowRight
_.deburr
removes combining diacritical marks_.difference
is based on the values of the first param only_.matches
work with non-plain objects & match inherited properties_.findLast
, _.reduce
, & _.reduceRight
replace
& split
chaining methodsdrop
works when applied after filter
_.add
, _.sortByOrder
, & _.sum
root
to work when bundled by webpack & running in a web workerdrop
& dropWhile
_.defaults
works as an iteratee for _.reduce
baseFlatten
, baseIndexOf
, indexOfNaN
, _.flow
, & _.flowRight
takeWhile
works with lazy reverse
& last
wait
defaults to 0
for _.debounce
& _.throttle
isIterateeCall
doesn’t error if index
is missing a toString
method_.difference
, _.intersection
, & _.uniq
in Firefox_.inRange
_.clone
to work with more truthy isDeep
valuesisIterateeCall
works with NaN
values_.merge
avoids iterating string object
or source
params_.attempt
_.template
_.fill
, _.matchesProperty
, & _.spread
_#commit
& _#plant
_.compact
& _.toArray
_.attempt
to provide additional arguments to func
_.flow
returns an identity function when called without arguments_#reverse
tracks __chain__
values_.slice
handles floating-point start
& end
params_.slice
when used after _.filter
_#run
an alias of _#value
_.startCase
isIterateeCall
works correctly with objects_.slice
coerces floating-point start
& end
params to integersinitial
, rest
, & reverse
_.merge
regression with DOM elements_#value
is implicitly or explicitly calledvar wrapped = _([1, 2, 3]); // in 2.4.1 wrapped.forEach(function(n) { console.log(n); }); // ➜ logs each value from left to right and returns the lodash wrapper // in 3.0.0 wrapped.forEach(function(n) { console.log(n); }); // ➜ returns the lodash wrapper without logging until `value` is called wrapped.forEach(function(n) { console.log(n); }).value(); // ➜ logs each value from left to right and returns the array
var array = [1], wrapped = _(array); // in 2.4.1 var a = wrapped.push(2), // pushes `2` to `array` b = wrapped.push(3); // pushes `3` to `array` a.value(); // ➜ returns `array`; [1, 2, 3] b.value(); // ➜ returns `array`; [1, 2, 3] // in 3.0.0 var a = wrapped.push(2), // creates a lazy sequence to push `2` to `array` b = wrapped.push(3); // creates a lazy sequence to push `3` to `array` a.value(); // ➜ pushes `2` to `array` and returns `array`; [1, 2] b.value(); // ➜ pushes `3` to `array` and returns `array`; [1, 2, 3] a.value(); // ➜ pushes `2` to `array` and returns `array`; [1, 2, 3, 2] b.value(); // ➜ pushes `3` to `array` and returns `array`; [1, 2, 3, 2, 3] // use `_#commit` to commit a sequence and continue chaining var a = wrapped.push(2).commit(), // pushes `2` to `array` b = wrapped.push(3).commit(); // pushes `3` to `array` a.value(); // ➜ returns `array`; [1, 2, 3] b.value(); // ➜ returns `array`; [1, 2, 3]
_.flatten
shallow by default & remove callback
supportvar array = [1, [[2], 3]], objects = [{ 'a': [1] }, { 'a': [2, 3] }]; // in 2.4.1 _.flatten(array); // ➜ [1, 2, 3] _.flatten(objects, 'a'); // [1, 2, 3] // in 3.0.0 _.flatten(array); // ➜ [1, [2], 3] _.flattenDeep(array); // ➜ [1, 2, 3] _(objects).pluck('a').flatten().value(); // [1, 2, 3]
data
parameter from _.template
var string = '<%= o.a %>', options = { 'variable': 'o' }, data = { 'a': 'b' }; // in 2.4.1 _.template(string, data, options); // ➜ 'b' // in 3.0.0 _.template(string, options)(data); // ➜ 'b'
_.first
& _.last
into _.take
, _.takeWhile
, _.takeRight
, & _.takeRightWhile
var array = [1, 2, 3], lessThanTwo = function(value) { return value < 2; }, greaterThanTwo = function(value) { return value > 2; }; // in 2.4.1 _.first(array); // ➜ 1 _.first(array, 2); // ➜ [1, 2] _.first(array, lessThanTwo); // ➜ [1] _.last(array); // ➜ 3 _.last(array, 2); // ➜ [2, 3] _.last(array, greaterThanTwo); // ➜ [3] // in 3.0.0 _.first(array); // ➜ 1 _.take(array, 2); // ➜ [1, 2] _.takeWhile(array, lessThanTwo); // ➜ [1] _.last(array); // ➜ 3 _.takeRight(array, 2); // ➜ [2, 3] _.takeRightWhile(array, greaterThanTwo); // ➜ [3]
_.initial
& _.rest
into _.dropRight
, _.dropRightWhile
, _.drop
, & _.dropWhile
var array = [1, 2, 3], lessThanTwo = function(value) { return value < 2; }, greaterThanTwo = function(value) { return value > 2; }; // in 2.4.1 _.initial(array); // ➜ [1, 2] _.initial(array, 2); // ➜ [1] _.initial(array, greaterThanTwo); // ➜ [1, 2] _.rest(array); // ➜ [2, 3] _.rest(array, 2); // ➜ [3] _.rest(array, lessThanTwo); // ➜ [2, 3] // in 3.0.0 _.initial(array); // ➜ [1, 2] _.dropRight(array, 2); // ➜ [1] _.dropRightWhile(array, greaterThanTwo); // ➜ [1, 2] _.rest(array); // ➜ [2, 3] _.drop(array, 2); // ➜ [3] _.dropWhile(array, lessThanTwo); // ➜ [2, 3]
_.isFinite
& _.keys
with ES2015_.clone
& _.cloneDeep
, & “isType” methods from “Object” to “Lang”_.escape
, _.template
, & _.unescape
from “Util” to “String”_.range
from “Array” to “Util”_.toArray
from “Collection” to “Lang”_.clone
& _.cloneDeep
return a new object for unsupported types_.findWhere
its own method instead of an alias for _.find
_.max
& _.min
non-chainable by default_.memoize
caches have the Map
interface of delete
, get
, has
, & set
_.unzip
its own method instead of an alias for _.zip
./dist/lodash.js
to ./lodash.js
in the master
branch./dist/lodash.js
to ./lodash.js
in the npm
branch./dist/lodash.compat.js
to the lodash/lodash-compat
repository_.sortBy
to _.sortByAll
_.functions
underscore
build_.createCallback
to _.callback
_.support.argsClass
to _.support.argsTag
_.support.nodeClass
to _.support.nodeTag
_.mixin
to iterating only own properties of source
objectscustomizer
callbacks of _.assign
,_.clone
, _.cloneDeep
, _.isEqual
, & _.merge
_.bind
, _.bindKey
, _.curry
, _.curryRight
, _.partial
, & _.partialRight
NaN
to _.difference
, _.includes
, _.indexOf
, _.intersection
, _.lastIndexOf
, _.union
, _.uniq
, & _.xor
_.assign
& _.merge
don’t assign customizer
results if it’s unchanged_.mixin
doesn’t extend lodash when given an empty options
object_.sortedIndex
returns values that align with the sort order of _.sortBy
_.matches
return true
when comparing empty sources_.matches
perform own property checks on objects_.chain
use an existing wrapper if available instead of creating a new wrapperargCount
parameter from _.callback
17 string methods:_.camelCase
, _.capitalize
, _.deburr
, _.endsWith
, _.escapeRegExp
, _.kebabCase
, _.pad
, _.padLeft
, _.padRight
, _.repeat
, _.snakeCase
, _.startsWith
, _.trim
, _.trimLeft
, _.trimRight
, _.trunc
, & _.words
11 array methods:_.chunk
, _.dropRight
, _.dropRightWhile
, _.dropWhile
, _.flattenDeep
, _.pullAt
, _.slice
, _.sortedLastIndex
, _.takeRight
, _.takeRightWhile
, & _.takeWhile
6 function methods:_.ary
, _.before
, _.curryRight
, _.flow
, _.negate
, & _.rearg
5 lang methods:_.isError
, _.isMatch
, _.isNative
, _.isTypedArray
, & _.toPlainObject
3 utility methods:_.attempt
, _.matches
, & _.propertyOf
2 collection methods:_.partition
& _.sortByAll
2 object methods:_.keysIn
& _.valuesIn
1 chain method:_.thru
_.backflow
& _.compose
as aliases of _.flowRight
_.contains
as an alias of _.includes
_.iteratee
as an alias of _.callback
_#toJSON
as an alias of _#valueOf
_.drop
, _.dropRight
, _.dropRightWhile
, _.dropWhile
, _.filter
, _.first
, _.initial
, _.last
, _.map
, _.pluck
, _.reject
, _.rest
, _.reverse
, _.slice
, _.take
, _.takeRight
, _.takeRightWhile
, _.takeWhile
, & _.where
_.bind
, _.clone
, _.cloneDeep
, _.compact
, _.compose
, _.contains
, _.difference
, _.escape
, _.flatten
, _.invoke
, _.isEqual
, _.isObject
, _.matches
, _.max
, _.min
, _.partial
, _.shuffle
, _.unescape
, _.uniq
, _.without
, & _.zip
_.ary
, _.curryRight
, _.flow
, & _.rearg
_.bind
, _.bindKey
, _.curry
, _.curryRight
, _.partial
, & _.partialRight
_.map
, & the like, out of the box:_.ary
, _.callback
, _.chunk
, _.clone
, _.create
, _.curry
, _.curryRight
, _.drop
, _.dropRight
, _.flatten
, _.invert
, _.max
, _.min
, _.parseInt
, _.slice
, _.sortBy
, _.take
, _.takeRight
, _.template
, _.trim
, _.trimLeft
, _.trimRight
, _.trunc
, _.random
, _.range
, _.sample
, _.uniq
, & _.words
_.reduce
, & the like, out of the box:_.assign
, _.defaults
, _.merge
, & _.sortAllBy
cancel
method to debounced & throttled functionsdefaultValue
param to _.result
multiValue
param to _.invert
thisArg
param to _.tap
_.memoize.Cache
to enable Map
/WeakMap
to be used_.clone
& _.cloneDeep
_.isEqual
sourceURL
option of _.template
to work in production builds_.at
, _.matches
, & _.pullAt
work with falsey values when keys are given_.callback
doesn’t error when func
is nullish & thisArg
is given_.callback
supports binding built-in methods_.debounce
& _.throttle
work if the system time is set backwards_.difference
works with arrays regardless of argument position_.findWhere
& _.where
always use _.matches
_.includes
supports fromIndex
when iterating objects_.indexOf([], undefined, true)
returns -1
instead of 0
_.intersection
ignores non-array secondary values_.isEqual
works with wrapped objects containing constructor
properties_.keys
treats sparse arrays as dense_.keys
works with string objects in IE < 9_.matches
comparison isn’t affected by changes to source
objects_.max
& _.min
return the correct value when callback
computes ±Infinity_.merge
ignores undefined
values of source
object properties_.partial
& _.partialRight
work with curried functions_.pluck
always uses _.property
_.random
returns 1
or 0
when called with no arguments_.range
, _.slice
, & other methods handle NaN
arguments_.runInContext
uses a zeroed _.uniqueId
counter_.transform
checks that object
is an object before using its [[Prototype]]
_.where
handles source
objects with undefined
property values_.where
only returns elements that contain all source array/object values_.indexOf
affects _.includes
when iterating objectsNW.js
Function.prototype
extensions to its prototype_.isFunction
for typed array constructors in Safari 8_.escape
& _.unescape
handle backticks_.isElement
more robust_.parseInt
more closely follow spec_.wrap
use _.identity
when wrapper
is nullish_.escape
if “escape” delimiters are not usedToLength
Set
in _.difference
, _.intersection
, & _.uniq
compat
build_.template
_.bind
, _.bindKey
, _.curry
, _.partial
, & _.partialRight
__bindData__
is properly cloned_.isEqual
can compare cyclical objects with shared property values_.partial
& _.partialRight
_.constant
, _.mapValues
, _.now
, _.property
, & _.xor
options
param to _.mixin
to specify whether functions added are chainable_.sortBy
to accept an array of property names to sort by_.zipObject
to accept an array of keys
with no values
paramsetImmediate
use from _.defer
_.create
& _.noop
_.debounce
& _.throttle
_.createCallback
to avoid binding functions bound by Function#bind
_.isEqual
works with values from Object.create(null)
& _(false)
_.min
& _.max
work as callbacks for _.map
_.template
coerces the text
param to a string_.difference
, _.omit
, & _.without
by way of baseDifference
_.isBoolean
, _.isNumber
, & _.isString
for the false
case_.sample
& _.shuffle
by way of baseRandom
_.wrap
by way of createBound
Function#bind
use for better cross-environment consistency_.mixin
creates functions that work with _.chain
createObject
fallback is included in the modern
build_.clone
support for date, regexp, & other built-in objects_.random
avoids excessive results of 0
for floating-point numberscompat
& underscore
builds use Date.now
when availablegetObject
& releaseObject
Object.defineProperty
fallback for the modern
build_.random
to explicitly specify floating point numbers_.compose
to be invoked without arguments_.flatten
works with extremely large arrays_.support
properties aren’t minifiedreThis
isn’t used in Windows 8 applications_.isArguments
& _.isArray
fallbacks_.after
with Underscore 1.5.0, making it always return a function_.unzip
an alias of _.zip
_.chain
force chaining for all methodslodash-cli
_.contains
, _.debounce
, _.isArguments
, _.throttle
, & _.where
_.bind
, _.bindKey
, _.curry
, _.partial
, & _.partialRight
_.curry
, _.forEachRight
, _.indexBy
, _.findLast
, _.findLastIndex
, _.findLastKey
, _.forInRight
, _.forOwnRight
, _.pull
, _.remove
, & _.sample
modularize
build optioniife
command to be used without an %output%
token_.mixin
to accept a destination object_.range
to accept a step
of 0
arguments
objects_.at
works as a callback for _.map
_.createCallback
works when no argCount
is specified_.first
& _.last
return arrays when given an n
with a falsey array
_.flatten
works with arguments
objects_.zipObject
skips falsey elements_.eachRight
an alias of _.forEachRight
_.memoize
avoid prefixing cache
keys when using a resolver
functionclearTimeout
& setTimeout
variables from the underscore
buildcreateCache
underscore
build compatibility to v1.5.2cache
property to the objects returned by getObject
maxWait
unit tests pass in RingomaxPoolSize
valuereleaseArray
& releaseObject
_.transform
_.chain
& _.findWhere
aliasesmaxWait
option to _.debounce
_.random
component build
lodash
& underscore
build methodsleading
& trailing
options works as expected--output
paths containing build command keywordsfalse
in _.isObject
& _.isRegExp
_.clone
, _.flatten
, & _.uniq
can be used as callback for _.map
_.forIn
works on objects with longer inheritance chains in IE < 9_.isPlainObject
returns true
for empty objects in IE < 9_.max
& _.min
chain correctlyclearTimeout
use doesn’t cause errors in Titanium--stdout
build option doesn’t write to a filecache
Error.prototype
iteration bugs_.indexOf
template
pre-compiler build option avoid escaping non-ascii characters_.createCallback
avoid binding functions if they don’t reference this
_.difference
, _.intersection
, & _.uniq
_.flatten
& _.indexOf
use_.unzip
& _.zip
_.assign
& _.defaults
_.isPlainObject
works with objects created by Object.create(null)
false
for subclassed valuesleading
& trailing
calls enabled, only perform trailing calls after they’re called more than once_.unzip
options
param to _.debounce
& _.throttle
underscore
builds to include _.findWhere
& _.chain
arguments
objects & arrays respectivelyunderscore
build versions of “isType” methods align with Underscore__proto__
property_.isEqual
uses a callback
only if it’s a function_.merge
applies a callback
to nested properties_.merge
provides the correct callback
arguments when comparing objectsmodern
buildunderscore
build of _.forEach
accepts a thisArg
param_.createCallback
, _.findIndex
, _.findKey
, _.parseInt
, & _.runInContext
_.support
callback
& thisArg
params to _.flatten
rhino -require
supportexports
object is not a DOM element_.isPlainObject
returns false
for objects without a [[Class]]
of “Object”callback
support in _.cloneDeep
more closely follow its documentation_.object
an alias of _.zipObject
--output
paths_.find
, & _.pluck
backbone
build method dependencies_.isPlainObject
works when built-in Object.getPrototypeOf
is unavailable-p
/--source-map
options_.assign
is not treated as a callback
-p
/--source-map
build options correctly set the sourceMappingURL
-p
/--source-map
set source map “sources” keys based on the build_.defer
use setImmediate
, in Node.js, when available_.where
search arrays for values regardless of their index position_.template
_.defaults
preserve null
values, instead of overwriting them_.at
& _.partialRight
modern
& -p
/--source-map
build options_.templateSettings
_.pluck
& _.where
callback shorthands_.assign
& _.defaults
support arrays_.merge
assigns null
values & produces dense arrayslodash
utility requires themnoNodeClass
test to avoid Firebug’s “break on all errors” feature_.where
support deep object comparisons_.invert
, _.pairs
, & _.values
_.max
, _.min
, _.pluck
, _.toArray
, & _.where
_.template
createIterator
& iteratorTemplate
_.uniqueId
to avoid problems with buggy minifiersunderscore
build compatibility to v1.4.4callback
& thisArg
params to _.assign
, _.clone
, _.cloneDeep
, _.first
, _.last
, _.initial
, _.isEqual
, _.merge
, & _.rest
_#join
, _#pop
, & _#shift
wrapper methods return unwrapped values_.cloneDeep
_.once
to the backbone
buildbackbone
builds implement Underscore’s chaining behaviorsettings=…
build option doesn’t clobber the default moduleId
_
_.forEach
dependency from _.intersection
_.isArray
& _.isFunction
fallbacks as well as _.intersection
, _.isDate
, _.isRegExp
, _.reduce
, _.reduceRight
, _.union
, & _.uniq
underscore
build compatibility to v1.4.3arguments
objects to _.clone
_.clone
creates plain object clones of non-plain objects_(…)
chain automatically without needing to call _#chain
_.isEqual
equate arguments
objects to similar Object
objects_.reduce
& _.reduceRight
provide the correct callback
arguments_.throttle
nulls the timeoutId
_.clone
more closely follow the structured clone algorithm_.forEach
, _.forOwn
, _.isNumber
, & _.isString
iteratorTemplate
_.lateBind
to _.bindKey
_.defaults
& _.extend
iterate only own properties of source
objects to align with Object.assign
_.assign
underscore
build of _.find
returns the first match, not last_.defaults
, _.extends
, & _.merge
work with _.reduce
_.extend
an alias of _.assign
_.contains
, _.defaults
, _.extend
, & _.filter
_.where
to iterate only own properties of source
objectsbackbone
build lodash method dependenciesfromIndex
param to _.contains
moduleId
build option_.max
& _.min
_.template
_.every
, _.find
, _.some
, & _.uniq
_.every
returns false
as soon as the callback
result is falsey_.isFinite
returns false
for non-numeric values_.forEach
chainability in the underscore
build_.union
sourceURL
option to _.template
_.where
returns an empty array if given an empty properties
object_.isFinite
to return true
for numeric strings_.intersection
, _.omit
, _.pick
, _.sortedIndex
, & _.where
_.bindAll
, _.contains
, _.countBy
, _.every
, _.filter
, _.find
, _.functions
, _.groupBy
, _.invert
, _.invoke
, _.isEmpty
, _.map
, _.merge
, _.omit
, _.pairs
, _.pick
, _.pluck
, _.reduce
, _.reject
, _.some
, _.sortBy
, _.values
, _.where
, & internal shimKeys
_.map
returns an array when given a falsey collection_.throttle
clears its timeout when func
is called_.max
, _.min
, _.shuffle
support iterating objectscreateIterator
, _.clone
, _.compact
_.max
, _.min
, & _.sortedIndex
underscore
build when clone
is explicitly included_.random
return 0
or 1
when no arguments are given_.bind
to _.lateBind
clone
, isEqual
, toArray
methods from _.clone
, _.isEqual
, & _.toArray
-d
/--debug
, -m/--minify
, minus
, plus
, settings
, & template
build options_.isPlainObject
& _.lateBind
_.sortedIndex
to accept a property name as the callback
paramthisArg
of null
iife
build option to accept more values_.times
return an array of callback
results_.max
, _.min
, & _.reduceRight
_.zipObject
to _.object
_.drop
with _.omit
_.drop
an alias of _.rest
_.invert
, _.pairs
, & _.random
_.result
to the backbone
buildexports
, iife
, -c
/--stdout
, -o
/--output
, & -s
/--silent
build optionsisPlainObject
works with objects from other documents_.isEqual
compares values with circular references correctly_.merge
work with four or more arguments_.sortBy
performs a stable sort for undefined
values_.template
works with “interpolate” delimiters containing ternary operators_chain
& _wrapped
double-underscored to avoid conflictsminify.js
support underscore.js
mobile
& underscore
builds_.isEqual
& _.size
useSourceURL
testisPlainObject
callback
& thisArg
params to _.drop
& _.pick
hasObjectSpliceBug
test to avoid delete
operator use_.unescape
_.reduce
works with string objects in IE < 9_.omit
an alias of _.drop
_.intersection
& removed its dependency on _.every
underscore
build_.isElement
uses strict equality for its duck type check_.isObject
returns a boolean value_.template
& “Object” methods don’t error when given falsey values_.template
generate less unused code in compiled templates_.bind
correctly appends array arguments to partially applied arguments in older browsers_.countBy
, _.drop
, _.merge
, & _.where
csp
(Content Security Policy) & underscore
build options_.clone
_.forEach
, _.forIn
, & _.forOwn
_.isEmpty
& _.size
_.clone
doesn’t clone arguments
objects, DOM nodes, functions, or non-plain objects_.filter
’s callback
can’t modify result values_.isEmpty
, _.isEquals
, & _.size
support arguments
objects_.isEqual
doesn’t inspect DOM nodes, works with objects from other documents, & calls custom isEqual
methods before checking strict equality_.once
frees the given function for garbage collection_.sortBy
performs a stable sortreEvaluateDelimiter
is used when _.templateSettings.evaluate
is undefined
_.range
coerce arguments to numbers_.isFunction
strict
build option_.bindAll
, _.defaults
, & _.extend
avoid strict mode errors on read-only properties_.difference
, _.intersection
, & _.without
_.template
regressionbin
& scripts
entries to package.jsonlegacy
build option_.zipObject
_.indexOf
’s fromIndex
in _.difference
& _.without
iteratorTemplate
for builds_.bind
in V8_.size
work with falsey values & consistent cross-browser with arguments
objects_.groupBy
& _.sortBy
back to the “Collection” categoryarguments
object from _.range
_.escape
returns an empty string for nullish valuessourceURL
support doesn’t cause errors in Adobe’s JS engine_.invoke
& _.pluck
back to the “Collection” category_.tap
to the “Seq” categorybackbone
build optionarray
params_.isArguments
fallback from the mobile
build_.pluck
, _.values
& _(...)
method wrappers_.forIn
& _.forOwn
category
build optionfromIndex
param to _.indexOf
& _.lastIndexOf
//@ sourceURL
support to _.template
thisArg
param to _.sortedIndex
& _.uniq
length
properties are treated like regular objects_.sortedIndex
supports arrays with high length
valuesprototype
iteration bug in _.keys
_.times
& this
bindings in iterator methodsmobile
build option_.find
returns undefined
for unmatched values_.templateSettings.variable
is compatible with Underscore_.escape
_.find
_.groupBy
values are added to own, not inherited, properties_.bind
follow ES5 spec to support a popular Backbone.js pattern_.intersect
_.bind
, _.flatten
, _.groupBy
, _.max
, & _.min
_.partial
thisArg
param to _.groupBy
_.bind
_.templateSettings.variable
valueiterationFactory
options object_(...)
returns given wrapper instances_.max
& _.min
support extremely large arrays_.throttle
works in tight loopsclearTimeout
typo[DontEnum]
bug in IE < 9prototype
iteration bug in Firefox < 3.6, Opera < 11.60, & Safari < 5.1_.isFunction
calls_.debounce
’ed functions match _.throttle
’ed functions’ return value behavior_.escape
no longer translate the “>” character_.debounce
, _.escape
, _.flatten
, _.forEach
, _.groupBy
, _.intersection
, _.invoke
, _.isObject
, _.max
, _.min
, _.pick
, _.shuffle
, _.sortedIndex
, _.template
, _.throttle
, _.union
, _.uniq
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4