UNPKG

ghom-eval

Version:
40 lines (39 loc) 1.09 kB
import * as util from "util"; import * as prettier from "prettier"; import typescript from "typescript"; export interface Evaluated { class: string; type: string; input: string; output: string; duration: number; evaluated: string; failed: boolean; } export interface EvaluateOptions { /** * The context object to pass to the evaluated code. */ ctx?: any; /** * The name of the context object in the evaluated code. */ ctxName?: string; /** * The language of the code to evaluate. */ lang?: "ts" | "js" | "typescript" | "javascript"; /** * The options to pass to Prettier for formatting the output. */ prettierOptions?: prettier.Options; /** * The options to pass to `util.inspect` for formatting the objects output. */ inspectOptions?: util.InspectOptions; /** * The options to pass to the TypeScript compiler. */ compilerOptions?: typescript.CompilerOptions; } export declare function evaluate(code: string, options?: EvaluateOptions): Promise<Evaluated>;