format d3
parent
7a938f2272
commit
8167444f00
|
@ -37,7 +37,7 @@ async function main(fileLoc: string) {
|
||||||
const setDiff = <T>(a: Set<T>, b: Set<T>) =>
|
const setDiff = <T>(a: Set<T>, b: Set<T>) =>
|
||||||
new Set([...a].filter((e) => !b.has(e)));
|
new Set([...a].filter((e) => !b.has(e)));
|
||||||
const setRetain = <T>(a: Set<T>, b: Set<T>) =>
|
const setRetain = <T>(a: Set<T>, b: Set<T>) =>
|
||||||
new Set([...a].filter(e => b.has(e)))
|
new Set([...a].filter((e) => b.has(e)));
|
||||||
|
|
||||||
const groupBy = <T, K>(arr: T[], groupFn: (e: T, idx: number) => K) => {
|
const groupBy = <T, K>(arr: T[], groupFn: (e: T, idx: number) => K) => {
|
||||||
return arr.reduce<Map<K, T[]>>((ret, e, idx) => {
|
return arr.reduce<Map<K, T[]>>((ret, e, idx) => {
|
||||||
|
@ -53,7 +53,7 @@ async function main(fileLoc: string) {
|
||||||
|
|
||||||
const groupByThree = (_: unknown, idx: number) => Math.floor(idx / 3);
|
const groupByThree = (_: unknown, idx: number) => Math.floor(idx / 3);
|
||||||
|
|
||||||
const threeGrouped = groupBy(prioritized, groupByThree)
|
const threeGrouped = groupBy(prioritized, groupByThree);
|
||||||
// console.log("threeGrouped", threeGrouped);
|
// console.log("threeGrouped", threeGrouped);
|
||||||
const badges = toGroupPair(threeGrouped)
|
const badges = toGroupPair(threeGrouped)
|
||||||
.map(([_, group]) => group)
|
.map(([_, group]) => group)
|
||||||
|
@ -73,4 +73,3 @@ if (Deno.args.length < 1) {
|
||||||
|
|
||||||
const fileLoc = Deno.args[0];
|
const fileLoc = Deno.args[0];
|
||||||
await main(fileLoc);
|
await main(fileLoc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue