ESCalc - v0.0.1-beta.2
    Preparing search index...

    Function parameters

    • 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.

      Parameters

      Returns { functions: Set<string>; names: Set<string> }

      An object with:

      • names - distinct parameter names (without brackets).
      • functions - distinct non-built-in function names.

      ParserError If expression is a string that cannot be parsed.

      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' } }