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

Callers 2

hotkey.test.tsFile · 0.90
getHotkeyPermutationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected