Skip to main content

Variable: takeAsync

const takeAsync: SubAsync

Defined in: splices.d.ts:301

Returns an async iterable containing the first count values of asyncIterable in iteration order.

If the count is greater than the number of values in asyncIterable, then an async iterable equivalent asyncIterable is returned.

Throws

if count isn't a non-negative integer.

Example

console.log(
await pipe(
asAsync([1, 2, 3, 4, 5, `sloth`]),
takeAsync(3),
reduceAsync(toArray()),
),
)
//=> [ 1, 2, 3 ]

Since

v0.0.1