UNPKG

@thi.ng/transducers

Version:

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

10 lines (9 loc) 257 B
import { isIterable } from "@thi.ng/checks/is-iterable"; import { iterator1 } from "./iterator.js"; import { map } from "./map.js"; function pluck(key, src) { return isIterable(src) ? iterator1(pluck(key), src) : map((x) => x[key]); } export { pluck };