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.
`
);
//determine local computer address for mac user vs everyone else
let macQuestion = '';
while (macQuestion !== true && macQuestion !== false) {
macQuestion = 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;
}
let macUser = '';
while (macUser.toLowerCase() !== 'yes' && macUser.toLowerCase() !== 'no') {
macUser = await question('Will the MERN Template be running locally on a MacOS system? (yes or no)', '');
}
const macUser = macQuestion;
let localComputerAddress = '%';
if (macUser === true) {
localComputerAddress = 'localhost';
}
const localAddress = localComputerAddress;
const localAddress = macUser ? 'localhost' : '%';
//project configuration
const projectName = await question('Project Name', 'template');