Skip to content

Commit 8d953b7

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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 33a907d commit 8d953b7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/vm.js

+1-2
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)