@@ -14,6 +14,7 @@ const {
14
14
validateTimeout,
15
15
validateTries,
16
16
emitInvalidHostnameWarning,
17
+ emitTypeCoercionDeprecationWarning,
17
18
getDefaultVerbatim,
18
19
} = require ( 'internal/dns/utils' ) ;
19
20
const { codes, dnsException } = require ( 'internal/errors' ) ;
@@ -110,15 +111,29 @@ function lookup(hostname, options) {
110
111
if ( hostname && typeof hostname !== 'string' ) {
111
112
throw new ERR_INVALID_ARG_TYPE ( 'hostname' , 'string' , hostname ) ;
112
113
} else if ( options !== null && typeof options === 'object' ) {
114
+ if ( options . hints != null && typeof options . hints !== 'number' ) {
115
+ emitTypeCoercionDeprecationWarning ( ) ;
116
+ }
113
117
hints = options . hints >>> 0 ;
118
+ if ( options . family != null && typeof options . family !== 'number' ) {
119
+ emitTypeCoercionDeprecationWarning ( ) ;
120
+ }
114
121
family = options . family >>> 0 ;
122
+ if ( options . all != null && typeof options . all !== 'boolean' ) {
123
+ emitTypeCoercionDeprecationWarning ( ) ;
124
+ }
115
125
all = options . all === true ;
116
126
if ( typeof options . verbatim === 'boolean' ) {
117
127
verbatim = options . verbatim === true ;
128
+ } else if ( options . verbatim != null ) {
129
+ emitTypeCoercionDeprecationWarning ( ) ;
118
130
}
119
131
120
132
validateHints ( hints ) ;
121
133
} else {
134
+ if ( options != null && typeof options !== 'number' ) {
135
+ emitTypeCoercionDeprecationWarning ( ) ;
136
+ }
122
137
family = options >>> 0 ;
123
138
}
124
139
0 commit comments