diff options
author | Voltrex <mohammadkeyvanzade94@gmail.com> | 2021-06-10 00:47:12 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-06-15 05:31:04 +0300 |
commit | 4174f139b654ab27da75d27c195603a6d99f8a5e (patch) | |
tree | d70cb7d69f6d22ad9c51deb35b63b8349f2da8ba /lib | |
parent | 10370c5e8a22134c75f82c54e8f042ed2ca18792 (diff) |
net: use missing validator
The `net` lib module's `lookupAndConnect()` function is missing
a validator.
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/net.js b/lib/net.js index 4b55366f87d..899e73f6ff1 100644 --- a/lib/net.js +++ b/lib/net.js @@ -102,6 +102,7 @@ const { const { isUint8Array } = require('internal/util/types'); const { validateAbortSignal, + validateFunction, validateInt32, validateNumber, validatePort, @@ -1002,10 +1003,8 @@ function lookupAndConnect(self, options) { return; } - if (options.lookup && typeof options.lookup !== 'function') - throw new ERR_INVALID_ARG_TYPE('options.lookup', - 'Function', options.lookup); - + if (options.lookup !== undefined) + validateFunction(options.lookup, 'options.lookup'); if (dns === undefined) dns = require('dns'); const dnsopts = { |