Skip to content

Commit 4174f13

Browse files
VoltrexKeyvadanielleadams
authored andcommitted
net: use missing validator
The `net` lib module's `lookupAndConnect()` function is missing a validator. PR-URL: #38984 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
1 parent 10370c5 commit 4174f13

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/net.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const {
102102
const { isUint8Array } = require('internal/util/types');
103103
const {
104104
validateAbortSignal,
105+
validateFunction,
105106
validateInt32,
106107
validateNumber,
107108
validatePort,
@@ -1002,10 +1003,8 @@ function lookupAndConnect(self, options) {
10021003
return;
10031004
}
10041005

1005-
if (options.lookup && typeof options.lookup !== 'function')
1006-
throw new ERR_INVALID_ARG_TYPE('options.lookup',
1007-
'Function', options.lookup);
1008-
1006+
if (options.lookup !== undefined)
1007+
validateFunction(options.lookup, 'options.lookup');
10091008

10101009
if (dns === undefined) dns = require('dns');
10111010
const dnsopts = {

0 commit comments

Comments
 (0)