source: node_modules/d3-array/src/groupSort.js

Last change on this file was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 429 bytes
Line 
1import ascending from "./ascending.js";
2import group, {rollup} from "./group.js";
3import sort from "./sort.js";
4
5export default function groupSort(values, reduce, key) {
6 return (reduce.length !== 2
7 ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)))
8 : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))))
9 .map(([key]) => key);
10}
Note: See TracBrowser for help on using the repository browser.