import jsep from 'jsep'; /** * Evaluation code from JSEP project, under MIT License. * Copyright (c) 2013 Stephen Oney, http://jsep.from.so/ */ export declare type Context = Record; export declare type operand = any; export declare type unaryCallback = (a: operand) => operand; export declare type binaryCallback = (a: operand, b: operand) => operand; export declare type assignCallback = (obj: Record, key: string, val: operand) => operand; export declare type evaluatorCallback = (this: ExpressionEval, node: T, context?: Context) => unknown; export declare type AnyExpression = jsep.Expression; export declare type JseEvalPlugin = Partial & { initEval?: (this: typeof ExpressionEval, jseEval: typeof ExpressionEval) => void; }; export default class ExpressionEval { static jsep: typeof jsep; static parse: typeof jsep; static evaluate: typeof ExpressionEval.eval; static evaluators: Record>; static DEFAULT_PRECEDENCE: Record; static binops: Record; static unops: Record; static assignOps: Record; static addUnaryOp(operator: string, _function: unaryCallback): void; static addBinaryOp(operator: string, precedence_or_fn: number | binaryCallback, _ra_or_callback?: boolean | binaryCallback, _function?: binaryCallback): void; static addEvaluator(nodeType: string, evaluator: evaluatorCallback): void; static registerPlugin(...plugins: Array): void; static eval(ast: jsep.Expression, context?: Context): unknown; static evalAsync(ast: jsep.Expression, context?: Context): Promise; static compile(expression: string): (context?: Context) => unknown; static compileAsync(expression: string): (context?: Context) => Promise; static evalExpr(expression: string, context?: Context): unknown; static evalExprAsync(expression: string, context?: Context): unknown; context?: Context; isAsync?: boolean; constructor(context?: Context, isAsync?: boolean); eval(node: unknown, cb?: (v: any) => any): unknown; evalSyncAsync(val: unknown, cb: (unknown: any) => unknown): Promise | unknown; private evalArrayExpression; protected evalArray(list: jsep.Expression[]): unknown[]; private evalBinaryExpression; private evalCompoundExpression; private evalCallExpression; protected evalCall(callee: jsep.Expression): unknown; private evalConditionalExpression; private evalIdentifier; private static evalLiteral; private evalMemberExpression; private evaluateMember; private evalThisExpression; private evalUnaryExpression; private evalArrowFunctionExpression; private evalArrowContext; private evalAssignmentExpression; private evalUpdateExpression; private evalAwaitExpression; private static evalUpdateOperation; private getContextAndKey; private evalNewExpression; private evalObjectExpression; private evalSpreadElement; private evalTaggedTemplateExpression; private evalTemplateLiteral; protected static construct(ctor: () => unknown, args: unknown[], node: jsep.CallExpression | jsep.Expression): unknown; protected static validateFnAndCall(fn: () => unknown, callee?: AnyExpression, caller?: AnyExpression): [() => unknown, AnyExpression]; protected static nodeFunctionName(callee: AnyExpression): string; } /** NOTE: exporting named + default. * For CJS, these match the static members of the default export, so they still work. */ export { default as jsep, default as parse } from 'jsep'; export declare const DEFAULT_PRECEDENCE: Record; export declare const evaluators: Record>; export declare const binops: Record; export declare const unops: Record; export declare const assignOps: Record; export declare const addUnaryOp: typeof ExpressionEval.addUnaryOp; export declare const addBinaryOp: typeof ExpressionEval.addBinaryOp; export declare const addEvaluator: typeof ExpressionEval.addEvaluator; export declare const registerPlugin: typeof ExpressionEval.registerPlugin; export declare const evaluate: typeof ExpressionEval.eval; export declare const evalAsync: typeof ExpressionEval.evalAsync; export declare const compile: typeof ExpressionEval.compile; export declare const compileAsync: typeof ExpressionEval.compileAsync; export declare const evalExpr: typeof ExpressionEval.evalExpr; export declare const evalExprAsync: typeof ExpressionEval.evalExprAsync;