boil
Reduce a list of items down to one item
80 bytes
since v12.1.0
Usage
Given an array of items return the final item that wins the comparison condition. Useful for more complicated min/max.
import * as _ from 'radashi'
const gods = [ { name: 'Ra', power: 100, }, { name: 'Zeus', power: 98, }, { name: 'Loki', power: 72, },]
_.boil(gods, (a, b) => (a.power > b.power ? a : b))// => { name: 'Ra', power: 100 }