deno.land / x / froebel@v0.23.2 / repeat.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/** * 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<T>(...sequence: [T, ...T[]]): Generator<T> { while (true) for (const n of sequence) yield n;}
froebel

Version Info

Tagged at
a year ago