• Aggregates one value of all rows.

    Type Parameters

    • T = any

    Parameters

    • rows: ArrayLike<T>

      the rows (an array, also filtered or sorted ones)

    • value: ValueAccessor<T>

      property path ("total", "address.zip") or function

    • aggregator: AggregatorRef

      "sum", "count", "avg", "min", "max", "countDistinct", "first", "last" or an own AggregatorIf

    Returns unknown

    the result (sum of no numbers is 0, avg/min/max of no numbers undefined)

    Example

    aggregate(orders, "total", "sum");                      // all orders
    aggregate(orders.filter(o => o.city === "Berlin"), "total", "avg");
    aggregate(orders, o => o.quantity * o.price, "max"); // a computed value

    Since

    1.1.94