MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / wrapCallableBody

Function wrapCallableBody

packages/kernel/core/src/code-recovery.ts:15–22  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

13};
14
15const wrapCallableBody = (source: string): string =>
16 [
17 "const __fn = (",
18 source,
19 ");",
20 `if (typeof __fn !== "function") throw new Error(${JSON.stringify(CALLABLE_ERROR)});`,
21 "return await __fn();",
22 ].join("\n");
23
24const wrapNamedFunctionBody = (source: string, name: string): string =>
25 [source, `return await ${name}();`].join("\n");

Callers 3

renderExportDefaultBodyFunction · 0.70
renderParsedBodyFunction · 0.70
renderHeuristicBodyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected