@leanchuck/core - v0.1.1
    Preparing search index...

    Function sumBy

    • Sums a list of items by projecting each to a number.

      Type Parameters

      • T

      Parameters

      • items: readonly T[]

        The items to reduce.

      • select: (item: T) => number

        Maps each item to the number to add.

      Returns number

      The total. Returns 0 for an empty list.

      sumBy(rows, (r) => r.revenue);