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

    Function meanByFn

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

      Type Parameters

      • Value

      Parameters

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

      Returns number

      1.0.0

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