Optional
options: { Optional
context: objectOptional
options: ExecuteOptionsconst context = { counter: 0 };
const code = 'return context.coounter++;';
const compiledFn = compileFunction(code, { mode: 'sandbox' });
expect(compiledFn(context, true)).toBe(1);
expect(context.counter).toBe(1);
@param code JS code @param options specifies how to compile the function @returns
Compiles the specified code as sandboxed function. The compiled function can be executed with a context object. Optionally the context object can be mutable, allowing the compiled code to modify the context object.