For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/fp/at.md.

at (Functional Programming) es-toolkit

Creates a function that returns the values at the given indices. Use it with pipe.

const result = pipe(array, at(indices));
Info

Prefer the original es-toolkit at in ordinary code. Use this fp variant when composing transformations with pipe.

Usage

at reads values from the piped array at each index in indices. Negative indices count from the end, matching Array.prototype.at.

import { at, pipe } from 'es-toolkit/fp';

pipe(['a', 'b', 'c'], at([0, -1])); // => ['a', 'c']

Parameters

indicesnumber[]required

The indices to read from the piped array.

Returns

A function that maps a readonly T[] to the selected values.

(array: readonly T[]) => T[]
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.