Arrays
The Arrays module provides a number of convenience functions to create, query, and manipulate JavaScript arrays.
List |
Extends the built-in Array object with additional convenience methods derived from the |
clear() |
Clears all elements from the given array. |
clearNull() |
Removes all |
clone() |
Returns a copy of an array. |
closest() |
Returns the closest array element to some other element. |
correlate() |
Iterates through several arrays of the same length at once, calling a callback function with all the array elements at that index at each step. |
count() |
Returns the number of elements in the iterable. |
difference() |
Creates a new array with only the elements that are unique to one of the given arrays. |
distinct() |
Returns a new array of only the unique values of the iterable (without duplicates). |
equal() |
Checks whether the contents of two arrays are referentially equal. |
findIndices() |
Returns an array of indices corresponding to all elements in the array that match a condition. |
first() |
Returns the first element in an iterable. |
groupBy() |
Creates a two-dimensional array by grouping the values in the original array by the return value of the property callback. |
hasDuplicates() |
Checks whether an iterable contains duplicate values or references. |
hasElementAt() |
Returns true if the given index refers to an actual element on the specified array. |
hasMultiple() |
Returns |
insert() |
Inserts one or multiple elements at the given index. |
intersection() |
Creates a new array with only the elements that are common to all of the given arrays. |
isEmpty() |
Checks whether an iterable is empty. |
isInBounds() |
Returns true if the given index is within the array’s bounds. |
isNotEmpty() |
Checks whether an iterable is not empty. |
last() |
Returns the last element in an iterable. |
moveAll() |
Wraps all array elements around by a specified number of places. |
next() |
Gets the next element in the array, starting at the given index. |
previous() |
Gets the previous element in the array, starting at the given index. |
range() |
Generates an array of numbers between the specified boundaries. |
remove() |
Removes the specified element(s) from the array and returns the original array. |
removeAt() |
Removes the element at the specified index and returns the original array. |
replace() |
Replaces the specified element with another and returns the original array. |
replaceAll() |
Replaces all elements in the array with one or multiple others and returns the original (modified) array. |
sort() |
Sorts an array in a standard way depending on its contained data type, or use custom sort functions. |
type() |
Checks if the array contains only elements of the given type. |
union() |
Creates a new array with all elements from the given arrays, excluding duplicates. |
zip() |
Combines two or more arrays, creating a new two-dimensional array where each element is a tuple of each element at that index. |