Options
All
  • Public
  • Public/Protected
  • All
Menu

Module meanBy

Index

References

Functions Math

References

Renames and re-exports __type

Math Functions

  • meanBy<T>(array: T[], iteratee: ArrayIteratee<T, number>): number
  • This method is like mean except that it accepts iteratee which is invoked for each element in array to generate the value to be averaged. The iteratee is invoked with one argument: (value).

    since

    5.11.0

    example

    const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]

    meanBy(objects, ({ n }) => n) // => 5

    Type parameters

    • T = any

    Parameters

    • array: T[]

      The array to iterate over.

    • iteratee: ArrayIteratee<T, number>

      The iteratee invoked per element.

    Returns number

    Returns the mean.