Extract a list of property values from array with objects
Install the module with: npm install array-pluck
var arrayPluck = require('array-pluck');
var peoples = [
{ name: 'Fredrik', age: 22, favorites: { fruit: 'Pineapple' } },
{ name: 'Elli', age: 22, favorites: { fruit: 'Apple' } }
]
, result = arrayPluck(peoples, 'favorites.fruit');
console.log(result); // ['Pineapple', 'Apple']
MIT © Fredrik Forsmo