pick-to-array
Pick all values of a property in one or more objects
Made with ❤ at @outlandish
Install
npm install --save pick-to-array
Import
// ES6 // CommonJSvar pickToArray = // RequireJS
<!-- Script, available as `window.pickToArray` -->
Usage
pickToArray(entities, property[, deep])
Pick all values of a property in one or more objects.
- entities {Array|Object} Entities or entity to pick from
- property {String|Array} Property name(s) to pick value from
- [deep] {Boolean} Pick from nested properties
Returns an array of all the values.
Example:
const entities = id: 456 id: 789 entity: id: 123 const ids = console //=> [456, 789, 123]
Contributing
All pull requests and issues welcome!
If you're not sure how, check out Kent C. Dodds' great video tutorials on egghead.io!
Author & License
pick-to-array
was created by Sam Gluck and is released under the MIT license.