- Stick to the
days\<day#>\<part#>.jsstructure - Create your
inputfile (no extension) in the day directory - Write this in your terminal to start
$ npm run start day# part#For day 1 / part 1 that would be npm run start 1 1
To get the input data in your code you can use the global inputFile function
const data = inputFile();This will return an array of the input data split by newline. If you want more control you can do that in multiple ways
// Split by ":"
const data = inputFile('input', ':');
// Don't split, return as String
const data = inputFile('input', false);
// If file name is different than "input"
const data = inputFile('input2');All service files are injected globally as the name the function is exported as.
// services/addOne.js
export function addOne() { ... }
// This would be globally available in your code as "addOne"