Function maxByFn

  • Computes the maximum of the values returned by the iteratee for each element in the array.

    Type Parameters

    • Value

    Parameters

    • values: Value[]

      The array to iterate over.

    • iteratee: ((value) => number)

      The iteratee invoked per element.

        • (value): number
        • Parameters

          Returns number

    Returns number

    The maximum value.

    Since

    1.0.0

    Example

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

    Example

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