select
Filter and map an array
146 bytes
Usage
Applies a filter and a map operation at once and in one pass. If the filter is omitted, returns all non-nullish mapped values.
import * as _ from 'radashi'
const fish = [ { name: 'Marlin', weight: 105, source: 'ocean', }, { name: 'Bass', weight: 8, source: 'lake', }, { name: 'Trout', weight: 13, source: 'lake', },]
_.select( fish, f => f.weight, f => f.source === 'lake',) // => [8, 13]