repeatEach
repeatEach<
T>(iterable,times):IterableIterator<T>
Defined in: packages/core/src/iterable/repeat-each.ts:16
Yields each element times times in a row before moving to the next.
Not cycle, which repeats the whole sequence rather than each element:
repeatEach([1, 2], 2) yields 1, 1, 2, 2 where cycle([1, 2], 2) yields
1, 2, 1, 2.
Time complexity: O(n × times). Nothing is buffered.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
number
How many times to repeat each element. Must be a non-negative integer; zero yields nothing.
Returns
Section titled “Returns”IterableIterator<T>
An iterator over the repeated elements.
Throws
Section titled “Throws”If times is not a non-negative integer.