2024-08-01 10:01:57 +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,
);
};