@cute-dw/core
Version:
This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need
68 lines (67 loc) • 2.09 kB
TypeScript
export declare class CodeBlock {
private _error;
private _expr;
private _ast;
private _bindContext;
private _objFunc;
/**
* @constructor
* @param input String expression to evaluate
* @param bindContext Allow to bind a context object to the `this` keyword in the object's methods (if defined)
*/
constructor(input: string | null, bindContext?: boolean);
/**
* @readonly
*/
get error(): string | null;
/**
* @readonly
*/
get expression(): string | null;
/**
* @readonly
*/
get bindContext(): boolean;
/**
* Evaluates expression on specified context object
* @param {Object} context Any object on which you want to evaluate expression. If context is not specified only Global/Window properties enabled.
* @param {any} environment Any additional options
* @returns Result of evaluation
*/
eval(context?: Object, environment?: any): any;
/**
* Registers function that will be understandable in the expression
* @param name Function name
* @param func Function object
*/
registerFunction(name: string, func: Function): void;
/**
* Registers named function that will be understandable in the expression
* @param func Function object
*/
registerNamedFunction(func: Function): void;
/**
* Gets function object by its name.
* @param name The case insensitive name of the function.
* @returns Function object if it was registered, else undefined
*/
private getFunction;
/**
* Evaluate expression that was set in constructor
* @param ast
* @param context
* @returns {*}
*
* @ignore
*/
protected evaluate(ast: any, context: any, environment?: any): any;
/**
*
* @param func
* @param astArgs
* @param context
* @returns
*/
protected callFunc(func: Function, astArgs: any[], context: any, environment?: any): any;
private _handlers;
}