diff --git a/lib/net.js b/lib/net.js index 4b55366f87dae0..899e73f6ff167d 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 = {