all files / util/ keyboardHelpers.js

66.67% Statements 10/15
41.67% Branches 5/12
100% Functions 1/1
75% Lines 9/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20    615× 615×             615× 615× 615× 615× 615×   615×    
export {default as keys} from './keys'
 
export function parseKeyEvent(event, onlyModifiers) {
  let frags = []
  Iif (event.altKey) {
    if (event.code === 'AltRight') {
      frags.push('ALTGR')
    } else {
      frags.push('ALT')
    }
  }
  Iif (event.ctrlKey) frags.push('CTRL')
  Eif (event.metaKey) frags.push('META')
  Iif (event.shiftKey) frags.push('SHIFT')
  Eif (!onlyModifiers) {
    frags.push(event.keyCode)
  }
  return frags.join('+')
}