ChemPal Documentation - v1.6.0
    Preparing search index...

    Function normalizeKey

    • Normalizes a single binding token (e.g. "UpArrow", "Esc", "A") to the lowercased KeyboardEvent.key value it should match. Unknown tokens map to their own lowercased form.

      Parameters

      • token: string

        A raw key token from a binding string.

      Returns string

      The normalized key, comparable against a lowercased event.key.

      normalizeKey("UpArrow"); // "arrowup"
      normalizeKey("Esc"); // "escape"
      normalizeKey("A"); // "a"
      export function normalizeKey(token: string): string {
      const lower = token.trim().toLowerCase();
      return KEY_ALIASES[lower] ?? lower;
      }