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

dropRight (Functional Programming) es-toolkit

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

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

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

Usage

dropRight removes the last count values from the piped array.

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

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

Parameters

countnumberrequired

The number of values to drop from the end.

Returns

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