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 <[email protected]> Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
1 parent 10370c5 commit 4174f13

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎lib/net.js‎

Lines changed: 3 additions & 4 deletions
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&&typeofoptions.lookup!=='function')
1006-
thrownewERR_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
constdnsopts={

0 commit comments

Comments
(0)