Created
May 1, 2020 17:27
-
-
Save yesley/412e0474b62158ec5cc265a54a7a9acd to your computer and use it in GitHub Desktop.
Build both map and reverse map for entries in a fancy way
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
const buildFullMap = entries => entries.reduce((map, [key, value]) => { | |
map[map[key] = value] = key | |
return map | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment