• Parse a keystroke into its constituent components.

    Parameters

    • keystroke: string

      The keystroke of interest.

    Returns IKeystrokeParts

    The parsed components of the keystroke.

    Notes

    The keystroke should be of the form: [<modifier 1> [<modifier 2> [<modifier N> ]]]<primary key>

    The supported modifiers are: Accel, Alt, Cmd, Ctrl, and Shift. The Accel modifier is translated to Cmd on Mac and Ctrl on all other platforms.

    The parsing is tolerant and will not throw exceptions. Notably:

    • Duplicate modifiers are ignored.
    • Extra primary keys are ignored.
    • The order of modifiers and primary key is irrelevant.
    • The keystroke parts should be separated by whitespace.
    • The keystroke is case sensitive.