Function: createSandboxedExec() — Kata docs
Kata docs

kata-framework


Function: createSandboxedExec()

function createSandboxedExec(code, maxIterations?): (ctx) => void;

Defined in: packages/kata-core/src/runtime/evaluator.ts:147

Creates a sandboxed exec function for [exec] blocks.

  • Blocked globals are shadowed as undefined
  • Loop iteration is guarded against infinite loops
  • ctx is expected to be a null-prototype object (caller responsibility)

Parameters

code

string

The exec block code

maxIterations?

number = 100_000

Maximum loop iterations before throwing (default 100_000)

Returns

A function that accepts (ctx) and executes the code

(ctx) => void