New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

keycodes

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keycodes - npm Package Compare versions

Comparing version
0.2.3
to
0.2.4
+38
-28
index.js
'use strict';
var keys = {
ctrl: 17,
control: 17,
alt: 18,
option: 18,
shift: 16,
windows: 91,
command: 91,
esc: 27,
escape: 27,
'ctrl': 17,
'control': 17,
'alt': 18,
'option': 18,
'shift': 16,
'windows': 91,
'command': 91,
'esc': 27,
'escape': 27,
'`': 192,
'-': 189,
'=': 187,
backspace: 8,
tab: 9,
'backspace': 8,
'tab': 9,
'\\': 220,

@@ -23,3 +23,3 @@ '[': 219,

'\'': 222,
enter: 13,
'enter': 13,
'return': 13,

@@ -29,18 +29,18 @@ ',': 188,

'/': 191,
space: 32,
pause: 19,
'space': 32,
'pause': 19,
'break': 19,
insert: 45,
'insert': 45,
'delete': 46,
home: 36,
end: 35,
pageup: 33,
pagedown: 34,
left: 37,
up: 38,
right: 39,
down: 40,
capslock: 20,
numlock: 144,
scrolllock: 145
'home': 36,
'end': 35,
'pageup': 33,
'pagedown': 34,
'left': 37,
'up': 38,
'right': 39,
'down': 40,
'capslock': 20,
'numlock': 144,
'scrolllock': 145
};

@@ -57,6 +57,16 @@

function code(input) {
return keys[input.toLowerCase()] || input.toUpperCase().charCodeAt(0);
function code (input) {
var code = keys[input.toLowerCase()];
if (code !== undefined) {
return code;
}
if (input.length === 1) {
return input.toUpperCase().charCodeAt(0);
}
return undefined;
}
function key(input) {

@@ -63,0 +73,0 @@ for (var k in keys) {

{
"name": "keycodes",
"description": "Key codes and names",
"version": "0.2.3",
"version": "0.2.4",
"keywords": [

@@ -6,0 +6,0 @@ "key",

@@ -180,1 +180,6 @@ 'use strict';

});
test('Bogus keycodes', function (t) {
t.is(keycode(Math.POSITIVE_INFINITY), undefined);
t.is(keycode('foo'), undefined);
});