From 8167444f0061ba0b7dcb2372931dcf3c730966c7 Mon Sep 17 00:00:00 2001 From: pegasust Date: Sat, 3 Dec 2022 09:56:55 +0000 Subject: [PATCH] format d3 --- 2022/d3/src/d3_deno.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/2022/d3/src/d3_deno.ts b/2022/d3/src/d3_deno.ts index 014bb0c..5d7091f 100755 --- a/2022/d3/src/d3_deno.ts +++ b/2022/d3/src/d3_deno.ts @@ -37,7 +37,7 @@ async function main(fileLoc: string) { const setDiff = (a: Set, b: Set) => new Set([...a].filter((e) => !b.has(e))); const setRetain = (a: Set, b: Set) => - new Set([...a].filter(e => b.has(e))) + new Set([...a].filter((e) => b.has(e))); const groupBy = (arr: T[], groupFn: (e: T, idx: number) => K) => { return arr.reduce>((ret, e, idx) => { @@ -52,8 +52,8 @@ async function main(fileLoc: string) { Array.from(groupMap.entries()); const groupByThree = (_: unknown, idx: number) => Math.floor(idx / 3); - - const threeGrouped = groupBy(prioritized, groupByThree) + + const threeGrouped = groupBy(prioritized, groupByThree); // console.log("threeGrouped", threeGrouped); const badges = toGroupPair(threeGrouped) .map(([_, group]) => group) @@ -62,7 +62,7 @@ async function main(fileLoc: string) { .reduce((left, right) => setRetain(left, right)) ).map((e) => [...e][0]); // get the only element in the set for each group - console.log('part 2:', badges.reduce((a,b)=>a+b)); + console.log('part 2:', badges.reduce((a, b) => a + b)); } if (Deno.args.length < 1) { @@ -73,4 +73,3 @@ if (Deno.args.length < 1) { const fileLoc = Deno.args[0]; await main(fileLoc); -