Skip to content

Class: Parser<T>

Formula parser

Type Parameters

Type Parameter
T extends string | number

Constructors

Constructor

ts
new Parser<T>(formula: string, options?: Options): Parser<T>;

Create a new formula parser.

Parameters

ParameterTypeDescription
formulastringthe formula string to parse.
options?Optionsoptional settings.

Returns

Parser<T>

Methods

evaluate()

ts
evaluate(context?: any): T;

Evaluate the formula.

Parameters

ParameterTypeDescription
context?anyoptional object with runtime formula context used to resolve variables.

Returns

T

the string or number outcome of the resolved formula.