Function: each()
Returns an iterable equivalent to iterable
that applies fn
to each value
of iterable
as it is iterated.
Example
import { each, pipe, reduce, toArray } from 'lfi'
console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
each(console.log),
reduce(toArray()),
),
)
//=> sloth
//=> lazy
//=> sleep
//=> [ 'sloth', 'lazy', 'sleep' ]
Since
v0.0.1
Call Signature
each<
From
,To
>(fn
): (iterable
) =>Iterable
<To
,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => asserts value is To
Returns
Function
Parameters
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>
Defined in
Call Signature
each<
From
,To
>(fn
,iterable
):Iterable
<To
,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => asserts value is To
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>
Defined in
Call Signature
each<
Value
>(fn
): (iterable
) =>Iterable
<Value
,any
,any
>
Type Parameters
• Value
Parameters
fn
(value
) => unknown
Returns
Function
Parameters
iterable
Iterable
<Value
, any
, any
>
Returns
Iterable
<Value
, any
, any
>
Defined in
Call Signature
each<
Value
>(fn
,iterable
):Iterable
<Value
,any
,any
>
Type Parameters
• Value
Parameters
fn
(value
) => unknown
iterable
Iterable
<Value
, any
, any
>
Returns
Iterable
<Value
, any
, any
>