UNPKG

@thi.ng/transducers

Version:

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

11 lines (10 loc) 228 B
import { isReduced } from "../reduced.js"; const __drain = (buf, complete, reduce) => (acc) => { while (buf.length && !isReduced(acc)) { acc = reduce(acc, buf.shift()); } return complete(acc); }; export { __drain };