UNPKG

@thi.ng/transducers

Version:

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

11 lines (10 loc) 207 B
import { reducer } from "./reduce.js"; function pushKeys(key, src) { return src ? [...src].map((x) => x[key]) : reducer( () => [], (acc, x) => (acc.push(x[key]), acc) ); } export { pushKeys };