ts-iterable-functions
    Preparing search index...

    Function _sum

    • Calculates the arithmetic sum of all numbers in the source iterable.

      Parameters

      • src: Iterable<number>

        Source iterable yielding numeric values to accumulate.

      Returns number

      Total of all elements in src, or 0 when the iterable is empty.

      const total = _sum([1, 2, 3, 4]);
      console.log(total); // 10

      or using the curried version:

      const total = pipeInto([1, 2, 3, 4], sum());
      console.log(total); // 10