MCPcopy Create free account
hub / github.com/nodejs/node / wrapScriptInEvalWorker

Function wrapScriptInEvalWorker

test/es-module/test-esm-import-meta-main-eval.mjs:6–11  ·  view source on GitHub ↗
(script)

Source from the content-addressed store, hash-verified

4import { describe, it } from 'node:test';
5
6function wrapScriptInEvalWorker(script) {
7 return `
8 import { Worker } from 'node:worker_threads';
9 new Worker(${JSON.stringify(script)}, { eval: true });
10 `;
11}
12
13function convertScriptSourceToDataUrl(script) {
14 return new URL(`data:text/javascript,${encodeURIComponent(script)}`);

Calls

no outgoing calls

Tested by

no test coverage detected