UNPKG

@thi.ng/transducers-async

Version:

Async versions of various highly composable transducers, reducers and iterators

15 lines (14 loc) 259 B
import { reducer } from "./reduce.js"; function push(src) { return src ? (async () => { let res = []; for await (let x of src) res.push(x); return res; })() : reducer( () => [], (acc, x) => (acc.push(x), acc) ); } export { push };