MCPcopy Index your code
hub / github.com/nodejs/node / evaluate

Method evaluate

lib/internal/vm/module.js:212–237  ·  view source on GitHub ↗
(options = kEmptyObject)

Source from the content-addressed store, hash-verified

210 }
211
212 evaluate(options = kEmptyObject) {
213 try {
214 validateThisInternalField(this, kWrap, 'Module');
215 validateObject(options, 'options');
216
217 let timeout = options.timeout;
218 if (timeout === undefined) {
219 timeout = -1;
220 } else {
221 validateUint32(timeout, 'options.timeout', true);
222 }
223 const { breakOnSigint = false } = options;
224 validateBoolean(breakOnSigint, 'options.breakOnSigint');
225 const status = this[kWrap].getStatus();
226 if (status !== kInstantiated &&
227 status !== kEvaluated &&
228 status !== kErrored) {
229 throw new ERR_VM_MODULE_STATUS(
230 'must be one of linked, evaluated, or errored',
231 );
232 }
233 return this[kWrap].evaluate(timeout, breakOnSigint);
234 } catch (e) {
235 return PromiseReject(e);
236 }
237 }
238
239 [customInspectSymbol](depth, options) {
240 validateThisInternalField(this, kWrap, 'Module');

Callers 15

evalInCurrentContextFunction · 0.45
setBreakpointFunction · 0.45
versionFunction · 0.45
runMethod · 0.45
runMethod · 0.45
compileSourceTextModuleFunction · 0.45
getESMFacadeMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
listenerFunction · 0.45
listenerFunction · 0.45

Calls

no outgoing calls

Tested by 4

testFunction · 0.36
testFunction · 0.36
testFunction · 0.36
testFunction · 0.36