Get the value of the first occurrence of
keyfrom an array of objects.
npm i pick-from --save
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'
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb on February 02, 2015.