Function: filterMap()
Returns an iterable containing the values of iterable
transformed by fn
in iteration order excluding the values for which fn
returns null
or
undefined
.
Example
import { filterMap, pipe, reduce, toArray } from 'lfi'
console.log(
pipe(
[
{ sloth: `sloth` },
{ sloth: `lazy` },
{ notSloth: `active` },
{ sloth: `sleep` },
{ notSloth: `awake` },
],
filterMap(object => object.sloth),
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy', 'sleep' ]
Since
v0.0.1
Call Signature
filterMap<
From
,To
>(fn
): (iterable
) =>Iterable
<NonNullable
<To
>,any
,any
>
Type Parameters
• From
• To extends [] | unknown
[]
Parameters
fn
(value
) => undefined
| null
| To
Returns
Function
Parameters
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<NonNullable
<To
>, any
, any
>
Defined in
Call Signature
filterMap<
From
,To
>(fn
,iterable
):Iterable
<NonNullable
<To
>,any
,any
>
Type Parameters
• From
• To extends [] | unknown
[]
Parameters
fn
(value
) => undefined
| null
| To
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<NonNullable
<To
>, any
, any
>
Defined in
Call Signature
filterMap<
From
,To
>(fn
): (iterable
) =>Iterable
<NonNullable
<To
>,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => undefined
| null
| To
Returns
Function
Parameters
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<NonNullable
<To
>, any
, any
>
Defined in
Call Signature
filterMap<
From
,To
>(fn
,iterable
):Iterable
<NonNullable
<To
>,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => undefined
| null
| To
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<NonNullable
<To
>, any
, any
>