diff --git a/one/.prettierrc b/one/.prettierrc new file mode 100644 index 0000000..d68aa73 --- /dev/null +++ b/one/.prettierrc @@ -0,0 +1,3 @@ +{ + "arrowParens": "avoid" +} diff --git a/one/one.js b/one/one.js new file mode 100644 index 0000000..22e6393 --- /dev/null +++ b/one/one.js @@ -0,0 +1,13 @@ +import fs from "node:fs"; + +let data = fs.readFileSync("input", "utf8"); + +let lines = data + .split("\n") + .map(l => l.split("").filter(c => +c == c)) + .map(l => [l[0], l[l.length - 1]]) + .map(l => l.join("")) + .map(n => Number(n)) + .reduce((acc, n) => acc + n); + +console.log(lines); diff --git a/one/package.json b/one/package.json new file mode 100644 index 0000000..5666488 --- /dev/null +++ b/one/package.json @@ -0,0 +1,12 @@ +{ + "name": "one", + "version": "1.0.0", + "description": "", + "main": "one.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "type": "module" +}