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/takeRight.md.

takeRight (Functional Programming) es-toolkit

Creates a function that returns values from the end of an array. Use it with pipe.

const result = pipe(array, takeRight(count));
Info

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

Usage

takeRight returns the last count values from the piped array.

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

pipe([1, 2, 3, 4], takeRight(2)); // => [3, 4]

Parameters

countnumberrequired

The number of values to take from the end.

Returns

A function that maps a readonly T[] to the last count 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.