Reduce constructor

Reduce({
  1. @required dynamic input,
  2. @required dynamic initialValue,
  3. @required dynamic inExpr,
})

Creates $reduce operator expression

  • input - Can be any valid expression that resolves to an array. 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.

  • initialValue - The initial cumulative value set before inExpr is applied to the first element of the input array.

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

Implementation

Reduce({@required input, @required initialValue, @required inExpr})
    : super(
          'reduce',
          AEObject(
              {'input': input, 'initialValue': initialValue, 'in': inExpr}));