get
Basic usage
Given any value and a select function to get the desired attribute, returns the desired value or a default value if the desired value couldn’t be found.
import { get } from 'radash'
const fish = { name: 'Bass', weight: 8, sizes: [ { maturity: 'adult', range: [7, 18], unit: 'inches' } ]}
get( fish, 'sizes[0].range[1]' ) // 18get( fish, 'sizes.0.range.1' ) // 18get( fish, 'foo', 'default' ) // 'default'