Compatibility with Lodash â
â Starting with version 1.39.3, we ensure 100% compatibility with Lodash
es-toolkit/compat functions exactly like all Lodash functions while being lighter and faster.
- It ensures identical behavior with Lodash's actual test code.
- It has been adopted by popular open-source projects including Storybook, Recharts, and CKEditor, and is recommended by Nuxt.
For detailed documentation of all available compat functions, check out our Compat Reference.
// es-toolkit/compat aims to provide 100% feature parity with lodash
import { chunk } from 'es-toolkit/compat';
chunk([1, 2, 3, 4], 0);
// Returns [], which is identical to lodashFor maximum compatibility with lodash, use es-toolkit/compat, a compatibility layer that bridges the gap between the two libraries.
This module is designed to provide an identical API to lodash, making it easier to switch between the two libraries.
es-toolkit/compat has been thoroughly tested with real test cases from lodash.
It's important to note that es-toolkit/compat may have a slight performance impact and a larger bundle size compared to the original es-toolkit. This module is designed to facilitate a smooth transition and should be replaced with the original es-toolkit for optimal performance once the migration is complete.
Design Principles â
INFO
Design principles are subject to change.
Our compatibility layer aims to achieve feature parity with 100% accuracy for:
- Features that are written as a test case in lodash.
- Features that can be inferred from types of @types/lodashor@types/lodash-es.
- Feature differences identified while migrating code from lodash to es-toolkit (please report these to our issues page).
However, the following are out of scope for es-toolkit/compat:
- Implicit type conversions, such as converting an empty string to zero or false.
- Functions that have specialized implementations for specific types of arrays, like sortedUniq.
- Handling cases where internal object prototypes, like Array.prototype, have been modified.
- Managing cases with JavaScript realms.
- Method chaining support through "Seq" methods.
Implementation Status â
INFO
The following emojis indicate the status of each feature:
- â : Completed (The function is fully implemented and has passed all tests with lodash test code.)
- đ: In Review (The function is implemented but hasn't been tested with lodash test code yet.)
- â: Not Implemented (The function hasn't been implemented.)
Even if a feature is marked "in review," it might already be under review to ensure it matches lodash perfectly, and it could already offer the same functionality.
"Array" method
| Function Name | Implementation Status | 
|---|---|
| chunk | â | 
| compact | â | 
| concat | â | 
| difference | â | 
| differenceBy | â | 
| differenceWith | â | 
| drop | â | 
| dropRight | â | 
| dropRightWhile | â | 
| dropWhile | â | 
| fill | â | 
| findIndex | â | 
| findLastIndex | â | 
| flatten | â | 
| flattenDeep | â | 
| flattenDepth | â | 
| fromPairs | â | 
| head | â | 
| indexOf | â | 
| initial | â | 
| intersection | â | 
| intersectionBy | â | 
| intersectionWith | â | 
| join | â | 
| last | â | 
| lastIndexOf | â | 
| nth | â | 
| pull | â | 
| pullAll | â | 
| pullAllBy | â | 
| pullAllWith | â | 
| pullAt | â | 
| remove | â | 
| reverse | â | 
| slice | â | 
| sortedIndex | â | 
| sortedIndexBy | â | 
| sortedIndexOf | â | 
| sortedLastIndex | â | 
| sortedLastIndexBy | â | 
| sortedLastIndexOf | â | 
| sortedUniq | No support | 
| sortedUniqBy | No support | 
| tail | â | 
| take | â | 
| takeRight | â | 
| takeRightWhile | â | 
| takeWhile | â | 
| union | â | 
| unionBy | â | 
| unionWith | â | 
| uniq | â | 
| uniqBy | â | 
| uniqWith | â | 
| unzip | â | 
| unzipWith | â | 
| without | â | 
| xor | â | 
| xorBy | â | 
| xorWith | â | 
| zip | â | 
| zipObject | â | 
| zipObjectDeep | â | 
| zipWith | â | 
"Collection" method
| Function Name | Implementation Status | 
|---|---|
| countBy | â | 
| every | â | 
| filter | â | 
| find | â | 
| findLast | â | 
| flatMap | â | 
| flatMapDeep | â | 
| flatMapDepth | â | 
| forEach | â | 
| forEachRight | â | 
| groupBy | â | 
| includes | â | 
| invokeMap | â | 
| keyBy | â | 
| map | â | 
| orderBy | â | 
| partition | â | 
| reduce | â | 
| reduceRight | â | 
| reject | â | 
| sample | â | 
| sampleSize | â | 
| shuffle | â | 
| size | â | 
| some | â | 
| sortBy | â | 
"Date" method
| Function Name | Implementation Status | 
|---|---|
| now | â | 
"Function" method
| Function Name | Implementation Status | 
|---|---|
| after | â | 
| ary | â | 
| before | â | 
| bind | â | 
| bindKey | â | 
| curry | â | 
| curryRight | â | 
| debounce | â | 
| defer | â | 
| delay | â | 
| flip | â | 
| memoize | â | 
| negate | â | 
| once | â | 
| overArgs | â | 
| partial | â | 
| partialRight | â | 
| rearg | â | 
| rest | â | 
| spread | â | 
| throttle | â | 
| unary | â | 
| wrap | â | 
"Lang" method
| Function Name | Implementation Status | 
|---|---|
| castArray | â | 
| clone | â | 
| cloneDeep | â | 
| cloneDeepWith | â | 
| cloneWith | â | 
| conformsTo | â | 
| eq | â | 
| gt | â | 
| gte | â | 
| isArguments | â | 
| isArray | â | 
| isArrayBuffer | â | 
| isArrayLike | â | 
| isArrayLikeObject | â | 
| isBoolean | â | 
| isBuffer | â | 
| isDate | â | 
| isElement | â | 
| isEmpty | â | 
| isEqual | â | 
| isEqualWith | â | 
| isError | â | 
| isFinite | â | 
| isFunction | â | 
| isInteger | â | 
| isLength | â | 
| isMap | â | 
| isMatch | â | 
| isMatchWith | â | 
| isNaN | â | 
| isNative | â | 
| isNil | â | 
| isNull | â | 
| isNumber | â | 
| isObject | â | 
| isObjectLike | â | 
| isPlainObject | â | 
| isRegExp | â | 
| isSafeInteger | â | 
| isSet | â | 
| isString | â | 
| isSymbol | â | 
| isTypedArray | â | 
| isUndefined | â | 
| isWeakMap | â | 
| isWeakSet | â | 
| lt | â | 
| lte | â | 
| toArray | â | 
| toFinite | â | 
| toInteger | â | 
| toLength | â | 
| toNumber | â | 
| toPlainObject | â | 
| toSafeInteger | â | 
| toString | â | 
"Math" method
| Function Name | Implementation Status | 
|---|---|
| add | â | 
| ceil | â | 
| divide | â | 
| floor | â | 
| max | â | 
| maxBy | â | 
| mean | â | 
| meanBy | â | 
| min | â | 
| minBy | â | 
| multiply | â | 
| round | â | 
| subtract | â | 
| sum | â | 
| sumBy | â | 
"Number" method
| Function Name | Implementation Status | 
|---|---|
| clamp | â | 
| inRange | â | 
| random | â | 
"Object" method
| Function Name | Implementation Status | 
|---|---|
| assign | â | 
| assignIn | â | 
| assignInWith | â | 
| assignWith | â | 
| at | â | 
| create | â | 
| defaults | â | 
| defaultsDeep | â | 
| findKey | â | 
| findLastKey | â | 
| forIn | â | 
| forInRight | â | 
| forOwn | â | 
| forOwnRight | â | 
| functions | â | 
| functionsIn | â | 
| get | â | 
| has | â | 
| hasIn | â | 
| invert | â | 
| invertBy | â | 
| invoke | â | 
| keys | â | 
| keysIn | â | 
| mapKeys | â | 
| mapValues | â | 
| merge | â | 
| mergeWith | â | 
| omit | â | 
| omitBy | â | 
| pick | â | 
| pickBy | â | 
| result | â | 
| set | â | 
| setWith | â | 
| toPairs | â | 
| toPairsIn | â | 
| transform | â | 
| unset | â | 
| update | â | 
| updateWith | â | 
| values | â | 
| valuesIn | â | 
"String" method
| Function Name | Implementation Status | 
|---|---|
| camelCase | â | 
| capitalize | â | 
| deburr | â | 
| endsWith | â | 
| escape | â | 
| escapeRegExp | â | 
| kebabCase | â | 
| lowerCase | â | 
| lowerFirst | â | 
| pad | â | 
| padEnd | â | 
| padStart | â | 
| parseInt | â | 
| repeat | â | 
| replace | â | 
| snakeCase | â | 
| split | â | 
| startCase | â | 
| startsWith | â | 
| template | â | 
| toLower | â | 
| toUpper | â | 
| trim | â | 
| trimEnd | â | 
| trimStart | â | 
| truncate | â | 
| unescape | â | 
| upperCase | â | 
| upperFirst | â | 
| words | â | 
"Util" method
| Function Name | Implementation Status | 
|---|---|
| attempt | â | 
| bindAll | â | 
| cond | â | 
| conforms | â | 
| constant | â | 
| defaultTo | â | 
| flow | â | 
| flowRight | â | 
| identity | â | 
| iteratee | â | 
| matches | â | 
| matchesProperty | â | 
| method | â | 
| methodOf | â | 
| mixin | No support | 
| noConflict | No support | 
| noop | â | 
| nthArg | â | 
| over | â | 
| overEvery | â | 
| overSome | â | 
| property | â | 
| propertyOf | â | 
| range | â | 
| rangeRight | â | 
| runInContext | No support | 
| stubArray | â | 
| stubFalse | â | 
| stubObject | â | 
| stubString | â | 
| stubTrue | â | 
| times | â | 
| toPath | â | 
| uniqueId | â | 

