http-party / node-portfinder

A simple tool to find an open port or domain socket on the current machine
https://github.com/http-party/node-portfinder
Other
887 stars 95 forks source link

Fix adding options.host to defaultHosts list #148

Open MasterOdin opened 1 year ago

MasterOdin commented 1 year ago

PR fixes a bug reported in https://github.com/http-party/node-portfinder/pull/120#issuecomment-1502633024, where the current indexOf check will only succeed if options.host was already in exports._defaultHosts, as opposed to the desired behavior of appending it if it's not in the array.

I've also cleaned up the nested conditional to just be one level as the nesting was not necessary.