pluck

pluck values from an object path

Usage no npm install needed!

<script type="module">
  import pluck from 'https://cdn.skypack.dev/pluck';
</script>

README

Build Status

pluck

pluck property path from arrays or an object.

Installation

component

  $ component install redventures/pluck

or

npm

  $ npm install pluck

Example

Pluck from arrays.

var pluck = require('pluck');

var firstName = pluck('name.first');

var items = [
  { name: { first: 'john', last: 'doe' } }
];

var names = firstName(items);

Pluck from simple objects.

var pluck = require('pluck');

var item = {
  name: {
    first: 'john',
    last: 'doe'
  }
};

var name = firstName(item);

API

pluck(path)

Creates the property lookup function.

License

MIT