Category

Array

Utilities for working with arrays

39 utilities available

chunk

Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements.

compact

Creates an array with all falsy values removed. The values false, null, 0, "", undefined, and NaN are falsy.

flatten

Flattens array a single level deep.

flattenDeep

Recursively flattens array to a single level.

uniq

Creates a duplicate-free version of an array, using SameValueZero for equality comparisons.

uniqBy

Creates a duplicate-free version of an array using a comparator function to determine uniqueness.

fill

Fills elements of array with value from start up to, but not including, end.

findIndex

Returns the index of the first element predicate returns truthy for instead of the element itself.

findLastIndex

This method is like findIndex except that it iterates over elements of collection from right to left.

first

Gets the first element of array. Alias for head.

flattenDepth

Recursively flatten array up to depth times.

fromPairs

The inverse of toPairs; this method returns an object composed from key-value pairs.

head

Gets the first element of array.

indexOf

Gets the index at which the first occurrence of value is found in array.

join

Converts all elements in array into a string separated by separator.

last

Gets the last element of array.

lastIndexOf

This method is like indexOf except that it iterates over elements of array from right to left.

nth

Gets the element at index n of array. If n is negative, the nth element from the end is returned.

pull

Removes all given values from array using SameValueZero for equality comparisons.

pullAll

This method is like pull except that it accepts an array of values to remove.

pullAllBy

This method is like pullAll except that it accepts iteratee which is invoked for each element of array and values to generate the criterion by which they're compared.

pullAllWith

This method is like pullAll except that it accepts comparator which is invoked to compare elements of array to values.

pullAt

Removes elements from array corresponding to indexes and returns an array of removed elements.

remove

Removes all elements from array that predicate returns truthy for and returns an array of the removed elements.

reverse

Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on.

slice

Creates a slice of array from start up to, but not including, end.

sortedIndex

Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order.

sortedIndexBy

This method is like sortedIndex except that it accepts iteratee which is invoked for value and each element of array to compute their sort ranking.

sortedIndexOf

This method is like indexOf except that it performs a binary search on a sorted array.

sortedLastIndex

This method is like sortedIndex except that it returns the highest index at which value should be inserted into array in order to maintain its sort order.

sortedLastIndexBy

This method is like sortedLastIndex except that it accepts iteratee which is invoked for value and each element of array to compute their sort ranking.

sortedLastIndexOf

This method is like lastIndexOf except that it performs a binary search on a sorted array.

sortedUniq

This method is like uniq except that it's designed and optimized for sorted arrays.

sortedUniqBy

This method is like uniqBy except that it's designed and optimized for sorted arrays.

tail

Gets all but the first element of array.

take

Creates a slice of array with n elements taken from the beginning.

takeRight

Creates a slice of array with n elements taken from the end.

takeRightWhile

Creates a slice of array with elements taken from the end. Elements are taken until predicate returns falsey.

takeWhile

Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns falsey.