aboutsummaryrefslogtreecommitdiff
path: root/src/shared/keys.js
blob: aca050ec5e154da4305e14487adb75ea985df0ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const asKeymapChars = (keys) => {
  return keys.map((k) => {
    let c = String.fromCharCode(k.code);
    if (k.ctrl) {
      return '<C-' + c.toUpperCase() + '>';
    }
    return c;
  }).join('');
};

const asCaretChars = (keys) => {
  return keys.map((k) => {
    let c = String.fromCharCode(k.code);
    if (k.ctrl) {
      return '^' + c.toUpperCase();
    }
    return c;
  }).join('');
};

export { asKeymapChars, asCaretChars };