> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# Array


[adjustApplies a function to the element at an index and returns a new array.](/reference/array/adjust)[ascendCreates an ascending comparator from an accessor function.](/reference/array/ascend)[atGets the elements at specified indices from an array and returns a new array.](/reference/array/at)[cartesianProductComputes the Cartesian product of the input arrays.](/reference/array/cartesianProduct)[chunkSplits an array into smaller arrays of a specified size.](/reference/array/chunk)[chunkBySplits an array into chunks of consecutive elements that share the same key.](/reference/array/chunkBy)[combinationsReturns all r-length combinations of elements from the input array.](/reference/array/combinations)[compactReturns a new array with falsy values removed.](/reference/array/compact)[countByCategorizes the elements of an array based on a transformation function result and returns an object with counts.](/reference/array/countBy)[descendCreates a descending comparator from an accessor function.](/reference/array/descend)[differenceReturns a new array excluding elements from the first array that are in the second array.](/reference/array/difference)[differenceByTransforms elements of two arrays with a conversion function, computes their difference, and returns a new array.](/reference/array/differenceBy)[differenceWithComputes the difference of two arrays using a custom comparison function and returns a new array.](/reference/array/differenceWith)[dropReturns a new array with the specified number of elements removed from the beginning.](/reference/array/drop)[dropRepeatsRemoves consecutively repeated elements from an array using strict equality (===).](/reference/array/dropRepeats)[dropRightReturns a new array with the specified number of elements removed from the end.](/reference/array/dropRight)[dropRightWhileReturns a new array with elements removed from the end while a condition is satisfied.](/reference/array/dropRightWhile)[dropWhileReturns a new array with elements removed from the beginning while a condition is satisfied.](/reference/array/dropWhile)[fillFills array elements with a specified value.](/reference/array/fill)[filterAsyncFilters an array using an async predicate function and returns a new array containing only the elements that satisfy the condition.](/reference/array/filterAsync)[flatMapTransforms each element of an array with a function's return value, then flattens to a specified depth and returns a new array.](/reference/array/flatMap)[flatMapAsyncTransforms each element in an array using an async function and flattens the result by one level to return a new array.](/reference/array/flatMapAsync)[flatMapDeepTransforms each element of an array with a function's return value, then flattens all depths and returns a new array.](/reference/array/flatMapDeep)[flattenReturns a new array that is flattened to the specified depth.](/reference/array/flatten)[flattenDeepReturns a new array with all depths of a nested array flattened.](/reference/array/flattenDeep)[forEachAsyncExecutes an async function for each element in an array.](/reference/array/forEachAsync)[forEachRightIterates over the elements of an array from right to left, executing a function for each element.](/reference/array/forEachRight)[groupByReturns a new object with array elements grouped according to a key-generating function.](/reference/array/groupBy)[headReturns the first element of an array.](/reference/array/head)[initialReturns a new array containing all elements except the last one.](/reference/array/initial)[intersectionReturns a new array containing elements that are commonly included in both arrays.](/reference/array/intersection)[intersectionByReturns a new array containing the intersection of two arrays based on the result of a transformation function.](/reference/array/intersectionBy)[intersectionWithReturns a new array containing the intersection of two arrays based on a custom comparison function.](/reference/array/intersectionWith)[isSubsetChecks if one array is a subset of another array.](/reference/array/isSubset)[isSubsetWithChecks if one array is a subset of another array based on a custom comparison function.](/reference/array/isSubsetWith)[keyByReturns a new object with array elements converted to key-value pairs using a key-generating function.](/reference/array/keyBy)[lastReturns the last element of an array.](/reference/array/last)[mapAsyncTransforms each element in an array using an async function and returns a new array.](/reference/array/mapAsync)[maxByReturns the element with the maximum value from the array based on the value returned by the transformation function.](/reference/array/maxBy)[minByReturns the element with the minimum value from the array based on the value returned by the transformation function.](/reference/array/minBy)[orderByReturns a new array sorted by multiple criteria and sort directions.](/reference/array/orderBy)[partitionReturns a tuple that splits an array into two groups based on a condition.](/reference/array/partition)[pullRemoves all specified values from an array.](/reference/array/pull)[pullAtRemoves elements at specified indices from an array and returns the removed elements.](/reference/array/pullAt)[reduceAsyncReduces an array to a single value using an async reducer function.](/reference/array/reduceAsync)[reduceWhileLike reduce but stops early when the predicate returns false.](/reference/array/reduceWhile)[removeRemoves elements from an array based on a condition function and returns the removed elements in a new array.](/reference/array/remove)[sampleReturns a randomly selected element from an array.](/reference/array/sample)[sampleSizeReturns a new array of randomly selected elements with the specified size.](/reference/array/sampleSize)[scanLike reduce but returns an array of all intermediate accumulator values.](/reference/array/scan)[shuffleReturns a new array with the elements randomly shuffled.](/reference/array/shuffle)[sortByReturns a new array sorted in ascending order by the given criteria.](/reference/array/sortBy)[sortWithSorts an array using multiple comparators in priority order.](/reference/array/sortWith)[tailReturns a new array consisting of all elements except the first.](/reference/array/tail)[takeCreates a new array by taking the specified number of elements from the beginning of the array.](/reference/array/take)[takeRightCreates a new array by taking the specified number of elements from the end of the array.](/reference/array/takeRight)[takeRightWhileReturns a new array by taking elements from the end of the array while the condition function returns true.](/reference/array/takeRightWhile)[takeWhileCreates a new array by taking elements from the beginning of the array while the condition function returns true.](/reference/array/takeWhile)[toFilledCreates a new array by filling part or all of it with the specified value.](/reference/array/toFilled)[unfoldBuilds an array from a seed value using an iterator function.](/reference/array/unfold)[unionCreates a new array containing all unique elements from two arrays.](/reference/array/union)[unionByCreates a new array containing unique elements from two arrays based on values transformed by a specific function.](/reference/array/unionBy)[unionWithCreates a new array containing unique elements from two arrays based on a custom equality function.](/reference/array/unionWith)[uniqReturns a new array with duplicate elements removed.](/reference/array/uniq)[uniqByReturns a new array with duplicate elements removed based on values returned by the transformation function.](/reference/array/uniqBy)[uniqWithReturns a new array with duplicate elements removed using a comparison function.](/reference/array/uniqWith)[unzipUnpacks grouped arrays and creates new arrays by gathering elements at the same position.](/reference/array/unzip)[unzipWithUnpacks grouped arrays and applies a transformation function to return a new array.](/reference/array/unzipWith)[windowedReturns a new array containing snapshots of each window as a window of specified size slides regularly along the array.](/reference/array/windowed)[withoutCreates a new array excluding specific values from the array.](/reference/array/without)[xorCreates a new array with elements that exist in only one of two arrays.](/reference/array/xor)[xorByCreates a new array with elements that exist in only one of two arrays, based on values transformed by a given function.](/reference/array/xorBy)[xorWithCreates a new array with elements that exist in only one of two arrays using a given comparison function.](/reference/array/xorWith)[zipCreates an array of tuples by bundling elements at the same index from multiple arrays.](/reference/array/zip)[zipObjectCreates a single object from a keys array and a values array.](/reference/array/zipObject)[zipWithCreates a new array by combining multiple arrays using a custom function.](/reference/array/zipWith)