diff --git a/lib/vm.js b/lib/vm.js index 0cccd284bfc758..f7444764ed5c3f 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -44,8 +44,7 @@ class Script extends ContextifyScript { code = `${code}`; if (typeof options === 'string') { options = { filename: options }; - } - if (typeof options !== 'object' || options === null) { + } else if (typeof options !== 'object' || options === null) { throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); }