Skip to main content

Function: consume()

consume(iterable): void

Iterates through iterable causing lazy operations to run.

Parameters

iterable

Iterable<unknown, any, any>

Returns

void

Example

import { consume, each, pipe } from 'lfi'

const iterable = pipe(
[`sloth`, `lazy`, `sleep`],
each(console.log),
)
// No output

consume(iterable)
//=> sloth
//=> lazy
//=> sleep
Playground

Since

v2.0.0

Defined in

side-effects.d.ts:282