consta = [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
consta = [{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.
OptionaldefaultValue: number = 0
if no data present at the path the default value is used.
Helper to determine the minimum of an array
Example 1:
Example 2:
Returns