Skip to content

normalizeKey

normalizeKey(key): string

Defined in: extensions/commands/utils.ts:27

Normalizes modifier keys to a bitmask that’s used by getKeysFromEvent. All keys are case insensitive.

Rules:

  • alt1
  • ctrl or control2
  • meta or cmd4
  • shift8
  • mod4 on Mac, 2 otherwise

string

Key to normalize.

string

Normalized and lowercase key.

normalizeKey("a") // "0+a"
normalizeKey("+") // "0++"
normalizeKey("ctrl+alt+a") // "3+a"
normalizeKey("10+ALT+a") // "11+a"
normalizeKey("shift+alt+12+a") // "13+a"