From 74e08c0458e6df112394e9f777d468a240c32180 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 14 Dec 2018 22:12:37 -0500 Subject: [PATCH] vm: simplify Script constructor options validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit combines two related if statements into an if-else statement. PR-URL: https://github.com/nodejs/node/pull/25054 Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca --- lib/vm.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); }