cycle
cycle<
T>(iterable,times?):IterableIterator<T>
Defined in: packages/core/src/iterable/cycle.ts:17
Yields the whole iterable times times over.
The source is pulled once and buffered, because an iterator cannot be restarted — so the whole of it is held in memory from the first pass onwards.
Time complexity: O(n × times). Memory: O(n).
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
times?
Section titled “times?”number = Number.POSITIVE_INFINITY
How many passes to yield. Must be a non-negative integer or
Infinity, which repeats forever. Zero yields nothing and consumes
nothing.
Returns
Section titled “Returns”IterableIterator<T>
An iterator over the repeated elements.
Throws
Section titled “Throws”If times is negative, fractional or NaN.