choo-shortcache
Version:
choo nanocomponent cache shortcut
38 lines (22 loc) • 1.26 kB
Markdown
Pluck nested properties from an object.
[](https://nodei.co/npm/plucker)
Given a dot-delimted property `path`, returns a plucking function.
You can also pass in an array of string keys, in case you want to avoid
splitting a key which is intended to have dots in it.
Pass this function an object to pluck the nested value from it.
To pluck values from an array, you can simply use it with `[].map`, like so:
``` javascript
var pluck = require('plucker')
var array = require('./data.json')
return array.map(
pluck('some.nested.value')
)
```
Shorthand for `plucker(path)(object)`.
MIT. See [LICENSE.md](http://github.com/hughsk/plucker/blob/master/LICENSE.md) for details.