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

Function sliceNode

packages/kernel/core/src/code-recovery.ts:29–39  ·  view source on GitHub ↗
(
  source: string,
  node: {
    start?: number | null;
    end?: number | null;
  },
)

Source from the content-addressed store, hash-verified

27const wrapAnonymousFunctionBody = (source: string): string => `return await (${source})();`;
28
29const sliceNode = (
30 source: string,
31 node: {
32 start?: number | null;
33 end?: number | null;
34 },
35): string => {
36 const start = node.start ?? 0;
37 const end = node.end ?? source.length;
38 return source.slice(start, end);
39};
40
41const unwrapExpression = (expression: { type: string; expression?: unknown }): unknown => {
42 switch (expression.type) {

Callers 1

renderExportDefaultBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected