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

Function executeDataCode

src/analysis/code.ts:17–34  ·  view source on GitHub ↗
(
  data: any[],
  code: string
)

Source from the content-addressed store, hash-verified

15 * In production, consider using a more robust sandboxing solution.
16 */
17export async function executeDataCode(
18 data: any[],
19 code: string
20): Promise<any> {
21 try {
22 // Execute code with data and helper functions
23 const func = new Function('data', 'stat', `
24 ${code}
25 return result;
26 `);
27
28 const result = func(data, stat);
29
30 return result;
31 } catch (error) {
32 throw new Error(`Failed to execute data code: ${error instanceof Error ? error.message : String(error)}`);
33 }
34}
35
36/**
37 * Generate JavaScript code from natural language using LLM

Callers 2

analysisMethod · 0.90
analysis.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected