Last active
September 1, 2019 18:41
-
-
Save javascripto/9c9c1649364cdada50af826dfe18940e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.pluck = function(...keys) { | |
| return this.map(item => keys.reduce((acc, key) => | |
| (key in item) && (acc[key] = item[key]) ? acc : acc, {})); | |
| } | |
| Array.prototype.pluck = function(...keys) { | |
| return this.map(item => JSON.parse(JSON.stringify(item, [...keys]))); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment