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) => number)
        • (value): number
        • Parameters

          Returns number

    Returns number

    Since

    1.0.0

    Example

    meanByFn([1, 2, 3], number => number); // => 2
    

    Example

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