Skip to main content

Variable: forEach()

const forEach: {<Value>(fn): (iterable) => void; <Value>(fn, iterable): void; }

Defined in: side-effects.d.ts:171

Applies fn to each value of iterable.

Like Array.prototype.forEach, but for iterables.

Call Signature

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

Type Parameters

Value

Value

Parameters

fn

(value) => unknown

Returns

(iterable): void

Parameters

iterable

Iterable<Value>

Returns

void

Call Signature

<Value>(fn, iterable): void

Type Parameters

Value

Value

Parameters

fn

(value) => unknown

iterable

Iterable<Value>

Returns

void

Example

import { forEach, pipe } from 'lfi'

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

Since

v0.0.1