@extremejs/utils - v1.0.0-beta.23
    Preparing search index...

    Function sumByFn

    • It will iterate through each element of the provided values array, by the provided iteratee function and add the resulting numbers returned by the said iteratee function to produce the desired sum.

      Type Parameters

      • Value

      Parameters

      • values: Value[]
      • iteratee: (value: Value) => number

      Returns number

      1.0.0

      sumByFn([1, 2, 3], number => number); // => 6
      
      sumByFn([{ a: 1 }, { a: 2 }, { a: 3 }], ({ a }) => a); // => 6