Function maxOfArray

  • Helper to determine the maximum of an array

    Example 1:

    const a = [1,2,3,4]
    // default behavior:
    maxOfArray(a,"") // => 4
    // if no data present at the path the default value is used:
    maxOfArray(a,"a",1) // => 1

    Example 2:

    const a = [{value:1},{value:2},{value:3},{value:4}]
    // default behavior:
    maxOfArray(a,"value") // => 4
    // if no data present at the path the default value is used:
    maxOfArray(a,"a",1) // => 1

    Returns

    Parameters

    • arr: any[]

      The array

    • path: string

      The path to the data.

    • Optional defaultValue: number = 0

      if no data present at the path the default value is used.

    Returns {
        index: number;
        max: number;
    }

    • index: number
    • max: number

Generated using TypeDoc