@szilanor/stream
    Preparing search index...

    Function sumBy

    • Returns a collector that returns the sum of all entries in the Iterable based on the selector function.

      Type Parameters

      • T

        Type of items in the source.

      Parameters

      Returns CollectorFunction<T, number | undefined>

      Collector that returns the sum of all entries in the Iterable based on the selector function.

      const result = sumBy((x) => x)([1, 2, 3]);
      console.log(result); // 6