Function: countAsync()
countAsync<
Value
>(asyncIterable
):Promise
<number
>
Returns a promise that resolves to the number of values in asyncIterable
.
Like Array.prototype.length
, but for async iterables.
Type Parameters
• Value
Parameters
• asyncIterable: AsyncIterable
<Value
, any
, any
>
Returns
Promise
<number
>
Example
console.log(
await countAsync(asAsync([`sloth`, `more sloth`, `even more sloth`])),
)
//=> 3