UNPKG
froebel
Version:
latest (0.23.2)
0.23.2
0.23.1
0.23.0
0.22.0
0.21.3
0.21.2
0.21.1
0.21.0
0.20.0
0.19.0
0.18.0
0.17.0
0.16.1
0.15.0
0.14.4
0.14.3
0.14.1
TypeScript utility library
github.com/MathisBullinger/froebel
MathisBullinger/froebel
froebel
/
repeat.mjs
13 lines
•
275 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
/** * 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; }