JSPM

plucker

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3295
  • Score
    100M100P100Q124892F
  • License MIT

Pluck nested properties from an object

Package Exports

  • plucker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (plucker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.