import { repeat } from "https://deno.land/x/aitertools@0.6.0/src/infinite.ts";
Makes an async iterator that yields the same value over and over again.
It will repeat indefinitely unless times
is specified.
import { repeat } from "./infinite.ts";
const iterable = repeat("v");
for await (const value of iterable) console.log(value);
The above example will print the following and keep going forever:
v
v
v
(...)
However, if you specify the second parameter times
it will repeat that many
times:
import { repeat } from "./infinite.ts";
const iterable = repeat("V", 3);
for await (const value of iterable) console.log(value);
The above example will print the following 3 lines:
V
V
V
Parameters
value: T
The value to repeat.