vm: simplify Script constructor options validation
This commit combines two related if statements into an if-else statement. PR-URL: https://github.com/nodejs/node/pull/25054 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
8dfd757337
commit
52ee55a06b
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user