Skip to content

Commit f187b44

Browse files
remove unnecessary helper
1 parent 384122c commit f187b44

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/node/vm.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ import type {
5454
MemoryMeasurement,
5555
} from 'node:vm';
5656

57-
/** Validates that, if a timeout option is defined, it must be a strictly positive integer. */
58-
function validateTimeout(timeout: number | undefined): void {
59-
if (timeout !== undefined) {
60-
validateUint32(timeout, 'options.timeout', true);
61-
}
62-
}
63-
6457
export const constants = {
6558
__proto__: null,
6659
USE_MAIN_CONTEXT_DEFAULT_LOADER: Symbol(
@@ -119,7 +112,9 @@ export class Script {
119112
const { breakOnSigint = false, displayErrors = true, timeout } = options;
120113
validateBoolean(breakOnSigint, 'options.breakOnSigint');
121114
validateBoolean(displayErrors, 'options.displayErrors');
122-
validateTimeout(timeout);
115+
if (timeout !== undefined) {
116+
validateUint32(timeout, 'options.timeout', true);
117+
}
123118
throw new ERR_METHOD_NOT_IMPLEMENTED('runInThisContext');
124119
}
125120

@@ -132,7 +127,9 @@ export class Script {
132127
const { breakOnSigint = false, displayErrors = true, timeout } = options;
133128
validateBoolean(breakOnSigint, 'options.breakOnSigint');
134129
validateBoolean(displayErrors, 'options.displayErrors');
135-
validateTimeout(timeout);
130+
if (timeout !== undefined) {
131+
validateUint32(timeout, 'options.timeout', true);
132+
}
136133
throw new ERR_METHOD_NOT_IMPLEMENTED('runInThisContext');
137134
}
138135

0 commit comments

Comments
 (0)