@inkline/inkline
Version:
Inkline is the Vue.js UI/UX Library built for creating your next design system
15 lines (12 loc) • 357 B
text/typescript
import { keymap } from '@inkline/inkline/constants';
/**
* Verify if the given event is mapped to a specific key
*
* @param key
* @param e
* @returns {boolean}
*/
export const isKey = (key: string, e: KeyboardEvent): boolean => {
const keyCode = e.key || (e as any).keyIdentifier || e.keyCode;
return keymap[key].indexOf(keyCode) !== -1;
};