at es-toolkit
Gets the elements at specified indices from an array and returns a new array.
Reference
at(arr, indices)
Use at when you want to select elements at specific positions from an array. You can use negative indices to select elements from the end of the array.
Non-integer indices are converted to integers.
Parameters
arrreadonly T[]required
The array to get elements from.
indicesreadonly number[]required
An array of indices of the elements to get. Negative values count from the end of the array.
Returns
A new array containing the elements at the specified indices.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.