Nav

maxBy

maxBy(Array<T>, (item: T) → Comparable): T | Null

Returns the element used to get the maximum result using a function. Return null when array is empty.

Transform

        
     
1
2
3
4
%dw 2.0
output  application/json
---
[ { a: "1" }, { a: "2" }, { a: "3" } ] maxBy ((item) -> item.a as Number)
Output

        
     
1
{ "a": "3" }