Skip to content

Commit 360f740

Browse files
cjihrigrefack
authored andcommitted
vm: simplify Script constructor options validation
This commit combines two related if statements into an if-else statement. PR-URL: nodejs#25054 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 63ee352 commit 360f740

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/vm.js

Lines changed: 1 addition & 2 deletions
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)