From 7527109eabae44e1eda1281376ff344f23d16d9d 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 This commit combines two related if statements into an if-else statement. --- 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); }