FcompileFunction
Bun

function

vm.compileFunction

function compileFunction(
code: string,
params?: readonly string[],
): Function & Pick<Script, 'cachedData' | 'cachedDataProduced' | 'cachedDataRejected'>;

Compiles the given code into the provided context (if no context is supplied, the current context is used), and returns it wrapped inside a function with the given params.

@param code

The body of the function to compile.

@param params

An array of strings containing all parameters for the function.