Arrays
import { chunk, compact, first } from '@rtorcato/js-common/arrays'
Exports
| Name | Summary |
|---|---|
chunk | Chunks an array into smaller arrays of a specified size. |
compact | Removes all falsy values from an array. |
first | Returns the first element of an array, or undefined if the array is empty. |
flatten | Flattens an array one level deep. |
groupBy | Groups array elements by a key derived from each element. |
last | Returns the last element of an array, or undefined if the array is empty. |
shuffle | Shuffles an array using the Fisher-Yates algorithm. |
unique | Removes duplicate values from an array while preserving order. |