UNPKG

@thi.ng/transducers-async

Version:

Async versions of various highly composable transducers, reducers and iterators

16 lines (15 loc) 350 B
import { compR } from "./compr.js"; import { iterator1 } from "./iterator.js"; function throttle(pred, src) { return src ? iterator1(throttle(pred), src) : (rfn) => { const reduce = rfn[2]; const $pred = pred(); return compR( rfn, async (acc, x) => await $pred(x) ? reduce(acc, x) : acc ); }; } export { throttle };