-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (29 loc) · 795 Bytes
/
index.js
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
34
35
36
37
const {
getInput,
closeInput
} = require('./modules/input');
const menuText = 'Digite o numero do exercicio que deseja executar (1-5) ou digite 0 para sair:\n'
const possibleOptions = {
'1':require('./modules/n1'),
'2':require('./modules/n2'),
'3':require('./modules/n3'),
'4':require('./modules/n4'),
'5':require('./modules/n5')
}
async function parseOption (option) {
if(!Object.keys(possibleOptions).includes(option)) {
console.log('Essa opção não é válida!');
return;
}
const output = await possibleOptions[option]();
console.log('output:', output, '\n');
}
async function main () {
let option = await getInput(menuText);
while(option !== '0'){
await parseOption(option);
option = await getInput(menuText);
}
closeInput();
}
main();