Skip to content

Commit

Permalink
vm: simplify Script constructor options validation
Browse files Browse the repository at this point in the history
This commit combines two related if statements into an
if-else statement.

PR-URL: #25054
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
cjihrig authored and Trott committed Dec 17, 2018
1 parent 8dfd757 commit 52ee55a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/vm.js
Expand Up @@ -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);
}

Expand Down

0 comments on commit 52ee55a

Please sign in to comment.