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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
cjihrig authored and MylesBorins committed Dec 25, 2018
1 parent 85a1369 commit 74e08c0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/vm.js
Original file line number Diff line number Diff line change
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 74e08c0

Please sign in to comment.