MCPcopy
hub / github.com/TypeStrong/ts-node / runInContext

Function runInContext

src/repl.ts:669–677  ·  view source on GitHub ↗

* Low-level execution of JS code in context

(code: string, filename: string, context?: Context)

Source from the content-addressed store, hash-verified

667 * Low-level execution of JS code in context
668 */
669function runInContext(code: string, filename: string, context?: Context) {
670 const script = new Script(code, { filename });
671
672 if (context === undefined || context === global) {
673 return script.runInThisContext();
674 } else {
675 return script.runInContext(context);
676 }
677}
678
679/**
680 * Append to the eval instance and return an undo function.

Callers 2

resetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…