MCPcopy
hub / github.com/github/hotkey / localizeMod

Function localizeMod

src/hotkey.ts:91–97  ·  view source on GitHub ↗
(hotkey: string, platform?: string | undefined)

Source from the content-addressed store, hash-verified

89const matchApplePlatform = /Mac|iPod|iPhone|iPad/i
90
91function localizeMod(hotkey: string, platform?: string | undefined): string {
92 const ssrSafeWindow = typeof window === 'undefined' ? undefined : window
93 const safePlatform = platform ?? ssrSafeWindow?.navigator.platform ?? ''
94
95 const localModifier = matchApplePlatform.test(safePlatform) ? 'Meta' : 'Control'
96 return hotkey.replace('Mod', localModifier)
97}
98
99const orderedModifiers: Partial<Record<string, number>> = {
100 Control: 0,

Callers 1

normalizeHotkeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected