( keys: Array<KeyboardKey>, )
| 5 | |
| 6 | /** Expands CtrlOrMeta into separate Control and Meta variants */ |
| 7 | export const normalizeHotkey = ( |
| 8 | keys: Array<KeyboardKey>, |
| 9 | ): Array<Array<KeyboardKey>> => { |
| 10 | // no normalization needed if CtrlOrMeta not used |
| 11 | if (!keys.includes('CtrlOrMeta')) { |
| 12 | return [keys] |
| 13 | } |
| 14 | |
| 15 | return [ |
| 16 | keys.map((key) => (key === 'CtrlOrMeta' ? 'Control' : key)), |
| 17 | keys.map((key) => (key === 'CtrlOrMeta' ? 'Meta' : key)), |
| 18 | ] |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Generates all keyboard permutations for a given hotkey configuration |
no outgoing calls
no test coverage detected