Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/froebel/iterable.ts>repeat

A strictly typed utility library.
Go to Latest
function repeat
import { repeat } from "https://deno.land/x/froebel@v0.18.0/iterable.ts";

Returns a generator that repeats sequence.

Examples

Example 1

// prints: 1, 2, 3, 1, 2, 3, ...
for (const n of repeat(1, 2, 3))
  console.log(n)

Parameters

...sequence: [T, ...T[]]

Returns

Generator<T>