UNPKG

just-pluck-it

Version:

pluck a property from each member of a collection

26 lines (18 loc) 711 B
<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE --> <!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template --> ## just-pluck-it Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion. [`🍦 Try it`](https://anguscroll.com/just/just-pluck-it) ```shell npm install just-pluck-it ``` ```shell yarn add just-pluck-it ``` Pluck a property from each member of a collection ```js import pluck from 'just-pluck-it'; pluck([{a:1, b:2}, {a:4, b:3}, {a:2, b:5}], 'a'); // [1, 4, 2] pluck({x: {a:1, b:2}, y: {a:4, b:3}, z: {a:2, b:5}}, 'a'); // {x: 1, y: 4, z: 2} ```