-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (33 loc) · 1.02 KB
/
app.js
File metadata and controls
33 lines (33 loc) · 1.02 KB
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
33
import { plugChallenges, NoChallenge } from "impact-of-code";
const MainName = "Main Challenge",
SideName = "Side Challenge",
DaysNumber = 1;
export default function () {
let main = [],
side = [];
for (let i = 1; i <= DaysNumber; i++) {
main.push(
import(`./challenges/Day${i}/${MainName}.js`)
.then((IoClass) => IoClass.default)
.catch(() => {
throw new NoChallenge(`Main Challenge${i}`);
})
);
side.push(
import(`./challenges/Day${i}/${SideName}.js`)
.then((IoClass) => IoClass.default)
.catch(() => {
throw new NoChallenge(`Side Challenge${i}`);
})
);
}
return Promise.all([Promise.all(main), Promise.all(side)])
.then(([main, side]) => {
plugChallenges({ main, side });
return true;
})
.catch((e) => {
console.error(e);
return false;
});
}