2024-07-01 19:03:35 +08:00

8 lines
250 B
TypeScript

import { type EvalCodeFunction } from './codeRuntime';
export const evaluate: EvalCodeFunction = (code: string, scope: any) => {
return new Function('scope', `"use strict";return (function(){return (${code})}).bind(scope)();`)(
scope,
);
};