Skip to content

Commit 74e08c0

Browse files
cjihrigMylesBorins
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 85a1369 commit 74e08c0

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
@@ -44,8 +44,7 @@ class Script extends ContextifyScript {
4444
code = `${code}`;
4545
if (typeof options === 'string') {
4646
options = { filename: options };
47-
}
48-
if (typeof options !== 'object' || options === null) {
47+
} else if (typeof options !== 'object' || options === null) {
4948
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
5049
}
5150

0 commit comments

Comments
 (0)