diff --git a/lib/portfinder.js b/lib/portfinder.js index 2bc65e2..0ab2f3e 100644 --- a/lib/portfinder.js +++ b/lib/portfinder.js @@ -141,10 +141,8 @@ exports.getPort = function (options, callback) { } } - if (options.host) { - if (exports._defaultHosts.indexOf(options.host) !== -1) { - exports._defaultHosts.push(options.host) - } + if (options.host && exports._defaultHosts.indexOf(options.host) === -1) { + exports._defaultHosts.push(options.host) } var openPorts = [], currentHost;