-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Changelog
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.
Fixes a ReferenceError issue in lodash lodash-es lodash-amd and lodash.template when using the template and fromPairs functions from the modular builds. See https://github.com/lodash/lodash/issues/6167#issuecomment-4165269769
These defects were related to how lodash distributions are built from the main branch using https://github.com/lodash-archive/lodash-cli. When internal dependencies change inside lodash functions, equivalent updates need to be made to a mapping in the lodash-cli. (hey, it was ahead of its time once upon a time!). We know this, but we missed it in the last release. It's the kind of thing that passes in CI, but fails bc the build is not the same thing you tested.
There is no diff on main for this, but you can see the diffs for each of the npm packages on their respective branches:
-
lodash: https://github.com/lodash/lodash/compare/4.18.0-npm...4.18.1-npm -
lodash-es: https://github.com/lodash/lodash/compare/4.18.0-es...4.18.1-es -
lodash-amd: https://github.com/lodash/lodash/compare/4.18.0-amd...4.18.1-amd -
lodash.templatehttps://github.com/lodash/lodash/compare/4.18.0-npm-packages...4.18.1-npm-packages
_.unset / _.omit: Fixed prototype pollution via constructor/prototype path traversal (GHSA-f23m-r3pf-42rh, fe8d32e). Previously, array-wrapped path segments and primitive roots could bypass the existing guards, allowing deletion of properties from built-in prototypes. Now constructor and prototype are blocked unconditionally as non-terminal path keys, matching baseSet. Calls that previously returned true and deleted the property now return false and leave the target untouched.
_.template: Fixed code injection via imports keys (GHSA-r5fr-rjxr-66jc, CVE-2026-4800, 879aaa9). Fixes an incomplete patch for CVE-2021-23337. The variable option was validated against reForbiddenIdentifierChars but importsKeys was left unguarded, allowing code injection via the same Function() constructor sink. imports keys containing forbidden identifier characters now throw "Invalid imports option passed into _.template".
- Add security notice for
_.templatein threat model and API docs (#6099) - Document
lower > upperbehavior in_.random(#6115) - Fix quotes in
_.compactjsdoc (#6090)
We have also regenerated and published a select number of the lodash.* modular packages.
These modular packages had fallen out of sync significantly from the minor/patch updates to lodash. Specifically, we have brought the following packages up to parity w/ the latest lodash release because they have had CVEs on them in the past:
- lodash.orderby
- lodash.tonumber
- lodash.trim
- lodash.trimend
- lodash.sortedindexby
- lodash.zipobjectdeep
- lodash.unset
- lodash.omit
- lodash.template
- Fix prototype pollution in
_.unsetand_.omitfunctions (CVE-2025-13465)
- Prevent command injection through
_.template's variable option - Improve performance of
toNumber,trimandtrimEndon large input strings
- Fixed issue with dependencies mapping
- Ensured modularized files in the lodash package are up to date
- Allowed
_.sortedIndexBymethods to short-circuit for empty arrays - Ensured
_.orderByaccepts iteratee path arrays - Ensured
_.isEqualreturns accurate results without depending on parameter order for circular references - Sanitized
sourceURLin_.template - Fix prototype pollution bug in
_.zipObjectDeep - Note: releases of 4.17.16 to 4.17.18 of the lodash npm package were corrupted; please update to more recent versions
- Removed unintentionally published project helper scripts
- Reverted use of the
"type"field inpackage.jsonoflodash-es
- Fixed missing dependency of
_createRound
- Ensured
_.ceil,_.floor, &_roundhandleInfinityconsistently - Ensured
_.debounceclears old timers before starting new ones - Ensured
_.mergeWithalways provides astacktocustomizer - Ensured additions to
Object.prototypedon’t breaklodashinitialization - Ensured map and set clones contain custom properties of source values
- Fixed prototype pollution for
_.defaultsDeep - Fixed prototype pollution for
_.templateoptions
- Ensured
_.mergehandles function properties consistently regardless of number of sources - Ensured
Object.prototypeis not augmented by_.merge - Ensured placeholder properties are set on
fp.convert()results - Avoided ReDoS issue in
_.wordsimplementation
- Updated Lodash for better Node.js 10 support
- Ensured
_.clonesupports subclassed arrays - Ensured
_.cloneDeepworks with cyclical maps & sets - Ensured
_.defaultsavoids unnecessary source property access - Ensured
_.invertdoesn’t error on inverted values withouttoStringmethods - Ensured
_.merge&_.mergeWithavoid augmenting__proto__properties - Ensured
_.setsupports paths with symbols - Ensured
_.wordsdetects ordinals in compound words - Ensured
fp.updateworks with paths that refer to functions
- Ensured
_.omitwith deep paths doesn’t mutateobject
- Added support for symbol properties to
_.isEqual - Ensured
getSymbolshelper only gets enumerable symbols - Ensured
_.startsWithavoids coercingpositionofundefined - Flipped iteratee arguments for
fp.reduceRight - Removed the array length limit for lazy evaluation
- Ensured
_.pickpicks keys over paths - Ensured
_.spreaddoesn’t include arguments after those spread - Fixed
_.omitperformance regression
- Ensured
_.omitcopies shallow path values by reference - Ensured
_.picksupports path arrays - Ensured
_.pickBydoesn’t treat keys with dots or brackets as deep paths
- Added deep path support to
_.omit&_.pick - Ensured
fp.assignAllWith&fp.mergeAllWithaccept more than two sources - Made
process.bindingdetection more cautious to avoid chatty debugging
- Ensured
_.xorreturns an empty array when comparing the same array
- Added support for ordinal numbers to
_.words - Ensured
_.xorworks with more than two arrays - Ensured
fp.converthandles aliased & remapped methods - Improved “fp” debugging
- Made “isType” methods resistant to
toStringTagspoofing - Made
_.isEmptyexit early for nullish values - Refined
_.isErrorchecks to avoid false positives for plain objects - Simplified
_.isElement
- Added support for buffers to
_.transform - Added support for typed arrays to
_.isEmpty - Ensured
_.toStringworks on an array of symbols - Fixed
_.mergeregression with buffers - Normalized buffers & typed arrays keys in “keys” methods
- Split
_.isArgumentsout for older & newer environments
- Added a
_.runInContextcheck in the “fp” browser build - Ensured
_.defaultsDeep&_.mergeconsistently assignundefinedvalues - Fixed
_.isFunctiondetection ofProxyin Safari 10 - Made
_.isEqualtreat buffers differently thanUint8Arrayvalues - Removed es-sham requirement for older browsers
- Fixed
_.sampleSizeperformance regression - Made “clone” methods use newer
BufferAPIs when available
- Fixed backtick removal of
_.escape&_.unescape - Improved parse time by 2x in V8
- Added
fp.rangeStep&fp.rangeStepRight - Added a cache limit to internal
_.memoizeuse - Avoided V8 de-opts in
_.isElement,_.isObject, &_.isObjectLike - Dropped backtick encoding from
_.escape&_.unescape - Dropped testing in Node.js 0.10 & 0.12
- Ensured
__proto__is treated as a regular key in assignments - Fixed
_.bind&_.partialperformance regression - Optimized
_.concat
- Added Latin Extended-A block support to
_.deburr - Reduced dependencies of
_.isEmpty&_.toNumber
- Ensured methods work with mocked
Date.now,clearTimeout, &setTimeout - Ensured paths of “set” methods overwrite primitives
- Ensured
fp.nthArgreturns a curried function - Reduced dependencies of
_.initial,_.merge, &_.tail - Removed old JIT & engine bug guards
- Ensured paths with consecutive empty brackets or dots are parsed correctly
- Ensured
_.random& “range” methods coerce arguments to finite numbers - Fixed circular reference detection in
_.cloneDeep - Removed
globalprerequisite forexportsdetection
- Added _.conformsTo & _.defaultTo
- Added more “fp” aliases
- Added “All” variants of
fp/assign,fp/defaults,fp/merge, &fp/zipmethods - Ensured debounced
cancelusesclearTimeout - Ensured the alias
_.firstsupports shortcut fusion - Ensured
_.assignWithrespectscustomizerresults ofundefined - Ensured
_.divide&_.multiplyreturn1when no arguments are specified - Ensured
_.isEqualhas transitive equivalence for circular references - Fixed argument order of
fp/zipObjectDeep - Simplified resolving the global object
- Stopped unconditional global exports in the browser
- Made per method packages zero-dependency modules
- Made wrapped function
toStringresults more debuggable - Made “flatten” methods honor
Symbol.isConcatSpreadable - Made
_.isEqualtreat invalid dates as equivalent - Made
LARGE_ARRAY_SIZEcheck instackSetalign with others - Optimized adding values to stacks by not inspecting all key-value pairs
- Optimized “isType” methods to use faster Node.js C++ helpers when available
- Optimized
_.endsWith,_.negate, &_.startsWith
- Ensured
_.find&_.findLastprovide the correctkeyparam when iterating objects
- Added _.stubArray, _.stubFalse, _.stubObject, _.stubString, & _.stubTrue
- Added
fromIndexparam to_.find,_.findIndex,_.findLast, &_.findLastIndex - Ensured empty brackets & dots in paths are treated as empty property names
- Ensured
_.pullAllworks with the same value forarray&values - Ensured
_.roundworks with largeprecisionvalues - Ensured
_.throttleworks with a system time of0 - Made
_.isNativethrow ifcore-jsis detected - Simplified UMD exports
- Added
fp/findFrom,fp/findIndexFrom,fp/findLastFrom,fp/findLastIndexFrom,fp/indexOfFrom, &fp/lastIndexOfFrom - Fixed argument order of
fp/differenceBy,fp/differenceWith,fp/intersectionBy,fp/intersectionWith,fp/without,fp/unionBy,fp/unionWith,fp/xorBy, &fp/xorWith
- Added _.toFinite
- Added iteratee arity hints to “forEach” methods
- Added support for maps & sets to
_.toPairs&_.toPairsIn - Ensured
_.mergedoesn’t skip trailing function sources - Ensured
fp/forEach,fp/forIn, &fp/forOwncap their iteratee arguments - Ensured
fp/updatedoes not convert end ofpathto an object - Ensured matches methods match arrays with duplicate values
- Optimized “flatten” methods
- Simplified
_.concat - Updated cache implementations
- Ensured
_.pullAtcorrectly sorts indexes greater than9 - Ensured
_.wordsdoesn’t treat punctuation as words - Ensured
-0works as path arguments - Ensured set methods like
_.uniq&_.xorconvert-0to0
- Added
fp/pluckas an alias offp/map - Ensured
_.debouncedefers invokingfuncwhenleadingisfalse&waitis0
- Added _.nth
- Added
_.matchesPropertyshorthand support to_.sortBy - Added support for contractions to case methods &
_.words - Avoided unnecessary array cloning in
createRecurryWrapper&mergeData - Ensured
fp/overdoesn’t cap its iteratee arguments - Made
_.headavoid accessingarraywhen its length is0
- Added
isIterateeCallcheck to_.split - Added
fp/paths&fp/propsas aliases offp/at - Added
fp/propEqas an alias offp/matchesProperty - Ensured
_.debouncequeues a trailing call for subsequent debounced calls aftermaxWait - Ensured
_.splithandles alimitof0correctly in Node.js v0.10 - Optimized handling of emojis in string methods
- Removed
fp/mapObj&fp/propOfaliases
- Added back
_.matchesPropertyshorthand support to “over” methods - Ensured
_.splitworks with emojis - Fixed malformed
fp/toString&fp/valueOfmodules
- Reverted
_.matchesPropertyshorthand support for “over” methods
- Fixed typo in
fp/_falseOptions
- Added
fp/placeholdermodule &fp/__alias - Added
convertto unconverted “fp” methods - Added
_.matchesPropertyshorthand support to “over” methods - Avoided errors in older Firefoxes when coercing
Promiseto a string - Ensured
_.hasreturnsfalsefor nested nullish object values - Ensured
_.hastreats nested sparse arrays consistently - Fixed argument order of
fp/overArgs - Made
_.chunk,_.repeat, &_.sampleSizedefaultnto1instead of0 - Optimized
_.matchesPropertyshorthand
- Added _.divide, _.flatMapDeep, _.flatMapDepth, _.meanBy, & _.multiply
- Added fp/convert,
fp/invokeArgs,fp/invokeArgsMap,fp/padChars,fp/padCharsEnd,fp/padCharsStart,fp/restFrom, &fp/spreadFrom - Added
_.entriesas an alias of_.toPairs - Added
_.entriesInas an alias of_.toPairsIn - Added several “fp” aliases
- Added support for buffers to
_.isEmpty - Added support for maps & sets to
_.isEmpty&_.size - Added support for deep cloning data views, maps, & sets
- Added symbol support to
_.omit,_.toNumber, &_.toPath - Avoided a JIT bug in Safari 9 for
baseIteratee - Ensured array sequence methods don’t error for falsey values
- Ensured
_.concatcasts non-arrayarrayvalues to arrays - Ensured
_.hasreturnsfalsefor nested inherited properties - Ensured
_.isEqualcompares promises by reference - Ensured
_.isPlainObjectreturnsfalsefor objects with a custom[[Prototype]] - Ensured
_.mergeWithsources are cloned whencustomizerreturnsundefined - Ensured
_.startCaseonly uppercases the first character of each word - Ensured
_.wordsdetects words where an all caps word is next to a capitalized word - Fixed argument order of
fp/bind,fp/bindKey, &fp/isEqualWith - Fixed aliases
fp/all,fp/any, &fp/anyPass - Made
_.resultresolve values of functions as it deep crawls over them - Memoized
stringToPath - Optimized
_.pad,_.padEnd,_.padStart, &_.toNumber - Refactored
_.debounceto simplify, reduce timers, & fix bugs
- Optimized
baseCloneto avoid cloning symbols for internal use
- Added _.pullAllWith, _.update, & _.updateWith
- Added
core.min.js&lodash.min.jsto the “fp” module ignored list - Ensured
_.defaultsDeepdoes not overwrite regexp values - Ensured
_.isEqualworks with maps & sets with circular references - Ensured “fp” uses
lodashas the default placeholder - Ensured
stackis popped after a recursive merge so that it doesn’t affect sibling properties - Fixed order of arguments in “fp” docs
- Optimized
baseIsEqualDeepby removing a typed array check & unnecessary stack creation - Optimized
_.assign,_.assignIn, &_.intersection - Optimized
_.mergeto avoid deep cloning sources if acustomizeris provided - Removed dead code from
getNative - Replaced
Symbolchecks withSymbolmethods checks
- Added
core.min.js&lodash.min.jsto the npm package - Ensured placeholders persist through more than one curried call
- Ensured
assignValueassigns values if they aren’t the same own value - Ensured “fp” methods avoid unnecessary cloning
- Ensured
fp/omitBy&fp/pickByprovidevalue&keyparams to iteratees - Fixed arity of
fp/orderBy - Used
getPrototypeOfto set inheritance whenconstructoris a function
- Enabled support for cloning expando properties of boolean, number, & string objects
- Ensured
fp/convertwrappers support iteratee shorthands
- Added _.castArray & _.flattenDepth
- Fixed argument order of
fp/inRange&fp/zipWith - Enabled
fp/convertto auto wraplodashin the browser - Enabled
fp/convertto work when givenlodashwithoptions - Ensured
fp/convertoptions works when applied individually - Ensured
fp/convertworks with category modules - Ensured
_.isErrorworks with subclassed values - Ensured
_.mergedeep clones array, typed-array, & plain-object sources - Ensured a debounced
maxWaittimeout isn’t processed on a leading call whenleadingisfalse& there isn’t a max delay queued
- Added _.isArrayBuffer, _.isBuffer, _.isMap, _.isSet, _.isWeakMap, & _.isWeakSet
- Added options param to
fp/convert - Ensured default placeholder values are set for relevant method modules
- Ensured
_.add&_.subtractreturn0when no arguments are given - Ensured
fp/gt,fp/gte,fp/lt, &fp/ltedon’t havereargapplied - Improved accuracy of
_.debounce&_.throttle
- Added remap of
fp/trimasfp/trimCharsforcharsparam support - Ensured wrapped
_.bind,_.curry, &_.partialsupport placeholders - Ensured
fp/_baseConvertuses_.spreadfor_.partialwrapper - Ensured
fp/add&fp/subtractdon’t havereargapplied
- Added
fp/assoc&fp/assocPathas aliases offp/set - Added
fp/dissoc&fp/dissocPathas aliases offp/unset - Added
startparam to_.spread - Ensured
_.attemptpreserves custom errors - Ensured
fp/partial&fp/partialRightaccept anargsparam - Ensured
fp/unsetis immutable - Ensured
_.iterateeclones sources for_.matchesPropertyshorthand - Made
_.flatMapa “Collection” method - Removed
globalreferences from the npm package
- Added _.invertBy & _.zipObjectDeep
- Added cherry pickable “fp” method modules to the npm package
- Ensured
fp/convertworks with aliases - Ensured
_.clone&_.cloneDeepwork on prototype objects - Ensured
_.mergeWithoverwrites primitives with source object clones - Ensured
_.sum&_.sumByreturn0for empty arrays - Optimized
_.isEmptyfor objects - Fixed argument order of
fp/assign,fp/defaults, &fp/merge
- Added
_.matchesto the core build - Added placeholder support to “fp” methods
- Added support for keycap emojis
- Ensured
_.concatreturns an empty array for nullish values - Ensured
_.each&_.eachRightaliases have the correct chain behavior - Ensured
_.defaultsDeepdoesn’t convert function properties to objects - Ensured
_.fromPairscan consume results of_.toPairs - Ensured
_.isEqualcompares objects unordered - Ensured
_.noConflictrestores_only iflodashis the current value - Ensured
_.wordscaptures all-caps words - Ensured
_.wordstreats all-lower & all-upper postfixes as separate words - Fixed “fp” mapping of several methods
- Made
_.omitBy&_.pickByprovide akeyparam to iteratees
-
Removed Bower & Component package support in favor of npm
-
Dropped IE 6-8 support
- Made
_#times,_#forEach,_#forIn,_#forOwn, & their right-forms implicitly end chain sequences
var 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- Removed category names from module paths
// in 3.10.1
var chunk = require('lodash/array/chunk');
// in 4.0.0
var chunk = require('lodash/chunk');- Removed
_.pluckin favor of_.mapwith iteratee shorthand
var 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]- Removed
thisArgparams from most methods because they were largely unused, complicated implementations, & can be tackled with_.bind,Function#bind, or arrow functions
var 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 }- Method removals
- Removed
_.support - Removed
_.findWherein favor of_.findwith iteratee shorthand - Removed
_.wherein favor of_.filterwith iteratee shorthand - Removed
_.pluckin favor of_.mapwith iteratee shorthand
- Removed
- Method renames
- Renamed
_.firstto_.head - Renamed
_.indexByto_.keyBy - Renamed
_.invoketo_.invokeMap - Renamed
_.modArgsto_.overArgs - Renamed
_.padLeft&_.padRightto_.padStart&_.padEnd - Renamed
_.pairsto_.toPairs - Renamed
_.restto_.tail - Renamed
_.restParamto_.rest - Renamed
_.sortByOrderto_.orderBy - Renamed
_.trimLeft&_.trimRightto_.trimStart&_.trimEnd - Renamed
_.truncto_.truncate
- Renamed
- Split out methods
- Split
_.assign&_.assignIninto_.assignWith&_.assignInWith - Split
_.clone&_.cloneDeepinto_.cloneWith&_.cloneDeepWith - Split
_.indexOf&_.lastIndexOfinto_.sortedIndexOf&_.sortedLastIndexOf - Split
_.invertinto_.invertBy(see v4.1.0) - Split
_.isEqualinto_.isEqualWith - Split
_.isMatchinto_.isMatchWith - Split
_.max&_.mininto_.maxBy&_.minBy - Split
_.mergeinto_.mergeWith - Split
_.omit&_.pickinto_.omitBy&_.pickBy - Split
_.sampleinto_.sampleSize - Split
_.sortedIndexinto_.sortedIndexBy - Split
_.sortedLastIndexinto_.sortedLastIndexBy - Split
_.suminto_.sumBy - Split
_.uniqinto_.sortedUniq,_.sortedUniqBy, &_.uniqBy - Split
_.zipObjectinto_.fromPairs
- Split
- Absorbed
_.sortByAllinto_.sortBy - Changed the category of
_.atto “Object” - Changed the category of
_.bindAllto “Util” - Changed
_.matchesPropertyshorthand to an array of[path, srcValue] - Enabled
_.mergeto assignundefinedif the destination property doesn’t exist - Made “By” methods like
_.groupBy&_.sortByprovide a single param to iteratees - Made
_.add,_.max,_.min, &_.sumno longer coerce values to numbers - Made
_.capitalizeuppercase the first character & lowercase the rest (see _.upperFirst) - Made
_.eqits own method instead of an alias for_.isEqual - Made
_.functionsreturn only own method names - Made
_.max&_.minreturnundefinedwhen passed an empty array - Made
_.wordschainable by default - Moved
./lodash.jsto./dist/lodash.jsin themasterbranch - Moved
./index.jsto./lodash.jsin thenpmbranch - Removed
isDeepparams from_.clone&_.flatten - Removed
multiValueparam from_.invert - Removed support for binding all methods by default from
_.bindAll - Removed
func-first param signature from_.before&_.after
- Dropped boolean
optionsparam support in_.debounce,_.mixin, &_.throttle - Dropped support for boolean
ordersparam in_.orderBy - Made
_.escapeRegExpalign to the defunct ES7 proposal - Made
_.max,_.min, &_.sumsupport arrays only - Removed legacy
optionsparam signature from_.template
-
Core build
- 4 kB (gzipped) core build (64 methods; Backbone ≥ v1.3.0 compatible)
_.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 - Reduced functionality:
- Cloning only supports arrays &
Objectobjects - Iteratee shorthand for
_.matchesPropertyis removed - Lazy evaluation is removed
- Placeholder support is removed
- Support for deep property paths is removed
- Support for maps, sets, & typed arrays is removed
- Cloning only supports arrays &
- 4 kB (gzipped) core build (64 methods; Backbone ≥ v1.3.0 compatible)
-
Added 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
- Added
_.extendas an alias of_.assignIn - Added
_.extendWithas an alias of_.assignInWith - Added
_.firstas an alias of_.head
- Added
-
Removed 17 aliases
- Removed
_.allin favor of_.every - Removed
_.anyin favor of_.some - Removed
_.backflowin favor of_.flowRight - Removed
_.callbackin favor of_.iteratee - Removed
_.collectin favor of_.map - Removed
_.composein favor of_.flowRight - Removed
_.containsin favor of_.includes - Removed
_.detectin favor of_.find - Removed
_.foldlin favor of_.reduce - Removed
_.foldrin favor of_.reduceRight - Removed
_.includein favor of_.includes - Removed
_.injectin favor of_.reduce - Removed
_.methodsin favor of_.functions - Removed
_.objectin favor of_.fromPairsor_.zipObject - Removed
_#runin favor of_#value - Removed
_.selectin favor of_.filter - Removed
_.uniquein favor of_.uniqinstead
- Removed
-
Performance improvements
- Enabled shortcut fusion for
_.at,_.find&_.findLast - Optimized match methods to avoid deep crawling if
object&sourceidentical - Optimized circular reference searches
- Optimized
_.isEqualto avoid stack crawls when arrays or objects are different sizes
- Enabled shortcut fusion for
-
Emoji support
- Added support for astral symbols, combining diacritical marks, dingbats, regional indicator symbols, unicode modifiers, variation selectors, & zero-width-joiners to string methods
-
Functional goodies
- Added _.cond, _.conforms, _.flip, _.nthArg, _.over, _.overEvery, _.overSome, & _.unary
- Moved
lodash-fpintolodashasrequire('lodash/fp')for immutable auto-curried iteratee-first data-last methods
- Added
clearmethod to_.memoize.Cache - Added
flushmethod to debounced & throttled functions - Added support for maps, sets, & symbols to
_.clone,_.isEqual, &_.toArray - Added support for array buffers to
_.isEqual - Added support for converting iterators to
_.toArray - Added support for deep paths to
_.zipObject - Changed UMD to export to
windoworselfwhen available regardless of other exports - Enabled
_.flow&_.flowRightto accept an array of functions - Ensured “Collection” methods treat functions as objects
- Ensured debounce
cancelclearsargs&thisArgreferences - Ensured
_.add&_.sumdon’t skipNaNvalues - Ensured
_.assign,_.defaults, &_.mergecoerceobjectvalues to objects - Ensured
_.bindKeybound functions callobject[key]when called with thenewoperator - Ensured
_.clonetreats generators like functions - Ensured
_.cloneproduces clones with the source’s[[Prototype]] - Ensured
_.defaultsassigns properties that shadowObject.prototype - Ensured
_.defaultsDeepdoesn’t merge a string into an array - Ensured
_.defaultsDeep&_.mergedon’t modify sources - Ensured
_.defaultsDeepworks with circular references - Ensured
_.isFunctionreturnstruefor generator functions - Ensured
_.keysskips “length” on strict modeargumentsobjects in Safari 9 - Ensured
_.mergeassigns typed arrays directly - Ensured
_.mergedoesn’t convert strings to arrays - Ensured
_.mergemerges plain-objects onto non plain-objects - Ensured
_#plantresets iterator data of cloned sequences - Ensured
_.randomswapsmin&maxifminis greater thanmax - Ensured
_.rangepreserves the sign ofstartof-0 - Ensured
_.reduce&_.reduceRightusegetIterateein their array branch - Fixed rounding issue with the
precisionparam of_.floor - Made
_(...)an iterator & iterable - Made
_.drop,_.take, & right forms coercenofundefinedto0
- Ensured
funcis a function before callinggetData - Ensured
_.cloneprovides the correct number of arguments tocustomizer - Ensured
_#reversedoesn’t modify the original array when called after_#slice
- Added
_.ceil,_.defaultsDeep,_.floor,_.modArgs, &_.round - Ensured
_.bindworks with all built-in constructors - Ensured
_#concattreats sparse arrays as dense - Ensured
_.chunkfloorssizevalues - Ensured
_.debounce&_.throttleresetlastCallafter cancelling - Ensure
_.flow&_.flowRightwork with functions combined with_.first - Ensured
_.indexOfreturns-1for unmatched binary searches - Ensured
_.noConflictoperates onroot& notcontext - Made
_.escapeRegExpmore robust - Made
_.sortByOrdersupport orders of “asc” & “desc” - Optimized
_.flatten,_.max, &_.min - Removed fallbacks for
_.isArguments,_.isFunction, &_.isPlainObject - Simplified lazy evaluation support
- Simplified
_.isElement,_.isFinite,_.isNative,_.now,_.parseInt, &_.sum
- Made
parseFloatassigned from thecontextparam of_.runInContext - Ensured
_.sethandles non-index property names that start with numbers correctly
- Made
isLaziablework with wrapped lodash methods - Optimized an early exit case in
_.isEqual - Optimized
_.sample
- Added
_.gt,_.gte,_.lt, &_.lte - Added support for an
ImmutableMapto_.memoize.Cache - Avoided using
requirein source comments to improve browserify build times - Ensured
baseCreateworks in ExtendScript - Ensured
customizerresults are respected by_.isEqual - Ensured
LodashWrapper.prototype.thruexists before creating a wrapper inflow - Ensured
_.bindworks with ES2015 class constructors - Ensured
_.getcan returnnullvalues - Ensured
_.intersectionworks with a single array - Ensured
_.hastreats sparse arrays as dense - Ensured
_.mergeskipsundefinedarray values if a destination value exists - Made
nullsort behindundefined&NaN - Made
_.eqan alias of_.isEqual - Optimized object comparisons in
_.isEqual - Optimized
_.max&_.minwhen invoked with iteratees - Optimized
_.pullAt&_.remove - Used
hasOwnPropertyfor the creation ofreIsNativeto avoid issues with core-js
- Added
_.mapKeys,_.unzipWith, &_.zipWith - Made
_.difference,_.intersection,_.uniq, &_.xoraccept array-like values - Ensured empty brackets are ignored by
_.get&_.set - Ensured
baseAt,basePullAt, &pullAthandle nullish values - Ensured
baseGetonly returnsundefinedfor incomplete paths - Ensured
_.padLeft&_.padRighthandle empty strings correctly - Made
_.isEqualtreat-0&0as equivalent - Narrowed bitmask checks in
_.flow&_.flowRight - Optimized lazy
sliceforstartof0 - Optimized “flatten” methods
- Restricted
Object.assignuse to strict mode only
- Added
_.get,_.method,_.methodOf, &_.set - Avoided a JIT bug in Safari on at least iOS 8.1-8.3 ARM64
- Ensured
_.intersectionof a single array returns an empty array - Ensured
_.removemutatesarrayafter thepredicatepass - Ensured methods like
_.has&_.getcan access index values of strings - Made
createAssigner&_.sortByAlluse_.restParam - Made
_.addcoerceaugend&addendparams to numbers - Made
_.assignuse built-inObject.assignwhen available - Made
_.inRangeswapstart&endparams whenstartis greater thanend - Added deep path support to methods like
_.has,_.get,_.callback,_.invoke,_.matchesProperty,_.method,_.methodOf,_.property,_.propertyOf,_.result, &_.set
- Added
_.restParam - Added
isIterateeCallguards to_.every,_.includes, &_.some - Added support for
iteratee&thisArgparams to_.sum - Added support for shortcut fusion optimizations to
_.flow&_.flowRight - Ensured lodash bundled by r.js runs in a web worker
- Ensured
_.deburrremoves combining diacritical marks - Ensured
_.differenceis based on the values of the first param only - Expanded metadata optimizations to more combinations of curried functions
- Made
_.matcheswork with non-plain objects & match inherited properties - Optimized
_.findLast,_.reduce, &_.reduceRight - Reduced code duplication with internal method creator functions
- Added string
replace&splitchaining methods - Ensured lazy
dropworks when applied afterfilter - Optimized curried method performance
- Added
_.add,_.sortByOrder, &_.sum - Adjusted
rootto work when bundled by webpack & running in a web worker - Ensured lazy chaining works with combinations of
drop&dropWhile - Ensured
_.defaultsworks as an iteratee for_.reduce - Reduced side effects of shortcut fusion
- Optimized
baseFlatten,baseIndexOf,indexOfNaN,_.flow, &_.flowRight - Optimized lazy evaluation for iteratees with one param
- Ensured lazy
takeWhileworks with lazyreverse&last - Ensured
waitdefaults to0for_.debounce&_.throttle - Ensured
isIterateeCalldoesn’t error ifindexis missing atoStringmethod - Optimized
_.difference,_.intersection, &_.uniqin Firefox
- Added
_.inRange - Added links to each method’s npm package to the documentation
- Enabled
_.cloneto work with more truthyisDeepvalues - Ensured each lodash wrapper module sets up their inheritance
- Ensured
isIterateeCallworks withNaNvalues - Ensured
_.mergeavoids iterating stringobjectorsourceparams - Optimized
_.attempt - Reduced nested dependencies of
_.template
- Added
_.fill,_.matchesProperty, &_.spread - Added
_#commit&_#plant - Added support for lazy
_.compact&_.toArray - Enabled
_.attemptto provide additional arguments tofunc - Ensured
_.flowreturns an identity function when called without arguments - Ensured
_#reversetracks__chain__values - Ensured lazy
_.slicehandles floating-pointstart&endparams - Fixed lazy
_.slicewhen used after_.filter - Made
_#runan alias of_#value
- Added
_.startCase - Ensured
isIterateeCallworks correctly with objects
- Ensured
_.slicecoerces floating-pointstart&endparams to integers - Fixed lazy
initial,rest, &reverse - Fixed
_.mergeregression with DOM elements
- Made chaining lazy, that is, execution is deferred until
_#valueis implicitly or explicitly called
var 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- Ensured each segment of a chain sequence may be repeatly applied
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]- Made
_.flattenshallow by default & removecallbacksupport
var 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]- Removed the
dataparameter 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'- Split
_.first&_.lastinto_.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]- Split
_.initial&_.restinto_.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]- Aligned
_.isFinite&_.keyswith ES2015 - Changed the category of
_.clone&_.cloneDeep, & “isType” methods from “Object” to “Lang” - Changed the category of
_.escape,_.template, &_.unescapefrom “Util” to “String” - Changed the category of
_.rangefrom “Array” to “Util” - Changed the category of
_.toArrayfrom “Collection” to “Lang” - Made method categories singular
- Made “Object” methods coerce primitives to objects
- Made
_.clone&_.cloneDeepreturn a new object for unsupported types - Made
_.findWhereits own method instead of an alias for_.find - Made
_.max&_.minnon-chainable by default - Made
_.memoizecaches have theMapinterface ofdelete,get,has, &set - Made
_.unzipits own method instead of an alias for_.zip - Moved
./dist/lodash.jsto./lodash.jsin themasterbranch - Moved
./dist/lodash.jsto./lodash.jsin thenpmbranch - Moved
./dist/lodash.compat.jsto thelodash/lodash-compatrepository - Moved support for sorting by multiple properties from
_.sortByto_.sortByAll - Removed result sorting from
_.functions - Removed the
underscorebuild - Renamed
_.createCallbackto_.callback - Renamed
_.support.argsClassto_.support.argsTag - Renamed
_.support.nodeClassto_.support.nodeTag - Restricted
_.mixinto iterating only own properties ofsourceobjects - Expanded the number of arguments provided to
customizercallbacks of_.assign,
_.clone,_.cloneDeep,_.isEqual, &_.merge
- Added customizable argument placeholder support to
_.bind,_.bindKey,_.curry,_.curryRight,_.partial, &_.partialRight - Added support for matching
NaNto_.difference,_.includes,_.indexOf,_.intersection,_.lastIndexOf,_.union,_.uniq, &_.xor - Ensured
_.assign&_.mergedon’t assigncustomizerresults if it’s unchanged - Ensured
_.mixindoesn’t extend lodash when given an emptyoptionsobject - Ensured
_.sortedIndexreturns values that align with the sort order of_.sortBy - Ensured functions of
_.matchesreturntruewhen comparing empty sources - Ensured functions of
_.matchesperform own property checks on objects - Made
_.chainuse an existing wrapper if available instead of creating a new wrapper - Removed the
argCountparameter from_.callback
- Added 47 methods
-
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
- Added 5 aliases
- Added
_.backflow&_.composeas aliases of_.flowRight - Added
_.containsas an alias of_.includes - Added
_.iterateeas an alias of_.callback - Added
_#toJSONas an alias of_#valueOf
- Performance improvements
- Improved overall performance 20-40%
- Method chaining supports lazy evaluation
- Methods with support for shortcut fusion:
_.drop,_.dropRight,_.dropRightWhile,_.dropWhile,_.filter,_.first,_.initial,_.last,_.map,_.pluck,_.reject,_.rest,_.reverse,_.slice,_.take,_.takeRight,_.takeRightWhile,_.takeWhile, &_.where - Other optimized methods:
_.bind,_.clone,_.cloneDeep,_.compact,_.compose,_.contains,_.difference,_.escape,_.flatten,_.invoke,_.isEqual,_.isObject,_.matches,_.max,_.min,_.partial,_.shuffle,_.unescape,_.uniq,_.without, &_.zip
- Functional goodies
- Added
_.ary,_.curryRight,_.flow, &_.rearg - Added placeholder support to
_.bind,_.bindKey,_.curry,_.curryRight,_.partial, &_.partialRight - Methods that work as an iteratee for
_.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 - Methods that work as an iteratee for
_.reduce, & the like, out of the box:
_.assign,_.defaults,_.merge, &_.sortAllBy
- Added cherry pickable method modules to the npm package
- Added
cancelmethod to debounced & throttled functions - Added
defaultValueparam to_.result - Added
multiValueparam to_.invert - Added
thisArgparam to_.tap - Added
_.memoize.Cacheto enableMap/WeakMapto be used - Added support for cloning array buffers & typed arrays to
_.clone&_.cloneDeep - Added support for comparing error objects & typed arrays to
_.isEqual - Enabled the
sourceURLoption of_.templateto work in production builds - Ensured
_.at,_.matches, &_.pullAtwork with falsey values when keys are given - Ensured
_.callbackdoesn’t error whenfuncis nullish &thisArgis given - Ensured
_.callbacksupports binding built-in methods - Ensured
_.debounce&_.throttlework if the system time is set backwards - Ensured
_.differenceworks with arrays regardless of argument position - Ensured
_.findWhere&_.wherealways use_.matches - Ensured
_.includessupportsfromIndexwhen iterating objects - Ensured
_.indexOf([], undefined, true)returns-1instead of0 - Ensured
_.intersectionignores non-array secondary values - Ensured
_.isEqualworks with wrapped objects containingconstructorproperties - Ensured
_.keystreats sparse arrays as dense - Ensured
_.keysworks with string objects in IE < 9 - Ensured
_.matchescomparison isn’t affected by changes tosourceobjects - Ensured
_.max&_.minreturn the correct value whencallbackcomputes ±Infinity - Ensured
_.mergeignoresundefinedvalues ofsourceobject properties - Ensured
_.partial&_.partialRightwork with curried functions - Ensured
_.pluckalways uses_.property - Ensured
_.randomreturns1or0when called with no arguments - Ensured
_.range,_.slice, & other methods handleNaNarguments - Ensured
_.runInContextuses a zeroed_.uniqueIdcounter - Ensured
_.transformchecks thatobjectis an object before using its[[Prototype]] - Ensured
_.wherehandlessourceobjects withundefinedproperty values - Ensured
_.whereonly returns elements that contain all source array/object values - Ensured browserified lodash works in web workers
- Ensured customizing
_.indexOfaffects_.includeswhen iterating objects - Ensured lodash works in
NW.js - Ensured lodash doesn’t add
Function.prototypeextensions to its prototype - Fixed
_.isFunctionfor typed array constructors in Safari 8 - Made
_.escape&_.unescapehandle backticks - Made
_.isElementmore robust - Made
_.parseIntmore closely follow spec - Made
_.wrapuse_.identitywhenwrapperis nullish - Made templates avoid referencing
_.escapeif “escape” delimiters are not used - Made array-like object checks follow ES2015
ToLength - Made use of
Setin_.difference,_.intersection, &_.uniq - Removed array & object pools
- Removed all method compilation from the
compatbuild - Updated the sourceURL syntax used by
_.template
- Avoided memory leaks in
_.bind,_.bindKey,_.curry,_.partial, &_.partialRight
- Ensured
__bindData__is properly cloned - Ensured
_.isEqualcan compare cyclical objects with shared property values - Optimized
_.partial&_.partialRight - Reached ~100% code coverage
- Added
_.constant,_.mapValues,_.now,_.property, &_.xor - Added an
optionsparam to_.mixinto specify whether functions added are chainable - Added support for
_.sortByto accept an array of property names to sort by - Enabled
_.zipObjectto accept an array ofkeyswith novaluesparam - Removed conditional
setImmediateuse from_.defer
- Added
_.create&_.noop - Avoided memory leaks in
_.debounce&_.throttle - Enhanced
_.createCallbackto avoid binding functions bound byFunction#bind - Ensured rebound functions correctly partially apply arguments
- Ensured
_.isEqualworks with values fromObject.create(null)&_(false) - Ensured
_.min&_.maxwork as callbacks for_.map - Ensured
_.templatecoerces thetextparam to a string - Optimized
_.difference,_.omit, &_.withoutby way ofbaseDifference - Optimized
_.isBoolean,_.isNumber, &_.isStringfor thefalsecase - Optimized
_.sample&_.shuffleby way ofbaseRandom - Reduced
_.wrapby way ofcreateBound - Removed native
Function#binduse for better cross-environment consistency
- Ensured
_.mixincreates functions that work with_.chain - Ensured the the
createObjectfallback is included in themodernbuild
- Added
_.clonesupport for date, regexp, & other built-in objects - Ensured
_.randomavoids excessive results of0for floating-point numbers - Made
compat&underscorebuilds useDate.nowwhen available - Reduced dependencies on
getObject&releaseObject
- Added
Object.definePropertyfallback for themodernbuild - Added support to
_.randomto explicitly specify floating point numbers - Enabled
_.composeto be invoked without arguments - Ensured
_.flattenworks with extremely large arrays - Ensured
_.supportproperties aren’t minified - Ensured
reThisisn’t used in Windows 8 applications - Made UMD more resistant to false positives
- Optimized
_.isArguments&_.isArrayfallbacks
- Aligned
_.afterwith Underscore 1.5.0, making it always return a function - Made
_.unzipan alias of_.zip
- Created lodash methods as npm packages & AMD/Node.js modules
- Made
_.chainforce chaining for all methods - Moved the build utility to
lodash-cli - Optimized
_.contains,_.debounce,_.isArguments,_.throttle, &_.where - Optimized functions of
_.bind,_.bindKey,_.curry,_.partial, &_.partialRight - Added
_.curry,_.forEachRight,_.indexBy,_.findLast,_.findLastIndex,_.findLastKey,_.forInRight,_.forOwnRight,_.pull,_.remove, &_.sample
- Added Curl & Dojo module loaders to the unit tests
- Added the
modularizebuild option - Added support for the
iifecommand to be used without an%output%token - Added support for
_.mixinto accept a destination object - Added support for
_.rangeto accept astepof0 - Ensured “Array” methods support
argumentsobjects - Ensured “Function” methods throw on non-functions
- Ensured
_.atworks as a callback for_.map - Ensured
_.createCallbackworks when noargCountis specified - Ensured
_.first&_.lastreturn arrays when given annwith a falseyarray - Ensured
_.flattenworks withargumentsobjects - Ensured minified files work with Dojo’s builder
- Ensured
_.zipObjectskips falsey elements - Improved dead code removal from builds
- Improved JSDoc syntax
- Made
_.eachRightan alias of_.forEachRight - Made
_.memoizeavoid prefixingcachekeys when using aresolverfunction - Removed local
clearTimeout&setTimeoutvariables from theunderscorebuild - Reduced the size of the repo & npm package
- Simplified the bailout in
createCache - Updated sourceURL & sourceMappingURL syntax
- Updated
underscorebuild compatibility to v1.5.2
- Added missing
cacheproperty to the objects returned bygetObject - Ensured
maxWaitunit tests pass in Ringo - Increased the
maxPoolSizevalue - Optimized
releaseArray&releaseObject
- Added
_.transform - Added
_.chain&_.findWherealiases - Added internal array & object pooling
- Added Istanbul test coverage reports to Travis CI
- Added
maxWaitoption to_.debounce - Added support for floating point numbers to
_.random - Added Volo configuration to package.json
- Adjusted UMD for
component build - Enabled more stable mixing of
lodash&underscorebuild methods - Ensured debounced function with
leading&trailingoptions works as expected - Ensured minified builds work with the Dojo builder
- Ensured minification avoids deoptimizing expressions containing boolean values
- Ensured support for
--outputpaths containing build command keywords - Ensured unknown types return
falsein_.isObject&_.isRegExp - Ensured
_.clone,_.flatten, &_.uniqcan be used as callback for_.map - Ensured
_.forInworks on objects with longer inheritance chains in IE < 9 - Ensured
_.isPlainObjectreturnstruefor empty objects in IE < 9 - Ensured
_.max&_.minchain correctly - Ensured
clearTimeoutuse doesn’t cause errors in Titanium - Ensured that the
--stdoutbuild option doesn’t write to a file - Exposed memoized function’s
cache - Fixed
Error.prototypeiteration bugs - Fixed “scripts” paths in component.json
- Made methods support customizing
_.indexOf - Made the build track dependencies of private functions
- Made the
templatepre-compiler build option avoid escaping non-ascii characters - Made
_.createCallbackavoid binding functions if they don’t referencethis - Optimized the Closure Compiler minification process
- Optimized the large array cache for
_.difference,_.intersection, &_.uniq - Optimized internal
_.flatten&_.indexOfuse - Reduced
_.unzip&_.zip - Removed special handling of arrays in
_.assign&_.defaults
- Added Component package support
- Updated the build utility to work with changes in GitHub’s API
- Ensured
_.isPlainObjectworks with objects created byObject.create(null) - Ensured “isType” methods return
falsefor subclassed values - Ensured debounced functions, with
leading&trailingcalls enabled, only perform trailing calls after they’re called more than once
- Added
_.unzip - Added an
optionsparam to_.debounce&_.throttle - Enabled non-
underscorebuilds to include_.findWhere&_.chain - Ensured “Array” & “Object” methods work with
argumentsobjects & arrays respectively - Ensured build utility runs on Windows
- Ensured
underscorebuild versions of “isType” methods align with Underscore - Ensured methods avoid issues with the
__proto__property - Ensured
_.isEqualuses acallbackonly if it’s a function - Ensured
_.mergeapplies acallbackto nested properties - Ensured
_.mergeprovides the correctcallbackarguments when comparing objects - Made lodash work with Browserify
- Removed all method compilation from the
modernbuild
- Ensured the
underscorebuild of_.forEachaccepts athisArgparam - Updated vendor/tar to work with Node.js v0.10
- Added
_.createCallback,_.findIndex,_.findKey,_.parseInt, &_.runInContext - Added
_.support - Added
callback&thisArgparams to_.flatten - Added
rhino -requiresupport - Added CommonJS/Node.js support to precompiled templates
- Ensured the
exportsobject is not a DOM element - Ensured
_.isPlainObjectreturnsfalsefor objects without a[[Class]]of “Object” - Made
callbacksupport in_.cloneDeepmore closely follow its documentation - Made
_.objectan alias of_.zipObject - Made the template precompiler create missing directories of
--outputpaths - Optimized method chaining, object iteration,
_.find, &_.pluck - Updated
backbonebuild method dependencies
- Ensured
_.isPlainObjectworks when built-inObject.getPrototypeOfis unavailable
- Added support for specifying source map URLs in
-p/--source-mapoptions - Ensured the second argument to
_.assignis not treated as acallback - Ensured
-p/--source-mapbuild options correctly set thesourceMappingURL - Made
-p/--source-mapset source map “sources” keys based on the build - Made
_.deferusesetImmediate, in Node.js, when available - Made
_.wheresearch arrays for values regardless of their index position - Removed dead code from
_.template
- Made
_.defaultspreservenullvalues, instead of overwriting them
- Added
_.at&_.partialRight - Added
modern&-p/--source-mapbuild options - Added “imports” option to
_.templateSettings - Added support for
_.pluck&_.wherecallback shorthands - Ensured
_.assign&_.defaultssupport arrays - Ensured
_.mergeassignsnullvalues & produces dense arrays - Deferred minifier downloads until the
lodashutility requires them - Flipped
noNodeClasstest to avoid Firebug’s “break on all errors” feature - Made
_.wheresupport deep object comparisons - Optimized
_.invert,_.pairs, &_.values - Reduced
_.max,_.min,_.pluck,_.toArray, &_.where - Removed support for automatic with-statement removal from
_.template - Simplified
createIterator&iteratorTemplate - Tweaked
_.uniqueIdto avoid problems with buggy minifiers - Updated
underscorebuild compatibility to v1.4.4 - Added
callback&thisArgparams to_.assign,_.clone,_.cloneDeep,_.first,_.last,_.initial,_.isEqual,_.merge, &_.rest
- Made
_#join,_#pop, &_#shiftwrapper methods return unwrapped values - Made “Function” methods wrapper counterparts return wrapped values
- Removed “chain” methods
- Added
_.cloneDeep - Added
_.onceto thebackbonebuild - Ensured
backbonebuilds implement Underscore’s chaining behavior - Ensured the
settings=…build option doesn’t clobber the defaultmoduleId - Ensured lodash’s npm package works when packages aren’t globally installed
- Made compiled templates exported for AMD use the lodash module for
_ - Removed the
_.forEachdependency from_.intersection - Optimized
_.isArray&_.isFunctionfallbacks as well as_.intersection,_.isDate,_.isRegExp,_.reduce,_.reduceRight,_.union, &_.uniq
- Specified more method chaining behaviors
- Updated
underscorebuild compatibility to v1.4.3
- Added support for
argumentsobjects to_.clone - Ensured
_.clonecreates plain object clones of non-plain objects - Made
_(…)chain automatically without needing to call_#chain - Made
_.isEqualequateargumentsobjects to similarObjectobjects
- Ensure lodash runs in the JS engine embedded in Adobe products
- Ensured
_.reduce&_.reduceRightprovide the correctcallbackarguments - Ensured
_.throttlenulls thetimeoutId - Made deep
_.clonemore closely follow the structured clone algorithm - Optimized compiled templates in Firefox
- Optimized
_.forEach,_.forOwn,_.isNumber, &_.isString - Simplified
iteratorTemplate
- Renamed
_.lateBindto_.bindKey - Made
_.defaults&_.extenditerate only own properties ofsourceobjects to align withObject.assign
- Added the build commands used to custom build copyright/license headers
- Added
_.assign - Ensured the
underscorebuild of_.findreturns the first match, not last - Ensured
_.defaults,_.extends, &_.mergework with_.reduce - Made lodash’s npm package installation work with more system configurations
- Made
_.extendan alias of_.assign - Optimized
_.contains,_.defaults,_.extend, &_.filter - Restricted
_.whereto iterate only own properties ofsourceobjects - Updated
backbonebuild lodash method dependencies
- Added
fromIndexparam to_.contains - Added
moduleIdbuild option - Added Closure Compiler “simple” optimizations to the build process
- Added support for strings in
_.max&_.min - Added support for ES2015 template delimiters to
_.template - Ensured re-minification of lodash by third parties avoids Closure Compiler bugs
- Optimized
_.every,_.find,_.some, &_.uniq
- Ensured
_.everyreturnsfalseas soon as thecallbackresult is falsey - Ensured
_.isFinitereturnsfalsefor non-numeric values - Removed
_.forEachchainability in theunderscorebuild - Simplified
_.union
- Added a
sourceURLoption to_.template - Ensured
_.wherereturns an empty array if given an emptypropertiesobject - Expanded
_.isFiniteto returntruefor numeric strings - Reduced
_.intersection,_.omit,_.pick,_.sortedIndex, &_.where - Reduced the npm package size by only downloading minifiers for global installs
- Reduced lodash’s file size
- Improved source code comprehension by removing compilation from
_.bindAll,_.contains,_.countBy,_.every,_.filter,_.find,_.functions,_.groupBy,_.invert,_.invoke,_.isEmpty,_.map,_.merge,_.omit,_.pairs,_.pick,_.pluck,_.reduce,_.reject,_.some,_.sortBy,_.values,_.where, & internalshimKeys
- Ensured
_.mapreturns an array when given a falsey collection - Ensured
_.throttleclears its timeout whenfuncis called - Made
_.max,_.min,_.shufflesupport iterating objects - Reduced
createIterator,_.clone,_.compact - Re-optimized
_.max,_.min, &_.sortedIndex
- Enabled deep clone support in the
underscorebuild whencloneis explicitly included - Reverted removal of first argument falsey checks from methods
- Made
_.randomreturn0or1when no arguments are given - Moved late bind functionality from
_.bindto_.lateBind - Removed first argument falsey checks from methods
- Removed support for custom
clone,isEqual,toArraymethods from_.clone,_.isEqual, &_.toArray
- Added
-d/--debug,-m/--minify,minus,plus,settings, &templatebuild options - Added
_.isPlainObject&_.lateBind - Enabled
_.sortedIndexto accept a property name as thecallbackparam - Ensured methods accept a
thisArgofnull - Fixed the
iifebuild option to accept more values - Made
_.timesreturn an array ofcallbackresults - Simplified
_.max,_.min, &_.reduceRight
- Renamed
_.zipObjectto_.object - Replaced
_.dropwith_.omit - Made
_.dropan alias of_.rest
- Added
_.invert,_.pairs, &_.random - Added
_.resultto thebackbonebuild - Added
exports,iife,-c/--stdout,-o/--output, &-s/--silentbuild options - Ensured
isPlainObjectworks with objects from other documents - Ensured
_.isEqualcompares values with circular references correctly - Ensured
_.mergework with four or more arguments - Ensured
_.sortByperforms a stable sort forundefinedvalues - Ensured
_.templateworks with “interpolate” delimiters containing ternary operators - Ensured the production build works in Node.js
- Ensured template delimiters are tokenized correctly
- Made pseudo private properties
_chain&_wrappeddouble-underscored to avoid conflicts - Made
minify.jssupportunderscore.js - Reduced the size of
mobile&underscorebuilds - Simplified
_.isEqual&_.size
- Ensured IE conditional compilation isn’t enabled by the
useSourceURLtest - Optimized
isPlainObject
- Added
callback&thisArgparams to_.drop&_.pick - Added
hasObjectSpliceBugtest to avoiddeleteoperator use - Added
_.unescape - Ensured
_.reduceworks with string objects in IE < 9 - Made
_.omitan alias of_.drop - Made compiled methods take advantage of engines with strict mode optimizations
- Optimized
_.intersection& removed its dependency on_.every - Reduced the file size of the
underscorebuild
- Ensured
_.isElementuses strict equality for its duck type check - Ensured
_.isObjectreturns a boolean value - Ensured
_.template& “Object” methods don’t error when given falsey values - Made
_.templategenerate less unused code in compiled templates
- Ensured
_.bindcorrectly appends array arguments to partially applied arguments in older browsers
- Added
_.countBy,_.drop,_.merge, &_.where - Added
csp(Content Security Policy) &underscorebuild options - Added deep cloning support to
_.clone - Added Jam package support
- Added support for exiting early in
_.forEach,_.forIn, &_.forOwn - Added support for jQuery/MooTools DOM query collections to
_.isEmpty&_.size - Ensured development build works with IE conditional compilation enabled
- Ensured
_.clonedoesn’t cloneargumentsobjects, DOM nodes, functions, or non-plain objects - Ensured
_.filter’scallbackcan’t modify result values - Ensured
_.isEmpty,_.isEquals, &_.sizesupportargumentsobjects - Ensured
_.isEqualdoesn’t inspect DOM nodes, works with objects from other documents, & calls customisEqualmethods before checking strict equality - Ensured
_.oncefrees the given function for garbage collection - Ensured
_.sortByperforms a stable sort - Ensured
reEvaluateDelimiteris used when_.templateSettings.evaluateisundefined - Made
_.rangecoerce arguments to numbers - Optimized
_.isFunction
- Added
strictbuild option - Ensured
_.bindAll,_.defaults, &_.extendavoid strict mode errors on read-only properties - Optimized the iteration of large arrays in
_.difference,_.intersection, &_.without - Fixed build bugs related to removing variables
- Fixed
_.templateregression - Optimized build process to detect & remove more unused variables
- Added
bin&scriptsentries to package.json - Added
legacybuild option - Added cross-browser support for strings to “Collection” methods
- Added
_.zipObject - Leveraged
_.indexOf’sfromIndexin_.difference&_.without - Optimized compiled templates
- Optimized inlining the
iteratorTemplatefor builds - Optimized object iteration for “Collection” methods
- Optimized partially applied
_.bindin V8 - Made compiled templates more debuggable
- Made
_.sizework with falsey values & consistent cross-browser withargumentsobjects - Moved
_.groupBy&_.sortByback to the “Collection” category - Removed
argumentsobject from_.range
- Ensured
_.escapereturns an empty string for nullish values - Ensured
sourceURLsupport doesn’t cause errors in Adobe’s JS engine - Fixed regression in generating custom builds
- Moved
_.invoke&_.pluckback to the “Collection” category - Moved
_.tapto the “Seq” category
- Added
backbonebuild option - Ensured “Array” methods allow falsey
arrayparams - Removed
_.isArgumentsfallback from themobilebuild - Simplified
_.pluck,_.values&_(...)method wrappers
- Added
_.forIn&_.forOwn - Added
categorybuild option - Added
fromIndexparam to_.indexOf&_.lastIndexOf - Added
//@ sourceURLsupport to_.template - Added
thisArgparam to_.sortedIndex&_.uniq - Ensured array-like objects with invalid
lengthproperties are treated like regular objects - Ensured
_.sortedIndexsupports arrays with highlengthvalues - Fixed
prototypeiteration bug in_.keys - Optimized
_.times&thisbindings in iterator methods
- Added
mobilebuild option - Ensured
_.findreturnsundefinedfor unmatched values - Ensured
_.templateSettings.variableis compatible with Underscore - Optimized
_.escape - Reduced dependencies of
_.find
- Adjusted the lodash export order for r.js
- Ensured
_.groupByvalues are added to own, not inherited, properties - Made
_.bindfollow ES5 spec to support a popular Backbone.js pattern - Removed the alias
_.intersect - Simplified
_.bind,_.flatten,_.groupBy,_.max, &_.min
- Added
_.partial - Added
thisArgparam to_.groupBy - Added “lazy bind” support to
_.bind - Added custom build options
- Added default
_.templateSettings.variablevalue - Added native method overwrite detection to avoid bad native shims
- Added support for more AMD build optimizers & aliasing as the “underscore” module
- Added whitespace to compiled strings
- Commented the
iterationFactoryoptions object - Ensured
_(...)returns given wrapper instances - Ensured
_.max&_.minsupport extremely large arrays - Ensured
_.throttleworks in tight loops - Fixed
clearTimeouttypo - Fixed
[DontEnum]bug in IE < 9 - Fixed
prototypeiteration bug in Firefox < 3.6, Opera < 11.60, & Safari < 5.1 - Inlined
_.isFunctioncalls - Made
_.debounce’ed functions match_.throttle’ed functions’ return value behavior - Made
_.escapeno longer translate the “>” character - Simplified all “Array” methods
- Optimized
_.debounce,_.escape,_.flatten,_.forEach,_.groupBy,_.intersection,_.invoke,_.isObject,_.max,_.min,_.pick,_.shuffle,_.sortedIndex,_.template,_.throttle,_.union,_.uniq
Apr. 23, 2012 — Docs
- Initial release
Maintained by the core team with help from our contributors.