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

length (Functional Programming) es-toolkit

Creates a function that returns the length of an array. Use it with pipe.

const result = pipe(array, length());
Info

This helper is specific to es-toolkit/fp. Use it when you want this operation as part of a pipe pipeline.

Usage

length returns the number of values in the piped array.

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

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

Parameters

This function takes no arguments; call it as length().

Returns

A function that maps a readonly T[] to its length.

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