From 1d3c94a1aadef19057c7bd6611bf063f4d582249 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 6 Jan 2022 14:26:30 +0000 Subject: [PATCH] Shortened the code with a ternary --- configure-script.js | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/configure-script.js b/configure-script.js index 6be832a..65b2d44 100644 --- a/configure-script.js +++ b/configure-script.js @@ -45,28 +45,16 @@ 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; - } - } - const macUser = macQuestion; + //determine local computer address for mac user vs everyone else + 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)', ''); + } - let localComputerAddress = '%'; - if (macUser === true) { - localComputerAddress = 'localhost'; - } + const localAddress = macUser ? 'localhost' : '%'; - const localAddress = localComputerAddress; - - //project configuration + //project configuration const projectName = await question('Project Name', 'template'); const projectWebAddress = await question('Project Web Address', 'example.com');