mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
dns: use ternary operator simplify statement
PR-URL: https://github.com/nodejs/node/pull/33234 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
1 parent
032c64f1e4
commit
10b88cb117
1 file changed
+2
-10
@@ -67,11 +67,7 @@ function createLookupPromise(family, hostname, all, hints, verbatim) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!hostname) {
|
||||
emitInvalidHostnameWarning(hostname);
|
||||
if (all)
|
||||
resolve([]);
|
||||
else
|
||||
resolve({ address: null, family: family === 6 ? 6 : 4 });
|
||||
|
||||
resolve(all ? [] : { address: null, family: family === 6 ? 6 : 4 });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,11 +75,7 @@ function createLookupPromise(family, hostname, all, hints, verbatim) {
|
||||
|
||||
if (matchedFamily !== 0) {
|
||||
const result = { address: hostname, family: matchedFamily };
|
||||
if (all)
|
||||
resolve([result]);
|
||||
else
|
||||
resolve(result);
|
||||
|
||||
resolve(all ? [result] : result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user