pick-from
Get the value of the first occurrence of `key` from an array of objects.
Last updated 12 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install pick-from 
SYNC missed versions from official npm registry.

pick-from NPM version

Get the value of the first occurrence of key from an array of objects.

Install with npm

npm i pick-from --save

Usage

var pickFrom = require('pick-from');

pickFrom('a', [{b: 'c'}, {a: 'd'}])
//=> 'd'

Pass true as the last argument to return the first non-null value:

pickFrom('a', [{b: 'c'}, {a: null}, {a: 'foo'}]);
//=> null

pickFrom('a', [{b: 'c'}, {a: null}, {a: 'foo'}], true);
//=> 'foo'

Run tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on February 02, 2015.

Current Tags

  • 0.1.0                                ...           latest (12 years ago)

1 Versions

  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 17
Today 0
This Week 0
This Month 12
Last Day 0
Last Week 6
Last Month 4
Dependencies (2)
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE