Do assertions on given key combos and events and returns true if match
npm install is-key-combo
const isKeyCombo = require('is-key-combo');
const isValid = isKeyCombo(event, 'cmd+a');
cmd+a
cmd+shift+esc
alt+enter
Note that cmd
applies both for Ctrl and ⌘ so it will be easier to handle combinations cross platform.
MIT