Created
September 19, 2018 12:54
-
-
Save GlennMatthys/e993e1ed9a059921a079713cbc0b4d6a to your computer and use it in GitHub Desktop.
Javascript flatMap array to object
This file contains 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.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