Returns a generator that yields first argument (what) the number of times specified by the second argument (times). If times is not given, what is repeated indefinitely.
what
times
Optional
Rest
import { repeat } from 'deleight/generators';const repeated = [...repeat([1, 2, 3], 4)];// [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3] Copy
import { repeat } from 'deleight/generators';const repeated = [...repeat([1, 2, 3], 4)];// [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]
Returns a generator that yields first argument (
what
) the number of times specified by the second argument (times
). Iftimes
is not given,what
is repeated indefinitely.