UNPKG

@thi.ng/transducers

Version:

Collection of ~170 lightweight, composable transducers, reducers, generators, iterators for functional data transformations

16 lines (15 loc) 285 B
import { $$reduce, reducer } from "./reduce.js"; function count(...args) { const res = $$reduce(count, args); if (res !== void 0) { return res; } const [offset = 0, step = 1] = args; return reducer( () => offset, (acc, _) => acc + step ); } export { count };