consumeAsync
consumeAsync(
iterable,count?,signal?):Promise<void>
Defined in: packages/core/src/iterable/async/consume.ts:20
Drains an iterable without materialising it, for a pipeline whose side effects are the point.
The async counterpart of consume, and the readable form of an empty-bodied
for await…of, which reads like a mistake. The iterator is closed when a
count cuts the drain short.
Time complexity: O(min(n, count)). Memory: O(1).
Parameters
Section titled “Parameters”iterable
Section titled “iterable”MaybeAsyncIterable<unknown>
The iterable to drain, sync or async.
count?
Section titled “count?”number = Number.POSITIVE_INFINITY
How many elements to pull. Must be a non-negative integer or
Infinity, the default, which drains to the end.
signal?
Section titled “signal?”AbortSignal
Aborts the drain.
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”If count is negative, fractional or NaN.