* Checks if a key is in the known keys set.
(key: string)
| 96 | * Checks if a key is in the known keys set. |
| 97 | */ |
| 98 | function isKnownKey(key: string): boolean { |
| 99 | // Check direct match |
| 100 | if (ALL_KEYS.has(key as any)) { |
| 101 | return true |
| 102 | } |
| 103 | |
| 104 | // Check uppercase version for letters |
| 105 | if (key.length === 1 && ALL_KEYS.has(key.toUpperCase() as any)) { |
| 106 | return true |
| 107 | } |
| 108 | |
| 109 | // Check common aliases |
| 110 | const aliases: Record<string, boolean> = { |
| 111 | Esc: true, |
| 112 | Return: true, |
| 113 | Space: true, |
| 114 | ' ': true, |
| 115 | Del: true, |
| 116 | Up: true, |
| 117 | Down: true, |
| 118 | Left: true, |
| 119 | Right: true, |
| 120 | } |
| 121 | |
| 122 | return key in aliases |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Validates a hotkey and throws an error if invalid. |
no outgoing calls
no test coverage detected
searching dependent graphs…