UNPKG

froebel

Version:
22 lines (19 loc) 432 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = repeat; /** * 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) * ``` */ function* repeat(...sequence) { while (true) for (const n of sequence) yield n; } module.exports = Object.assign(exports.default || {}, exports);