Remove unnecessary lines, for better test coverage
This commit is contained in:
@@ -4,10 +4,6 @@ export function solveFirst(input: string): number {
|
|||||||
const regex = /^.*?(\d).*(\d).*?$|^.*(\d).*$/gm;
|
const regex = /^.*?(\d).*(\d).*?$|^.*(\d).*$/gm;
|
||||||
const match = input.matchAll(regex);
|
const match = input.matchAll(regex);
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const numbers = Array.from(match, (m) =>
|
const numbers = Array.from(match, (m) =>
|
||||||
Number(m[3] ? `${m[3]}${m[3]}` : `${m[1]}${m[2]}`)
|
Number(m[3] ? `${m[3]}${m[3]}` : `${m[1]}${m[2]}`)
|
||||||
);
|
);
|
||||||
@@ -41,10 +37,6 @@ export function solveSecond(input: string): number {
|
|||||||
/^.*?(one|two|three|four|five|six|seven|eight|nine|\d).*(one|two|three|four|five|six|seven|eight|nine|\d).*?$|^.*(one|two|three|four|five|six|seven|eight|nine|\d).*$/gm;
|
/^.*?(one|two|three|four|five|six|seven|eight|nine|\d).*(one|two|three|four|five|six|seven|eight|nine|\d).*?$|^.*(one|two|three|four|five|six|seven|eight|nine|\d).*$/gm;
|
||||||
const match = input.matchAll(regex);
|
const match = input.matchAll(regex);
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const numbers = Array.from(match, (m) =>
|
const numbers = Array.from(match, (m) =>
|
||||||
Number(
|
Number(
|
||||||
m[3] ? `${lookup[m[3]]}${lookup[m[3]]}` : `${lookup[m[1]]}${lookup[m[2]]}`
|
m[3] ? `${lookup[m[3]]}${lookup[m[3]]}` : `${lookup[m[1]]}${lookup[m[2]]}`
|
||||||
|
|||||||
+2
-2
@@ -74,8 +74,8 @@ export function solveFirst(input: string): number {
|
|||||||
} while (edgeLength > 3);
|
} while (edgeLength > 3);
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
console.log(`That took ${i} tries`);
|
console.log(`That took ${i} tries, result: `, mult);
|
||||||
console.log(mult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mult;
|
return mult;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user