From 52ee55a06b9c8842045d6fb3b95f06939cc79078 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 14 Dec 2018 22:12:37 -0500 Subject: 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(-) (limited to 'lib/vm.js') diff --git a/lib/vm.js b/lib/vm.js index 0cccd284bf..f7444764ed 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); } -- cgit v1.2.3