diff --git a/lib/internal/validators.js b/lib/internal/validators.js index 6abe332fc5fdc0..9bca0aa747725e 100644 --- a/lib/internal/validators.js +++ b/lib/internal/validators.js @@ -229,6 +229,11 @@ const validateFunction = hideStackFrames((value, name) => { throw new ERR_INVALID_ARG_TYPE(name, 'Function', value); }); +const validateUndefined = hideStackFrames((value, name) => { + if (value !== undefined) + throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value); +}); + module.exports = { isInt32, isUint32, @@ -247,6 +252,7 @@ module.exports = { validateSignalName, validateString, validateUint32, + validateUndefined, validateCallback, validateAbortSignal, };