MCPcopy Create free account
hub / github.com/arktypeio/arktype / executeCode

Function executeCode

ark/docs/components/playground/execute.ts:47–69  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

45 )(...Object.values(params))
46
47export const executeCode = (code: string): ExecutionResult => {
48 try {
49 const {
50 [playgroundTypeVariableName]: parsed,
51 [playgroundOutVariableName]: traversed
52 } = evaluate(isolate(code), [
53 playgroundTypeVariableName,
54 playgroundOutVariableName
55 ])
56
57 return {
58 parsed: parsed as ParseResult,
59 traversed: traversed as TraverseResult,
60 js: code
61 }
62 } catch (e) {
63 return {
64 parsed:
65 e instanceof Error ? e : new ReferenceError(playgroundTypeVariableName),
66 traversed: unset
67 }
68 }
69}

Callers 2

PlaygroundFunction · 0.90
precompile.test.tsFile · 0.85

Calls 2

evaluateFunction · 0.70
isolateFunction · 0.70

Tested by

no test coverage detected