Skip to content

min

Get the smallest item from an array

125 bytes

Usage

Given an array of items and a function to get the value of each item, returns the item with the smallest value. Uses _.boil under the hood.

import * as _ from 'radashi'
const fish = [
{
name: 'Marlin',
weight: 105,
source: 'ocean',
},
{
name: 'Bass',
weight: 8,
source: 'lake',
},
{
name: 'Trout',
weight: 13,
source: 'lake',
},
]
_.min(fish, f => f.weight) // => {name: "Bass", weight: 8, source: "lake"}