-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 700 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (27 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const dayOne = require('./day-1/solution');
const dayTwo = require('./day-2/solution');
const dayThree = require('./day-3/solution');
const arguments = process.argv.slice(2);
const adventOfCode = {
dayOne: function () {
return dayOne.solve();
},
dayTwo: function () {
return dayTwo.solve();
},
dayThree: function () {
return dayThree.solve();
}
};
if (arguments.length === 0) {
const solutions = {};
Object.keys(adventOfCode).forEach(key => {
solutions[key] = adventOfCode[key]();
});
console.log(solutions);
} else {
const solution = {};
const dayArgument = arguments[0];
solution[dayArgument] = adventOfCode[dayArgument]();
console.log(solution);
}