Skip to content

Commit aecbe36

Browse files
cjihrigBethGriggs
authored andcommitted
vm: simplify Script constructor options validation
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>
1 parent 0ceab2f commit aecbe36

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/vm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class Script extends ContextifyScript {
4545
code = `${code}`;
4646
if (typeof options === 'string') {
4747
options = { filename: options };
48-
}
49-
if (typeof options !== 'object' || options === null) {
48+
} else if (typeof options !== 'object' || options === null) {
5049
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
5150
}
5251

0 commit comments

Comments
 (0)