MCPcopy Create free account
hub / github.com/TanStack/devtools / normalizeHotkey

Function normalizeHotkey

packages/devtools/src/utils/hotkey.ts:7–19  ·  view source on GitHub ↗
(
  keys: Array<KeyboardKey>,
)

Source from the content-addressed store, hash-verified

5/** Expands CtrlOrMeta into separate Control and Meta variants */
6export 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

Callers 2

hotkey.test.tsFile · 0.90
getHotkeyPermutationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected