{"name":"keycode","description":"Convert between keyboard keycodes and keynames and vice versa.","version":"2.1.6","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":"^3.0.2"},"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"},"typings":"./keycode.d.ts","gitHead":"ad4a213705b1cb569388953fab727ad710a440a4","_id":"keycode@2.1.6","_shasum":"d7c3b49885d6a67ed9bf3688010c7b91de630f40","_from":".","_npmVersion":"3.10.7","_nodeVersion":"6.3.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"dist":{"shasum":"d7c3b49885d6a67ed9bf3688010c7b91de630f40","tarball":"http://registry-npm.ywwl.com/keycode/download/keycode-2.1.6.tgz","integrity":"sha512-sSmeBkzSWVSKAn1gTo443mY/K94w6oAGISTMBheIwq4x4ASAXSF9vulOLgKDtDrLJMY0d+bCl+pl5+j97H3Mlg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpAVvrS7dy6hHQIVuEk0UNHj/SIivoitj0Ha2AcxjBKgIgAlWw3AJ3DvTikMQ8A+HoMe6kp8OMvyeJnqyAdhIvmxc="}],"size":27599,"noattachment":false,"key":"/keycode/-/keycode-2.1.6.tgz"},"maintainers":[{"name":"timoxley","email":"secoif@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/keycode-2.1.6.tgz_1473888623309_0.40224721608683467"},"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":1473888623557,"_cnpm_publish_time":1473888623557,"dist-tags":{"latest":"2.2.1"}}