Function minOfArray

  • Helper to determine the minimum of an array

    Example 1:

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

    Example 2:

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

    Returns

    Type Parameters

    • T

    Parameters

    • arr: T[]

      The array

    • path: string | keyof T

      The path to the data.

    • Optional defaultValue: number = 0

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

    Returns {
        index: number;
        min: number;
    }

    • index: number
    • min: number

Generated using TypeDoc