Skip to content

Instantly share code, notes, and snippets.

@yesley
Created May 1, 2020 17:27
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 yesley/412e0474b62158ec5cc265a54a7a9acd to your computer and use it in GitHub Desktop.
Save yesley/412e0474b62158ec5cc265a54a7a9acd to your computer and use it in GitHub Desktop.
Build both map and reverse map for entries in a fancy way
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