本页还没有译文
本页 14 段还没译成日本語,下面显示的是英文原文。isSingleLetterKey
还没翻译译自英文(tanstack.com)本页 14 段都还没译
function isSingleLetterKey(key): boolean;Defined in: constants.ts:419
Normalizes a key name to its canonical form.
Converts various key name formats (aliases, case variations) into the standard canonical names used throughout the library. This enables a more forgiving API where users can write keys in different ways and still get correct behavior.
Normalization rules:
- Check aliases first (e.g., 'Esc' → 'Escape', 'Del' → 'Delete')
- Single letters → uppercase (e.g., 'a' → 'A', 's' → 'S')
- Function keys → uppercase (e.g., 'f1' → 'F1', 'F12' → 'F12')
- Other keys → returned as-is (already canonical or unknown)
Parameters
key
string
The key name to normalize (can be an alias, lowercase, etc.)
Returns
boolean
The canonical key name
Example
normalizeKeyName('esc') // 'Escape'
normalizeKeyName('a') // 'A'
normalizeKeyName('f1') // 'F1'
normalizeKeyName('ArrowUp') // 'ArrowUp' (already canonical)AI 翻译查看英文原文