pluck
Iteratively pluck keys from a map of maps.
githubArguments
Name | Description | Type |
---|---|---|
map | Nested map of maps. | map |
path | Collection of keys that are sought in map . | strings |
missing | A 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 thepath
in map
.Example
map = [foo: [bar: [baz: 123, buz: 456]]]
pluck(map, ['foo', 'bar', 'baz'])
// 123
pluck(map, ['francis', 'crick'], 'not found')
// 'not found'