UNPKG

@thi.ng/transducers

Version:

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

12 lines (11 loc) 236 B
import { compare } from "@thi.ng/compare/compare"; function pushSort(cmp = compare, src) { return src ? [...src].sort(cmp) : [ () => [], (acc) => acc.sort(cmp), (acc, x) => (acc.push(x), acc) ]; } export { pushSort };