UNPKG

@thi.ng/transducers-async

Version:

Async versions of various highly composable transducers, reducers and iterators

13 lines (12 loc) 233 B
import { wait } from "./delayed.js"; async function* repeatedly(fn, n = Infinity, delay = 0) { for (let i = 0; i < n; i++) { yield await fn(i); if (delay > 0) { await wait(delay); } } } export { repeatedly };