plucker
Pluck nested properties from an object
Last updated 7 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install plucker 
SYNC missed versions from official npm registry.

plucker Flattr this!experimental

Pluck nested properties from an object.

Usage

plucker

pluck = plucker(path)

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.

pluck(object)

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:

var pluck = require('plucker')
var array = require('./data.json')

return array.map(
  pluck('some.nested.value')
)

plucker(path, object)

Shorthand for plucker(path)(object).

License

MIT. See LICENSE.md for details.

Current Tags

  • 0.0.0                                ...           latest (7 years ago)

1 Versions

  • 0.0.0                                ...           7 years ago
Maintainers (2)
Downloads
Today 3
This Week 6
This Month 95
Last Day 3
Last Week 26
Last Month 212
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |