Function: firstAsync()
firstAsync<
Value
>(asyncIterable
):AsyncOptional
<Value
>
Returns an async iterable containing the first value of asyncIterable
, or
an empty async iterable if asyncIterable
is empty.
Type Parameters
• Value
Parameters
asyncIterable
AsyncIterable
<Value
, any
, any
>
Returns
AsyncOptional
<Value
>
Example
console.log(
await pipe(
asAsync([`sloth`, `more sloth`, `even more sloth`]),
firstAsync,
reduceAsync(toArray()),
),
)
//=> [ 'sloth' ]
Since
v0.0.1