plucker

0.0.0 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.0
    2,075
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.0
    2,075

Package Sidebar

Install

npm i plucker

Weekly Downloads

1,952

Version

0.0.0

License

MIT

Last publish

Collaborators

  • yoshuawuyts
  • hughsk