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