Function: map()
Returns an iterable containing the values of iterable
transformed by fn
in iteration order.
Like Array.prototype.map
, but for iterables.
Example
console.log(
pipe(
[`sloth`, `more sloth`, `even more sloth`],
map(string => string.length),
reduce(toArray()),
),
)
//=> [ 5, 10, 15 ]
Since
v0.0.1
Call Signature
map<
From
,To
>(fn
): (iterable
) =>Iterable
<To
,any
,any
>
Type Parameters
• From
• To extends [] | unknown
[]
Parameters
fn
(value
) => To
Returns
Function
Parameters
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>
Defined in
Call Signature
map<
From
,To
>(fn
,iterable
):Iterable
<To
,any
,any
>
Type Parameters
• From
• To extends [] | unknown
[]
Parameters
fn
(value
) => To
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>
Defined in
Call Signature
map<
From
,To
>(fn
): (iterable
) =>Iterable
<To
,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => To
Returns
Function
Parameters
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>
Defined in
Call Signature
map<
From
,To
>(fn
,iterable
):Iterable
<To
,any
,any
>
Type Parameters
• From
• To
Parameters
fn
(value
) => To
iterable
Iterable
<From
, any
, any
>
Returns
Iterable
<To
, any
, any
>