Shortened the code with a ternary

This commit is contained in:
2022-01-06 14:26:30 +00:00
parent ca5e79ccf3
commit 1d3c94a1aa
+5 -17
View File
@@ -45,26 +45,14 @@ impelented are:
See https://github.com/krgamestudios/MERN-template/wiki for help. See https://github.com/krgamestudios/MERN-template/wiki for help.
` `
); );
//determine local computer address for mac user vs everyone else //determine local computer address for mac user vs everyone else
let macQuestion = ''; let macUser = '';
while (macQuestion !== true && macQuestion !== false) { while (macUser.toLowerCase() !== 'yes' && macUser.toLowerCase() !== 'no') {
macQuestion = await question('Will the MERN Template be running locally on a MacOS system? (yes or no)', ''); macUser = await question('Will the MERN Template be running locally on a MacOS system? (yes or no)', '');
if (macQuestion.toLowerCase() === 'yes') {
macQuestion = true;
}
else if (macQuestion.toLowerCase() === 'no') {
macQuestion = false;
}
} }
const macUser = macQuestion; const localAddress = macUser ? 'localhost' : '%';
let localComputerAddress = '%';
if (macUser === true) {
localComputerAddress = 'localhost';
}
const localAddress = localComputerAddress;
//project configuration //project configuration
const projectName = await question('Project Name', 'template'); const projectName = await question('Project Name', 'template');