Skip to content

Commit

Permalink
dns: cleanup validation
Browse files Browse the repository at this point in the history
The `validateString()` validator should cleanup the validation and
keep consistency.
  • Loading branch information
VoltrexKeyva committed Sep 10, 2021
1 parent a42bd7e commit 4b8896c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/internal/dns/utils.js
Expand Up @@ -131,9 +131,8 @@ class Resolver {
setLocalAddress(ipv4, ipv6) {
validateString(ipv4, 'ipv4');

if (typeof ipv6 !== 'string' && ipv6 !== undefined) {
throw new ERR_INVALID_ARG_TYPE('ipv6', ['String', 'undefined'], ipv6);
}
if (ipv6 !== undefined)
validateString(ipv6, 'ipv6');

this._handle.setLocalAddress(ipv4, ipv6);
}
Expand Down

0 comments on commit 4b8896c

Please sign in to comment.