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