Skip to content

Commit

Permalink
🐙🍛 Updated with Glitch: npm audit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Glitch (branch-three-oviraptor) committed Dec 1, 2023
1 parent 16658b8 commit 49c2e63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions public/funs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
part2: (data) => {
const matchD = /one|two|three|four|five|six|seven|eight|nine/g;
const digitVal = { 'one':1, 'two':2, 'three':3, 'four':4, 'five':5, 'six':6, 'seven':7, 'eight':8, 'nine':9 };
data = data.trim().replace(matchD, m => digitVal[m]);
console.log(data);
const left = /^\D*?(\d)/;
const right = /(\d)\D*?$/;
const elves = data.split('\n').map(cals => {
const left = /^\D*(\d)/;
const right = /(\d)\D*$/;
const elves = data.trim().split('\n').map(cals => {
cals = cals.replace(matchD, m => digitVal[m]);
return cals.match(left)[1] + '' + cals.match(right)[1];
}).map(Number);
console.log(elves);
// 54558 is too low
// 54558
return elves.reduce((acc, item) => {
return acc + item;
}, 0);
Expand Down

0 comments on commit 49c2e63

Please sign in to comment.