salix/front/core/lib/key-codes.js

14 lines
418 B
JavaScript
Raw Permalink Normal View History

export default function validKey(key) {
let keycode = key.keyCode || key;
let valid =
(keycode > 47 && keycode < 58) || // number keys
(keycode > 64 && keycode < 91) || // letter keys
(keycode > 95 && keycode < 112) || // numpad keys
(keycode > 185 && keycode < 193) || // ;=,-./` (in order)
(keycode > 218 && keycode < 223); // [\]' (in order)
return valid;
2018-02-10 15:18:01 +00:00
}