diff --git a/src/Util.js b/src/Util.js index 1dc85e8..34688f1 100644 --- a/src/Util.js +++ b/src/Util.js @@ -72,16 +72,11 @@ module.exports.checkPlatformExact = async function () { }; module.exports.checkAppropriatePort = function(port) { - if (typeof port !== "number") { - throw new Error("The port must be type of number."); - }; + const portLimit = Math.round(2 ** 16 - 1); - let portLimit = Math.round(2 ** 16 - 1); - if (port <= 0 || port > portLimit) { - throw new Error("Exceeded port limit."); - }; + if (typeof port !== "number") throw new Error("The port must be type of number."); - return true; + return (port > 0 || port <= portLimit) ? true : false; }; module.exports.checkAppropriateIP = function(address) {