this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a little cleanup

+2 -7
+2 -7
2023/day01/part2.ts
··· 37 37 if (digitStr.match(/^\d$/)) return digitStr; 38 38 39 39 const wordIdx = digitWords.indexOf(digitStr); 40 - if (wordIdx !== -1) return (wordIdx + 1).toString(); 41 - 42 - throw new Error(`no digit for match: ${digitStr}`); 40 + return (wordIdx + 1).toString(); 43 41 }); 44 42 45 - if (!digits) throw new Error(`no ints in line: ${line}`); 46 - 47 - const numStr = `${digits[0]}${digits[digits.length - 1]}`; 48 - return parseInt(numStr); 43 + return parseInt(`${digits[0]}${digits[digits.length - 1]}`); 49 44 }; 50 45 51 46 export const answer = (lines: string[]): number =>