Skip to content

Instantly share code, notes, and snippets.

@Chrissi2812
Created August 22, 2018 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chrissi2812/1c32f6a7285f3a9e09e3cae2513603ce to your computer and use it in GitHub Desktop.
Save Chrissi2812/1c32f6a7285f3a9e09e3cae2513603ce to your computer and use it in GitHub Desktop.
Pick attributes from Object
function pick(whiteListed, arr) {
return Object.entries(arr)
.filter(([key]) => whiteListed.includes(key))
.map(([key, value]) => ({ [key]: value }));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment