Hierarchy

  • Reduce

Properties

Properties

$reduce: {
    in: any;
    initialValue: any;
    input: ArrayExpression<any>;
}

Applies an expression to each element in an array and combines them into a single value.

Type declaration

  • in: any

    A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left.

    During evaluation of the in expression, two variables will be available:

    • value is the variable that represents the cumulative value of the expression.
    • this is the variable that refers to the element being processed.
  • initialValue: any

    The initial cumulative value set before in is applied to the first element of the input array.

  • input: ArrayExpression<any>

    Can be any valid expression that resolves to an array. For more information on expressions, see Expressions.

    If the argument resolves to a value of null or refers to a missing field, $reduce returns null.

    If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error.

Generated using TypeDoc