pluck

Iteratively pluck keys from a map of maps.

github

Arguments

NameDescriptionType
mapNested map of maps.map
pathCollection of keys that are sought in map.strings
missingA value to return if no value is found at the end of path. Defaults to “missing”.any

Output value

The value at the end of the path in map.

Example

map = [foo: [bar: [baz: 123, buz: 456]]]

pluck(map, ['foo', 'bar', 'baz'])
// 123

pluck(map, ['francis', 'crick'], 'not found')
// 'not found'