curry
Transforms a multi-argument function into a chain of single-argument functions (Haskell-style currying). Supports up to 5 arguments.
The inverse operation of applying all arguments at once:
curry(fn)(a)(b) is equivalent to fn(a, b).
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fn | function | The function to curry |
Returns
Section titled “Returns”function — A curried version of fn
Examples
Section titled “Examples”Create reusable adder
Section titled “Create reusable adder”Curry a 2-argument function to build specialised versions.
Pipeline-friendly 3-argument function
Section titled “Pipeline-friendly 3-argument function”Curry enables point-free style when composing pipelines.
