diff options
author | 2023-10-13 17:57:43 -0700 | |
---|---|---|
committer | 2023-10-13 17:57:43 -0700 | |
commit | d7062eb36797f50267004b61743ce076aa56c240 (patch) | |
tree | ddc45cbbad30295da1af2fe5593e1bd1573a28fb /src/js/node/dns.js | |
parent | 851dc9aadc3a419470ce5023863df568443577ae (diff) | |
download | bun-d7062eb36797f50267004b61743ce076aa56c240.tar.gz bun-d7062eb36797f50267004b61743ce076aa56c240.tar.zst bun-d7062eb36797f50267004b61743ce076aa56c240.zip |
[node:dns] Fix unnecessary array creation + prettier
Diffstat (limited to 'src/js/node/dns.js')
-rw-r--r-- | src/js/node/dns.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/js/node/dns.js b/src/js/node/dns.js index bb59e702f..e82e6a4b5 100644 --- a/src/js/node/dns.js +++ b/src/js/node/dns.js @@ -19,15 +19,12 @@ function lookup(domain, options, callback) { options = { family: options }; } - const invalidDomainValues = [ - undefined, - false, - null, - "" - ]; - - if(Number.isNaN(domain) || invalidDomainValues.some(value => domain === value)) { - console.warn(`DeprecationWarning: The provided hostname "${String(domain)}" is not a valid hostname, and is supported in the dns module solely for compatibility.`); + if (domain !== domain || (typeof domain !== "number" && !domain)) { + console.warn( + `DeprecationWarning: The provided hostname "${String( + domain, + )}" is not a valid hostname, and is supported in the dns module solely for compatibility.`, + ); callback(null, null, 4); return; } |