UNPKG

@thi.ng/transducers

Version:

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

14 lines (13 loc) 377 B
import { identity } from "@thi.ng/compose/identity"; import { groupByMap } from "./group-by-map.js"; import { normCount } from "./norm-count.js"; import { $$reduce } from "./reduce.js"; function normFrequencies(...args) { return $$reduce(normFrequencies, args) || groupByMap({ key: args[1] || identity, group: normCount(args[0]) }); } export { normFrequencies };