diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/keys.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shared/keys.js b/src/shared/keys.js new file mode 100644 index 0000000..aca050e --- /dev/null +++ b/src/shared/keys.js @@ -0,0 +1,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 }; |