Class represents an instance of a JsonFormula Expression that can be executed later on with multiple instances of JSON Data. The instance of the class has a search function that can be used to evaluate the expression on a json payload.
Kind: global class
Param | Type | Default | Description |
---|---|---|---|
[customFunctions] | object |
{} |
custom functions needed by a hosting application. |
[stringToNumber] | function |
'null' |
A function that converts string values to numbers. Can be used to convert currencies/dates to numbers |
[language] | string |
"en-US" |
|
[debug] | array |
[] |
will be populated with any errors/warnings |
\*
Evaluates the JsonFormula on a particular json payload and return the result
Kind: instance method of JsonFormula
Returns: \*
- the result of the expression being evaluated
Param | Type | Default | Description |
---|---|---|---|
json | object | array |
the json data on which the expression needs to be evaluated | |
[globals] | object |
{} |
global objects that can be accessed via custom functions. |
\*
Execute a previously compiled expression against a json object and return the result
Kind: instance method of JsonFormula
Returns: \*
- the result of the expression being evaluated
Param | Type | Description |
---|---|---|
ast | object |
The abstract syntax tree returned from compile() |
json | object | array |
the json data on which the expression needs to be evaluated |
globals | \* |
set of objects available in global scope |
Creates a compiled expression that can be executed later on with some data.
Kind: instance method of JsonFormula
Param | Type | Default | Description |
---|---|---|---|
expression | string |
the expression to evaluate | |
[allowedGlobalNames] | Array.<string> |
[] |
A list of names of the global variables being used in the expression. |
[debug] | array |
[] |
will be populated with any errors/warnings |
\*
Compile and execute a json-formula expression. If executing the same expression multiple times, it is more efficient to create a class instance of {JsonFormula} and call the search method multiple times.
Kind: global function
Returns: \*
- the result of the expression being evaluated
Param | Type | Default | Description |
---|---|---|---|
json | object | array |
the json data on which the expression needs to be evaluated | |
globals | object |
global objects that can be accessed via custom functions. | |
expression | string |
the expression to evaluate | |
[customFunctions] | object |
{} |
custom functions needed by a hosting application. |
[stringToNumber] | function |
'null' |
A function that converts string values to numbers. Can be used to convert currencies/dates to numbers |
[language] | string |
"en-US" |
|
[debug] | array |
[] |
will be populated with any errors/warnings |