@samatawy/rules
    Preparing search index...

    Class RandomFunction

    Represents an expression that can be evaluated in a given context to produce a value. Expressions can be used in conditions, assignments, and other parts of the rule syntax to compute values based on the current state of the working context. Each expression must implement the required() method to specify which data keys it depends on, and the evaluate() method to compute its value based on the context.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    syntax: string
    name: string
    args: Expression[]

    Methods

    • Get the original syntax string that was used to create this expression. This can be useful for debugging, logging, or error messages to provide context about where the expression came from.

      Returns string

      the original syntax string of the expression.

    • What data keys are required for this expression to be evaluated? This information is used by the rule engine to determine the dependencies between expressions and rules, and to ensure that all necessary data is available before evaluating the expression.

      Returns Set<string>

      a set of data keys required for this expression to be evaluated.

    • What functions are invoked by this expression? This information can be used for optimization, caching, or to determine which function nodes in the graph are relevant for this expression.

      Returns Set<string>

      a set of function names invoked by this expression.

    • Check whether the function should convert any number of arguments into a single array argument for processing. By default this is not true. Functions that should convert arguments into an array for processing (e.g. sum, avg, concat) can override this method to indicate that they expect a parameter array.

      Returns boolean

      boolean indicating whether the function expects a parameter array