{"name":"keycode","description":"Convert between keyboard keycodes and keynames and vice versa.","version":"2.1.1","main":"index.js","directories":{"example":"examples","test":"test"},"scripts":{"test":"mocha test/keycode.js"},"repository":{"type":"git","url":"git://github.com/timoxley/keycode.git"},"license":"MIT","bugs":{"url":"https://github.com/timoxley/keycode/issues"},"devDependencies":{"mocha":"^2.4.5"},"homepage":"https://github.com/timoxley/keycode","dependencies":{},"keywords":["keyboard","keycode","keyboardevent","ascii","keydown","keyup","metakey","keyname","keypress"],"author":{"name":"Tim Oxley","email":"secoif@gmail.com"},"gitHead":"91768d981a262038c1ebe2caf5709401a0ef0557","_id":"keycode@2.1.1","_shasum":"d9027a47934756c2b70d1b82b2f74eeccf30f9bc","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1-rc.2","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":"secoif@gmail.com"}],"dist":{"shasum":"d9027a47934756c2b70d1b82b2f74eeccf30f9bc","tarball":"http://registry-npm.ywwl.com/keycode/download/keycode-2.1.1.tgz","integrity":"sha512-TnYdfmu397H2FNWSG4Ie+1KAR2EC+LIrgfeR4h/c8ht1ujVQfivYZE+B5dH7ANcDXprQPJTOLjVQwroF4g4XXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9vae3TjlNIL/+cmIQKRm2OT8FSrgH7I49giI2q8KDBgIhAJ+Jms8Gb9/b+spMhGf5EtCS6PUrrEFEtF9ggaBEGNRh"}],"size":27390,"noattachment":false,"key":"/keycode/-/keycode-2.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/keycode-2.1.1.tgz_1457142159226_0.7151744919829071"},"readme":"# keycode\n\n  Simple map of keyboard codes.\n\n[![Build Status](https://travis-ci.org/timoxley/keycode.png?branch=master)](https://travis-ci.org/timoxley/keycode)\n\n## Installation\n\n#### npm\n\n```sh\n$ npm install keycode\n```\n\n#### component\n```sh\n$ component install timoxley/keycode\n```\n\n## Example\n\n```js\nvar keycode = require('keycode');\ndocument.addEventListener('keydown', function(e) {\n  console.log(\"You pressed\", keycode(e))\n})\n```\n\n## API\n\n`keycode` tries to make an intelligent guess as to what\nyou're trying to discover based on the type of argument\nyou supply.\n\n### keycode(keycode:Event)\n\nReturns the name of the key associated with this event.\n\n```js\ndocument.body.addEventListener('keyup', function(e) {\n  console.log(keycode(e)) // prints name of key\n})\n```\n\n[Due to the keypress event being weird](https://github.com/timoxley/keycode/wiki/wtf%3F-keydown,-keyup-vs-keypress),`keycode `currently does not support the `keypress` event, but this should not be an issue as `keydown` and `keyup` work perfectly fine.\n\n### keycode(keycode:Number)\n\nReturns the lowercase name of a given numeric keycode.\n\n```js\nkeycode(13) // => 'enter'\n```\n\n### keycode(name:String)\n\nReturns the numeric keycode for given key name.\n\n```js\nkeycode('Enter') // => 13\n\n// keycode is not case sensitive\nkeycode('eNtEr') // => 13\n```\n\n### Name Aliases\n\nCommon aliases are also supplied:\n\n```js\n> for (var alias in keycode.aliases) { console.log(alias, keycode(keycode(alias))) }\nctl ctrl\npause pause/break\nbreak pause/break\ncaps caps lock\nescape esc\npgup page up\npgdn page down\nins insert\ndel delete\nspc space\n```\n\n## keycode.isEventKey(event: Event, nameOrCode: String | Number)\n\nTests if an keyboard event against a given name or keycode.\nWill return `true` if the event matches the given name or keycode, `false` otherwise.\n\n```js\n// assume event is an keydown event with key 'enter'\nkeycode.isEventKey(event, 'enter') // => true\nkeycode.isEventKey(event, 'down') // => false\n\nkeycode.isEventKey(event, 13) // => true\nkeycode.isEventKey(event, 40) // => false\n```\n\n\n## Maps\n\nKey code/name maps are available directly as `keycode.codes` and `keycode.names` respectively.\n\n```js\nkeycode.names[13] // => 'enter'\nkeycode.codes['enter'] // => 13\n```\n\n## Credit\n\n```\n project  : keycode\n repo age : 3 years, 8 months\n active   : 29 days\n commits  : 66\n files    : 13\n authors  :\n    49\tTim Oxley        74.3%\n     4\tjkroso           6.1%\n     3\tAmir Abu Shareb  4.5%\n     1\tGreg Reimer      1.5%\n     1\tKenan Yildirim   1.5%\n     1\tAbel Toledano    1.5%\n     1\tSam              1.5%\n     1\tTJ Holowaychuk   1.5%\n     1\tYoshua Wuyts     1.5%\n     1\tNathan Zadoks    1.5%\n     1\tBrenton Simpson  1.5%\n     1\tBrian Noguchi    1.5%\n     1\tGilad Peleg      1.5%\n```\n\nOriginal key mappings lifted from http://jsfiddle.net/vWx8V/ via http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes\n\n## License\n\n[MIT](http://opensource.org/licenses/mit-license.php)\n","publish_time":1457142160539,"_cnpm_publish_time":1457142160539,"dist-tags":{"latest":"2.2.1"}}