MCPcopy Create free account
hub / github.com/TanStack/hotkeys / hasNonModifierKey

Function hasNonModifierKey

packages/hotkeys/src/parse.ts:316–328  ·  view source on GitHub ↗
(
  hotkey: Hotkey | ParsedHotkey | (string & {}),
  platform: 'mac' | 'windows' | 'linux' = detectPlatform(),
)

Source from the content-addressed store, hash-verified

314 * ```
315 */
316export function hasNonModifierKey(
317 hotkey: Hotkey | ParsedHotkey | (string & {}),
318 platform: 'mac' | 'windows' | 'linux' = detectPlatform(),
319): boolean {
320 const parsed =
321 typeof hotkey === 'string' ? parseHotkey(hotkey, platform) : hotkey
322
323 // Check if the key part is actually a modifier
324 const keyIsModifier = isModifierKey(parsed.key)
325
326 // A valid hotkey must have a non-modifier key
327 return !keyIsModifier && parsed.key.length > 0
328}

Callers 1

hotkeyChordFromKeydownFunction · 0.90

Calls 3

detectPlatformFunction · 0.90
parseHotkeyFunction · 0.85
isModifierKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…