Skip to content

Instantly share code, notes, and snippets.

@GlennMatthys
Created September 19, 2018 12:54
Show Gist options
  • Save GlennMatthys/e993e1ed9a059921a079713cbc0b4d6a to your computer and use it in GitHub Desktop.
Save GlennMatthys/e993e1ed9a059921a079713cbc0b4d6a to your computer and use it in GitHub Desktop.
Javascript flatMap array to object
array.reduce(
(acc, val) =>
{
Object.keys(val).forEach(key => acc[key] = val[key]);
return acc;
}, {}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment