From ce5fe0f4a342ba073a8d88ba42e20395ac92df26 Mon Sep 17 00:00:00 2001 From: wieerwill Date: Tue, 12 Dec 2023 20:43:09 +0100 Subject: [PATCH] lint ts correctly --- Day12/ts/solution.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Day12/ts/solution.ts b/Day12/ts/solution.ts index d4d2c18..fd7e59b 100644 --- a/Day12/ts/solution.ts +++ b/Day12/ts/solution.ts @@ -11,7 +11,8 @@ function readData(filePath: string): string[] { } function unfoldRecord(record: string): [string, number[]] { - let [dots, blockStr] = record.split(' '); + let [dots] = record.split(' '); + const [, blockStr] = record.split(' '); dots = Array(5).fill(dots).join('?'); const blocks = blockStr.split(',').map(Number); const unfoldedBlocks = Array(5).fill(blocks).flat(); @@ -35,7 +36,7 @@ function countArrangements(dots: string, blocks: number[], i: number = 0, bi: nu } let ans = 0; - for (let c of ['.', '#']) { + for (const c of ['.', '#']) { if (dots[i] === c || dots[i] === '?') { if (c === '.') { if (current === 0) { @@ -55,9 +56,9 @@ function countArrangements(dots: string, blocks: number[], i: number = 0, bi: nu function solvePuzzle(lines: string[]): number { let total = 0; - for (let line of lines) { + for (const line of lines) { console.log(`Processing: ${line}`); - let [dots, blocks] = unfoldRecord(line); + const [dots, blocks] = unfoldRecord(line); total += countArrangements(dots, blocks); } return total;