combinations (Functional Programming) es-toolkit
Creates a function that returns combinations of a given size. Use it with pipe.
Info
Prefer the original es-toolkit combinations in ordinary code. Use this fp variant when composing transformations with pipe.
Usage
combinations returns every way to choose size values from the piped array while preserving their original order in each combination.
Parameters
sizenumberrequired
The number of values in each combination.
Returns
A function that maps a readonly T[] to an array of combinations.
Throws
Throws an error if size is not a non-negative integer.
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.