Convert between keyboard keycodes and keynames and vice versa.
Simple map of keyboard codes.
$ npm install keycode
$ component install timoxley/keycode
var keycode = ;document
keycode tries to make an intelligent guess as to what
you're trying to discover based on the type of argument
Returns the name of the key associated with this event.
Due to the keypress event being weird,
keycodecurrently does not support the
keypress event, but this should not be an issue as
keyup work perfectly fine.
Returns the lowercase name of a given numeric keycode.
// => 'enter'
Returns the numeric keycode for given key name.
// => 13// keycode is not case sensitive// => 13
Common aliases are also supplied:
> for var alias in keycodealiases consolectl ctrlpause pause/breakbreak pause/breakcaps caps lockescape escpgup page uppgdn page downins insertdel deletespc space
Key code/name maps are available directly as
keycodenames13 // => 'enter'keycodecodes'Enter' // => 13
project : keycoderepo age : 2 years, 4 monthsactive : 19 dayscommits : 48files : 13authors :26 Tim Oxley 54.2%10 Tim 20.8%4 jkroso 8.3%3 Amir Abu Shareb 6.2%1 TJ Holowaychuk 2.1%1 Nathan Zadoks 2.1%1 Kenan Yildirim 2.1%1 Yoshua Wuyts 2.1%1 Greg Reimer 2.1%