Condition engine

Constructors

  • Parameters

    • Optionaloptions: Partial<Options>

      Parser options.

    Returns default

Methods

  • Evaluate the expression.

    Parameters

    • exp: ExpressionInput

      Raw expression.

    • ctx: Context

      Evaluation data context.

    Returns boolean

  • Parse expression.

    Parameters

    • exp: ExpressionInput

      Raw expression.

    Returns Evaluable

  • Simplifies an expression with values in context.

    This method tries to evaluate all the expressions and reduce them to its corresponding boolean value. If a value required for the expression is not present in the context, the minimal corresponding expression will be returned.

    Parameters

    • exp: ExpressionInput

      Raw expression.

    • context: Context

      Evaluation data context.

    • OptionalstrictKeys: string[]

      keys to be considered present even if they are not present in the context

    • OptionaloptionalKeys: string[]

      keys to be considered not present unless they are in the context or in strictKeys; when strictKeys is undefined and optionalKeys is an array, every key that is not in optionalKeys is considered to be present and thus will be evaluated

    Returns Input

  • Get expression statement

    Parameters

    • exp: ExpressionInput

      Raw expression.

    Returns string