UNPKG

froebel

Version:
13 lines 275 B
/** * Returns a generator that repeats `sequence`. * * @example * ``` * // prints: 1, 2, 3, 1, 2, 3, ... * for (const n of repeat(1, 2, 3)) * console.log(n) * ``` */ export default function* repeat(...sequence) { while (true) for (const n of sequence) yield n; }