Skip to content

Commit 4b8896c

Browse files
committed
dns: cleanup validation
The `validateString()` validator should cleanup the validation and keep consistency.
1 parent a42bd7e commit 4b8896c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/internal/dns/utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ class Resolver {
131131
setLocalAddress(ipv4, ipv6) {
132132
validateString(ipv4, 'ipv4');
133133

134-
if (typeof ipv6 !== 'string' && ipv6 !== undefined) {
135-
throw new ERR_INVALID_ARG_TYPE('ipv6', ['String', 'undefined'], ipv6);
136-
}
134+
if (ipv6 !== undefined)
135+
validateString(ipv6, 'ipv6');
137136

138137
this._handle.setLocalAddress(ipv4, ipv6);
139138
}

0 commit comments

Comments
 (0)