aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/dns.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-10-13 17:57:43 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-10-13 17:57:43 -0700
commitd7062eb36797f50267004b61743ce076aa56c240 (patch)
treeddc45cbbad30295da1af2fe5593e1bd1573a28fb /src/js/node/dns.js
parent851dc9aadc3a419470ce5023863df568443577ae (diff)
downloadbun-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.js15
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;
}