array-pluck

Extract a list of property values from array with objects

Usage no npm install needed!

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

README

array-pluck Build Status

Extract a list of property values from array with objects

Install the module with: npm install array-pluck

Example

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']

License

Copyright (c) 2014 Fredrik Forsmo
Licensed under the MIT license.