Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptLodash Array Complete Reference

Lodash Array Complete Reference

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers etc. Lodash Array methods are used to perform operations on arrays using inbuild methods.

Lodash Array Methods

Description

_.chunk() It is used to break the array in to small chunks.
_.compact() It is used to creates an array with all falsey values removed in JavaScript.
_.concat() It is used to concatenating the arrays in JavaScript.
_.difference() It is used to remove a single element or the array of elements from the original array.
_.differenceBy() It is used to remove the values from the original array by iterating over each element.
_.differenceWith() All the elements of the first array are compared with the second array by applying comparison provided in third.
_.drop() It is used to drop the elements in a given array.
_.dropRight() It is used to delete the elements from the right of the array.
_.dropRightWhile() It is used to delete the slice of the array excluding elements dropped from the end.
_.dropWhile() It is used to return the slice of the given array.
_.fill() It is used to fill a set of values into the array in a given range.
_.findIndex() It is used to find the index of the first occurrence of the element.
_.findLastIndex() It is used to find the element from the right of the array.
_.first() It is used to get the first element of the specified array.
_.flatten() It is used to flatten the array to one level deep.
_.flattenDepth() It is used to flatten up to depth time that is passed into the function.
_.flattenDeep() It is used to completely flatten nested arrays.
_.fromPairs() It returns an object composed form key-value pairs.
_.head() It is used to get the first element of an array.
_.indexOf() It is used to get the index of first occurrence of the particular element in the array.
_.initial() It is used to get the all elements of the array in range 0 to n-2.
_.Intersection() It is used to take the intersection of the one or more arrays.
_.intersectionBy() It takes the intersection of the array with any number of arrays based on some function that iterates over each element.
_.join() It is used to converts all elements in the array into a string separated by a separator.
_.last() It is used to get the last element of the array i.e. (n-1)th element.
_.lastIndexOf() It is used to get the index of the first occurrence of the particular element in the array from the last element.
_.nth() It is used to return the nth index of the element.
_.pull() It is used to remove all the given values from a given array.
_.pullAll() It is used to remove all the values from the first given array that are given in the second array.
_.pullAllBy() It is used to remove the values from the original array by iterating over each element.
_.pullAllWith() All the elements of the first array are compared with the second array by applying comparison provided in third.
_.pullAt() It removes the element corresponding to the given address.
_.remove() It removes all elements from the array that predicate returns True.
_.reverse() It is used to reverse the array.
_.slice() It takes slice of the array from starting index to end index.
_.sortedIndex() It returns the lowest index of the array where an element can be inserted and maintain its sorted order.
_.sortedIndexBy() It returns the lowest index of the array where an element can be inserted and maintain its sorted order.
_.sortedIndexOf() It is used to get the index of first occurrence of the particular element in the sorted array.
_.sortedLastIndex() It returns the highest index of the array where an element can be inserted and maintain its sorted order.
_.sortedLastIndexBy() It returns the highest index of the array where an element can be inserted and maintain its sorted order.
_.sortedLastIndexOf() It returns the highest index of the array where an element can be inserted and maintain its sorted order.
_.sortedUniq() It returns the lowest index of the array where an element can be inserted and maintain its sorted order.
_.sortedUniqBy() It returns the lowest index of the array where an element can be inserted and maintain its sorted order.
_.tail() It creates a new array that doesn’t contain the first element of the original array.
_.take() It creates a slice of an array with n elements from the beginning.
_.takeRight() It is used to get the array of n elements from the end of the given array.
_.takeRightWhile() It creates a slice of an array in which elements are taken from the end.
_.takeWhile() It creates a slice of an array in which elements are taken from the beginning.
_.union() It takes n number of arrays and creates an array of unique values in order.
_.unionBy() It accepts iteratee which is invoked for each element of each array to generate the criterion.
_.unionWith() It accepts comparator which is invoked to compare elements of arrays.
_.uniq() It creates an array of unique values in order.
_.uniqBy() It accepts iteratee which is invoked for each element in an array to generate the criterion.
_.uniqWith() It accepts comparator which is invoked to compare elements of an array.
_.unzip() It accepts an array of grouped elements.
_.unzipWith() It accepts iteratee to specify how regrouped values should be combined.
_.without() It creates a new array in a filtered form that is there are values to exclude and give new values as output.
_.xor() It returns an array of the symmetric difference of given arrays.
_.xorBy() It accepts iteratee which is invoked for each element of each arrays to generate the criterion.
_.xorWith() It accepts comparator which is invoked to compare elements of arrays.
_.zip() It is used to create an array of grouped elements.
_.zipObject() It is used to combine two arrays into an object.
_.zipObjectDeep() It is used to combine two arrays into an object.
_.zipWith() It is used to combine arrays into one array by applying function in the same value at the same index of arrays.

RELATED ARTICLES

Most Popular

Recent Comments