MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / normalizeKeyName

Function normalizeKeyName

packages/app-core/src/lib/keymaps.ts:1188–1204  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

1186}
1187
1188function normalizeKeyName(key: string): string | null {
1189 if (!key) return null;
1190 if (isModifierKey(key)) return null;
1191 if (key === " ") return "Space";
1192 if (/^esc(?:ape)?$/i.test(key)) return "Escape";
1193 if (/^(return|enter)$/i.test(key)) return "Enter";
1194 if (/^tab$/i.test(key)) return "Tab";
1195 if (/^arrowup$/i.test(key)) return "ArrowUp";
1196 if (/^arrowdown$/i.test(key)) return "ArrowDown";
1197 if (/^arrowleft$/i.test(key)) return "ArrowLeft";
1198 if (/^arrowright$/i.test(key)) return "ArrowRight";
1199 if (key.length === 1) {
1200 if (/[A-Za-z]/.test(key)) return key.toUpperCase();
1201 return key;
1202 }
1203 return key;
1204}
1205
1206function normalizeSequenceBaseToken(key: string): string | null {
1207 if (!key) return null;

Callers 2

normalizeShortcutBindingFunction · 0.85
shortcutBindingFromEventFunction · 0.85

Calls 1

isModifierKeyFunction · 0.85

Tested by

no test coverage detected