Extract all parameter names and non-built-in function names referenced by an expression.
Built-in functions (e.g. Abs, Sin, if) are excluded from the functions set because they are always available without any configuration.
Abs
Sin
if
functions
An NCalc expression string or a pre-parsed LogicalExpression.
An object with:
names
ParserError If expression is a string that cannot be parsed.
expression
import { parameters } from 'escalc';parameters('[price] * (1 + [tax]) + Abs([discount])');// => { names: Set { 'price', 'tax', 'discount' }, functions: Set {} }parameters('myFn([x]) + Abs([x])');// => { names: Set { 'x' }, functions: Set { 'myFn' } } Copy
import { parameters } from 'escalc';parameters('[price] * (1 + [tax]) + Abs([discount])');// => { names: Set { 'price', 'tax', 'discount' }, functions: Set {} }parameters('myFn([x]) + Abs([x])');// => { names: Set { 'x' }, functions: Set { 'myFn' } }
Extract all parameter names and non-built-in function names referenced by an expression.
Built-in functions (e.g.
Abs,Sin,if) are excluded from thefunctionsset because they are always available without any configuration.