Skip to main content

Built and signed on GitHub Actions

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 days ago (1.13.1)

default

es-toolkit

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.

c
AbortError

An error class representing an aborted operation.

f
camelCase

Converts a string to camel case.

f
capitalize

Converts the first character of string to upper case and the remaining to lower case.

f
chunk

Splits an array into smaller arrays of a specified length.

f
clamp

Clamps a number within the inclusive lower and upper bounds.

f
clone

Creates a shallow clone of the given object.

f
compact

Removes falsey values (false, null, 0, '', undefined, NaN) from an array.

f
countBy

Count the occurrences of each item in an array based on a transformation function.

f
debounce

Creates a debounced function that delays invoking the provided function until after debounceMs milliseconds have elapsed since the last time the debounced function was invoked. The debounced function also has a cancel method to cancel any pending execution.

f
delay

Delays the execution of code for a specified number of milliseconds.

f
difference

Computes the difference between two arrays.

f
differenceBy

Computes the difference between two arrays after mapping their elements through a provided function.

f
differenceWith

Computes the difference between two arrays based on a custom equality function.

f
drop

Removes a specified number of elements from the beginning of an array and returns the rest.

f
dropRight

Removes a specified number of elements from the end of an array and returns the rest.

f
dropRightWhile

Removes elements from the end of an array until the predicate returns false.

f
dropWhile

Removes elements from the beginning of an array until the predicate returns false.

f
fill

Fills elements of an array with a specified value from the start position up to, but not including, the end position.

f
flatMap

Maps each element in the array using the iteratee function and flattens the result up to the specified depth.

f
flatten

Flattens an array up to the specified depth.

f
flattenDeep

Flattens all depths of a nested array.

f
flattenObject

Flattens a nested object into a single level object with dot-separated keys.

f
forEachRight

Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.

f
groupBy

Groups the elements of an array based on a provided key-generating function.

f
head

Returns the first element of an array.

f
initial

Returns a new array containing all elements except the last one from the input array. If the input array is empty or has only one element, the function returns an empty array.

f
inRange
No documentation available
f
intersection

Returns the intersection of two arrays.

f
intersectionBy

Returns the intersection of two arrays based on a mapping function.

f
intersectionWith

Returns the intersection of two arrays based on a custom equality function.

f
invert

Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.

f
isEqual

Checks if two values are equal, including support for Date, RegExp, and deep object comparison.

f
isLength
No documentation available
f
isNil

Checks if a given value is null or undefined.

f
isNotNil

Checks if the given value is not null nor undefined.

f
isNull

Checks if the given value is null.

f
isPlainObject

Checks if a given value is a plain object.

f
isUndefined

Checks if the given value is undefined.

f
kebabCase

Converts a string to kebab case.

f
keyBy

Maps each element of an array based on a provided key-generating function.

f
last

Returns the last element of an array.

f
lowerCase

Converts a string to lower case.

f
maxBy

Finds the element in an array that has the maximum value when applying the getValue function to each element.

f
mean

Calculates the average of an array of numbers.

f
meanBy

Calculates the average of an array of numbers when applying the getValue function to each element.

f
minBy

Finds the element in an array that has the minimum value when applying the getValue function to each element.

f
negate

Creates a function that negates the result of the predicate function.

f
noop

A no-operation function that does nothing. This can be used as a placeholder or default function.

f
omit

Creates a new object with specified keys omitted.

f
omitBy

Creates a new object composed of the properties that do not satisfy the predicate function.

f
once

Creates a function that is restricted to invoking the provided function func once. Repeated calls to the function will return the value from the first invocation.

f
orderBy

Sorts an array of objects based on multiple properties and their corresponding order directions.

f
partition

Splits an array into two groups based on a predicate function.

f
pick

Creates a new object composed of the picked object properties.

f
pickBy

Creates a new object composed of the properties that satisfy the predicate function.

f
random

Generate a random number within the given range.

f
randomInt

Generates a random integer between minimum (inclusive) and maximum (exclusive).

f
range

Returns an array of numbers from start to end, incrementing by step.

f
round

Rounds a number to a specified precision.

f
sample

Returns a random element from an array.

f
sampleSize

Returns a sample element array of a specified size.

f
shuffle

Randomizes the order of elements in an array using the Fisher-Yates algorithm.

f
snakeCase

Converts a string to snake case.

f
startCase

Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.

f
sum

Calculates the sum of an array of numbers.

f
sumBy

Calculates the sum of an array of numbers when applying the getValue function to each element.

f
tail

Returns an empty array when the input is a single-element array.

