consume
consume(
iterable,count?):void
Defined in: packages/core/src/iterable/consume.ts:15
Drains an iterable without materialising it, for a pipeline whose side effects are the point.
The readable form of an empty-bodied for…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”Iterable<unknown>
The iterable to drain.
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.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If count is negative, fractional or NaN.