Download node_modules/d3-array/src/groupSort.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 429 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/groupSort.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-array/src/groupSort.js
-
curl -L -o groupSort.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/groupSort.js
429 Bytes
| import ascending from "./ascending.js"; | |
| import group, {rollup} from "./group.js"; | |
| import sort from "./sort.js"; | |
| export default function groupSort(values, reduce, key) { | |
| return (reduce.length !== 2 | |
| ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk))) | |
| : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk)))) | |
| .map(([key]) => key); | |
| } | |