-
-
Save digitalconceptvisuals/4eb0df3991030b4124dbabc49569a98f to your computer and use it in GitHub Desktop.
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
// Convert switch-case to | |
// dynamically loadable map | |
function keyName(keyCode) { | |
// Load the keymap from a file | |
const keyMap = require("./keymap.json"); | |
// Now look up keyCode in map | |
return keyMap[keyCode]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment