Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Keyz is very simple library for use in the JS enviroment.
It exposes single immutable object containing constants for keyboard keys.
You can install it from npm:
npm install keyz --save
Or you can download keyz.min.js
from the dist folder and then include it in html file:
<script src="keyz.min.js"></script>
Usually handler listening for events of specific key is created like this:
element.addEventListener("keydown", function(event) {
if (event.keyCode == 13) {
//do something
}
})
It involves using magic numbers (like 13
in this example), which can make code hard to uderstand.
This library provides set of self-explaining constants, which can be imported and used like this:
import Keys from 'keyz'
element.addEventListener("keydown", function(event) {
if (event.keyCode == Keys.ENTER) {
//do something
}
})
You can also import constants for specific keys:
import { PAGE_UP } from 'keyz'
element.addEventListener("keydown", function(event) {
if (event.keyCode == PAGE_UP) {
//do something
}
})
Key | Value |
---|---|
BACKSPACE | 8 |
TAB | 9 |
ENTER | 13 |
SHIFT | 16 |
CTRL | 17 |
ALT | 18 |
PAUSE | 19 |
CAPS_LOCK | 20 |
ESCAPE | 27 |
SPACE | 32 |
PAGE_UP | 33 |
PAGE_DOWN | 34 |
END | 35 |
HOME | 36 |
LEFT | 37 |
UP | 38 |
RIGHT | 39 |
DOWN | 40 |
INSERT | 45 |
DELETE | 46 |
KEY_0 | 48 |
KEY_1 | 49 |
KEY_2 | 50 |
KEY_3 | 51 |
KEY_4 | 52 |
KEY_5 | 53 |
KEY_6 | 54 |
KEY_7 | 55 |
KEY_8 | 56 |
KEY_9 | 57 |
KEY_A | 65 |
KEY_B | 66 |
KEY_C | 67 |
KEY_D | 68 |
KEY_E | 69 |
KEY_F | 70 |
KEY_G | 71 |
KEY_H | 72 |
KEY_I | 73 |
KEY_J | 74 |
KEY_K | 75 |
KEY_L | 76 |
KEY_M | 77 |
KEY_N | 78 |
KEY_O | 79 |
KEY_P | 80 |
KEY_Q | 81 |
KEY_R | 82 |
KEY_S | 83 |
KEY_T | 84 |
KEY_U | 85 |
KEY_V | 86 |
KEY_W | 87 |
KEY_X | 88 |
KEY_Y | 89 |
KEY_Z | 90 |
LEFT_META | 91 |
RIGHT_META | 92 |
SELECT | 93 |
NUMPAD_0 | 96 |
NUMPAD_1 | 97 |
NUMPAD_2 | 98 |
NUMPAD_3 | 99 |
NUMPAD_4 | 100 |
NUMPAD_5 | 101 |
NUMPAD_6 | 102 |
NUMPAD_7 | 103 |
NUMPAD_8 | 104 |
NUMPAD_9 | 105 |
MULTIPLY | 106 |
ADD | 107 |
SUBTRACT | 109 |
DECIMAL | 110 |
DIVIDE | 111 |
F1 | 112 |
F2 | 113 |
F3 | 114 |
F4 | 115 |
F5 | 116 |
F6 | 117 |
F7 | 118 |
F8 | 119 |
F9 | 120 |
F10 | 121 |
F11 | 122 |
F12 | 123 |
NUM_LOCK | 144 |
SCROLL_LOCK | 145 |
SEMICOLON | 186 |
EQUALS | 187 |
COMMA | 188 |
DASH | 189 |
PERIOD | 190 |
FORWARD_SLASH | 191 |
GRAVE_ACCENT | 192 |
OPEN_BRACKET | 219 |
BACK_SLASH | 220 |
CLOSE_BRACKET | 221 |
SINGLE_QUOTE | 222 |
FAQs
Set of constants indentyfying keyboard keys.
The npm package keyz receives a total of 1 weekly downloads. As such, keyz popularity was classified as not popular.
We found that keyz demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.