MCPcopy Create free account
hub / github.com/antvis/AVA / executeCode

Function executeCode

src/interpreter/javascript/sandbox.ts:79–93  ·  view source on GitHub ↗
(data: any[], code: string)

Source from the content-addressed store, hash-verified

77 * The code must assign its final output to a variable named `result`.
78 */
79export async function executeCode(data: any[], code: string): Promise<any> {
80 try {
81 if (typeof document === 'undefined') {
82 return await executeInNode(data, code);
83 }
84
85 return await executeInBrowser(data, code);
86 } catch (error) {
87 const rawMessage = error instanceof Error ? error.message : String(error);
88 const message = rawMessage.startsWith('Failed to execute data code:')
89 ? rawMessage
90 : `Failed to execute data code: ${rawMessage.replace(/^Error:\s*/, '')}`;
91 throw new Error(message);
92 }
93}

Callers 2

executeMethod · 0.90
sandbox.test.tsFile · 0.90

Calls 2

executeInNodeFunction · 0.85
executeInBrowserFunction · 0.85

Tested by

no test coverage detected