Created
December 12, 2019 22:22
-
-
Save btorresgil/22e295ea7f6d5dd03db73d94532a3358 to your computer and use it in GitHub Desktop.
JavaScript Pick Function (requres ES2019): Saved from https://stackoverflow.com/questions/25553910/one-liner-to-take-some-properties-from-object-in-es-6/56751925#56751925
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
Object.fromEntries( | |
Object.entries(obj) | |
.filter(([key]) => ['foo', 'bar'].includes(key)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment