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

Function evaluate

ark/docs/components/playground/execute.ts:36–45  ·  view source on GitHub ↗
(
	isolated: string,
	names: readonly string[],
	params: Record<string, unknown> = {}
)

Source from the content-addressed store, hash-verified

34
35/** runs isolated code, returning the values of the names it declares */
36export const evaluate = (
37 isolated: string,
38 names: readonly string[],
39 params: Record<string, unknown> = {}
40): Record<string, unknown> =>
41 new Function(
42 ...Object.keys(params),
43 `${isolated}
44 return { ${names.join(", ")} }`
45 )(...Object.values(params))
46
47export const executeCode = (code: string): ExecutionResult => {
48 try {

Callers 3

writePrecompiledFunction · 0.90
executeCodeFunction · 0.70
compileFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected