Skip to main content

Function: forEach()

Applies fn to each value of iterable.

Like Array.prototype.forEach, but for iterables.

Example

import { forEach, pipe } from 'lfi'

console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
forEach(console.log),
),
)
//=> sloth
//=> lazy
//=> sleep
Playground

Since

v0.0.1

Call Signature

forEach<Value>(fn): (iterable) => void

Type Parameters

Value

Parameters

fn

(value) => unknown

Returns

Function

Parameters

iterable

Iterable<Value, any, any>

Returns

void

Defined in

side-effects.d.ts:172

Call Signature

forEach<Value>(fn, iterable): void

Type Parameters

Value

Parameters

fn

(value) => unknown

iterable

Iterable<Value, any, any>

Returns

void

Defined in

side-effects.d.ts:173