A quick function to construct an enumeration which has keys the same as their value 🚀
This used to be part of React, but since it's now been removed (See commit: 56f5115
), and some older packages throw an error without it, I'm posting it here in case anyone else needs it.
The first script is a slightly faster version I wrote in TypeScript, but it does exactly the same thing as Facebook's official key-mirror.js which is the one below- so you can use either.