forEach (Functional Programming) es-toolkit
Creates a function that runs a callback for each value and returns the input array. Use it with pipe.
Info
This helper is specific to es-toolkit/fp. Use it when you want this operation as part of a pipe pipeline.
Usage
forEach is useful as a side-effect step in a pipeline. It calls callback for each value and passes the original array through. Inside pipe, it is lazy-capable when adjacent lazy operations can stop early.
Parameters
callback(value: T, index: number) => voidrequired
The function to run for each value.
Returns
A function that returns the same array after running the callback.
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.