Radash
  1. Array
  2. boil

Basic usage

Given an array of items return the final item that wins the comparison condition. Useful for more complicated min/max.

import { boil } from 'radash'

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 }