(
isolated: string,
names: readonly string[],
params: Record<string, unknown> = {}
)
| 34 | |
| 35 | /** runs isolated code, returning the values of the names it declares */ |
| 36 | export 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 | |
| 47 | export const executeCode = (code: string): ExecutionResult => { |
| 48 | try { |
no outgoing calls
no test coverage detected