f
take

Returns a new array containing the first count elements from the input array arr. If count is greater than the length of arr, the entire array is returned.

f
takeRight

Returns a new array containing the last count elements from the input array arr. If count is greater than the length of arr, the entire array is returned.

f
takeRightWhile

Takes elements from the end of the array while the predicate function returns true.

f
takeWhile

Returns a new array containing the leading elements of the provided array that satisfy the provided predicate function. It stops taking elements as soon as an element does not satisfy the predicate.

f
throttle

Creates a throttled function that only invokes the provided function at most once per every throttleMs milliseconds. Subsequent calls to the throttled function within the wait time will not trigger the execution of the original function.

c
TimeoutError

An error class representing an timeout operation.

f
toFilled

Creates a new array filled with the specified value from the start position up to, but not including, the end position. This function does not mutate the original array.

f
union

Creates an array of unique values from all given arrays.

f
unionBy

Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.

f
unionWith

Creates an array of unique values from two given arrays based on a custom equality function.

f
uniq

Creates a duplicate-free version of an array.

f
uniqBy

Returns a new array containing only the unique elements from the original array, based on the values returned by the mapper function.

f
uniqWith

Returns a new array containing only the unique elements from the original array, based on the values returned by the comparator function.

f
unzip

Gathers elements in the same position in an internal array from a grouped array of elements and returns them as a new array.

f
unzipWith

Unzips an array of arrays, applying an iteratee function to regrouped elements.

f
without

Creates an array that excludes all specified values.

f
withTimeout

Executes an async function and enforces a timeout.

f
xor

Computes the symmetric difference between two arrays. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection.

f
xorBy

Computes the symmetric difference between two arrays using a custom mapping function. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection, determined by the result of the mapping function.

f
xorWith

Computes the symmetric difference between two arrays using a custom equality function. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection.

f
zip

Combines multiple arrays into a single array of tuples.

f
zipObject

Combines two arrays, one of property names and one of corresponding values, into a single object.

f
zipWith

Combines multiple arrays into a single array using a custom combiner function.

compat

es-toolkit compatibility layer with lodash (WIP)

c
AbortError

An error class representing an aborted operation.

f
camelCase

Converts a string to camel case.

f
capitalize

Converts the first character of string to upper case and the remaining to lower case.

f
chunk

Splits an array into smaller arrays of a specified length.

f
clamp

Clamps a number within the inclusive lower and upper bounds.

f
clone

Creates a shallow clone of the given object.

f
compact

Removes falsey values (false, null, 0, '', undefined, NaN) from an array.

f
concat

Concatenates multiple arrays and values into a single array.

f
countBy

Count the occurrences of each item in an array based on a transformation function.

f
debounce

Creates a debounced function that delays invoking the provided function until after debounceMs milliseconds have elapsed since the last time the debounced function was invoked. The debounced function also has a cancel method to cancel any pending execution.

f
delay

Delays the execution of code for a specified number of milliseconds.

f
difference
No documentation available
f
differenceBy

Computes the difference between two arrays after mapping their elements through a provided function.

f
differenceWith

Computes the difference between two arrays based on a custom equality function.

f
drop

Removes a specified number of elements from the beginning of an array and returns the rest.

f
dropRight

Removes a specified number of elements from the end of an array and returns the rest.

f
dropRightWhile

Removes elements from the end of an array until the predicate returns false.

f
dropWhile

Removes elements from the beginning of an array until the predicate returns false.

f
endsWith

Checks if a string contains another string at the end of the string.

f
fill

Fills elements of an array with a specified value from the start position up to, but not including, the end position.

f
first

Returns the first element of an array.

f
flatMap

Maps each element in the array using the iteratee function and flattens the result up to the specified depth.

f
flatten

Flattens an array up to the specified depth.

f
flattenDeep

Flattens all depths of a nested array.

f
flattenObject

Flattens a nested object into a single level object with dot-separated keys.

f
forEachRight

Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.

f
get

Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.

f
groupBy

Groups the elements of an array based on a provided key-generating function.

f
head

Returns the first element of an array.

f
initial

Returns a new array containing all elements except the last one from the input array. If the input array is empty or has only one element, the function returns an empty array.

f
inRange
No documentation available
f
intersection

Returns the intersection of two arrays.

f
intersectionBy

Returns the intersection of two arrays based on a mapping function.

f
intersectionWith

Returns the intersection of two arrays based on a custom equality function.

f
invert

Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.

f
isEqual

Checks if two values are equal, including support for Date, RegExp, and deep object comparison.

f
isLength
No documentation available
f
isNil

Checks if a given value is null or undefined.

f
isNotNil

Checks if the given value is not null nor undefined.

f
isNull

Checks if the given value is null.

f
isPlainObject

Checks if a given value is a plain object.

f
isUndefined

Checks if the given value is undefined.

f
kebabCase

Converts a string to kebab case.

f
keyBy

Maps each element of an array based on a provided key-generating function.

f
last

Returns the last element of an array.

f
lowerCase

Converts a string to lower case.

f
max

Finds the element in an array that has the maximum value.

f
maxBy

Finds the element in an array that has the maximum value when applying the getValue function to each element.

f
mean

Calculates the average of an array of numbers.

f
meanBy

Calculates the average of an array of numbers when applying the getValue function to each element.

f
min

Finds the element in an array that has the minimum value.

f
minBy

Finds the element in an array that has the minimum value when applying the getValue function to each element.

f
negate

Creates a function that negates the result of the predicate function.

f
noop

A no-operation function that does nothing. This can be used as a placeholder or default function.

f
omit

Creates a new object with specified keys omitted.

f
omitBy

Creates a new object composed of the properties that do not satisfy the predicate function.

f
once

Creates a function that is restricted to invoking the provided function func once. Repeated calls to the function will return the value from the first invocation.

f
orderBy

Sorts an array of objects based on multiple properties and their corresponding order directions.

f
partition

Splits an array into two groups based on a predicate function.

f
pick

Creates a new object composed of the picked object properties.

f
pickBy

Creates a new object composed of the properties that satisfy the predicate function.

f
random

Generate a random number within the given range.

f
randomInt

Generates a random integer between minimum (inclusive) and maximum (exclusive).

f
range

Returns an array of numbers from start to end, incrementing by step.

f
round

Rounds a number to a specified precision.

f
sample

Returns a random element from an array.

f
sampleSize

Returns a sample element array of a specified size.

f
set

Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.

f
shuffle

Randomizes the order of elements in an array using the Fisher-Yates algorithm.

f
snakeCase

Converts a string to snake case.

f
startCase

Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.

f
startsWith

Checks if a string contains another string at the beginning of the string.

f
sum

Calculates the sum of an array of numbers.

f
sumBy

Calculates the sum of an array of numbers when applying the getValue function to each element.

f
tail

Returns an empty array when the input is a single-element array.

f
take

Returns a new array containing the first count elements from the input array arr. If count is greater than the length of arr, the entire array is returned.

f
takeRight

Returns a new array containing the last count elements from the input array arr. If count is greater than the length of arr, the entire array is returned.

f
takeRightWhile

Takes elements from the end of the array while the predicate function returns true.

f
takeWhile

Returns a new array containing the leading elements of the provided array that satisfy the provided predicate function. It stops taking elements as soon as an element does not satisfy the predicate.

f
throttle

Creates a throttled function that only invokes the provided function at most once per every throttleMs milliseconds. Subsequent calls to the throttled function within the wait time will not trigger the execution of the original function.

c
TimeoutError

An error class representing an timeout operation.

f
toFilled

Creates a new array filled with the specified value from the start position up to, but not including, the end position. This function does not mutate the original array.

f
union

Creates an array of unique values from all given arrays.

f
unionBy

Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.

f
unionWith

Creates an array of unique values from two given arrays based on a custom equality function.

f
uniq

Creates a duplicate-free version of an array.

f
uniqBy

Returns a new array containing only the unique elements from the original array, based on the values returned by the mapper function.

f
uniqWith

Returns a new array containing only the unique elements from the original array, based on the values returned by the comparator function.

f
unzip

Gathers elements in the same position in an internal array from a grouped array of elements and returns them as a new array.

f
unzipWith

Unzips an array of arrays, applying an iteratee function to regrouped elements.

f
without

Creates an array that excludes all specified values.

f
withTimeout

Executes an async function and enforces a timeout.

f
xor

Computes the symmetric difference between two arrays. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection.

f
xorBy

Computes the symmetric difference between two arrays using a custom mapping function. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection, determined by the result of the mapping function.

f
xorWith

Computes the symmetric difference between two arrays using a custom equality function. The symmetric difference is the set of elements which are in either of the arrays, but not in their intersection.

f
zip

Combines multiple arrays into a single array of tuples.

f
zipObject

Combines two arrays, one of property names and one of corresponding values, into a single object.

f
zipObjectDeep

Creates a deeply nested object given arrays of paths and values.

f
zipWith

Combines multiple arrays into a single array using a custom combiner function.