Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 1.26 KB

File metadata and controls

49 lines (31 loc) · 1.26 KB
id rawHotkeyToParsedHotkey
title rawHotkeyToParsedHotkey

Function: rawHotkeyToParsedHotkey()

function rawHotkeyToParsedHotkey(raw, platform): ParsedHotkey;

Defined in: parse.ts:106

Converts a RawHotkey object to a ParsedHotkey. Optional modifier booleans default to false; modifiers array is derived from them. When mod is true, it is resolved to Control or Meta based on platform.

Parameters

raw

RawHotkey

The raw hotkey object

platform

The target platform for resolving 'Mod' (defaults to auto-detection)

"mac" | "windows" | "linux"

Returns

ParsedHotkey

A ParsedHotkey suitable for matching and formatting

Example

rawHotkeyToParsedHotkey({ key: 'Escape' })
// { key: 'Escape', ctrl: false, shift: false, alt: false, meta: false, modifiers: [] }

rawHotkeyToParsedHotkey({ key: 'S', mod: true }, 'mac')
// { key: 'S', ctrl: false, shift: false, alt: false, meta: true, modifiers: ['Meta'] }

rawHotkeyToParsedHotkey({ key: 'S', mod: true, shift: true }, 'windows')
// { key: 'S', ctrl: true, shift: true, alt: false, meta: false, modifiers: ['Control', 'Shift'] }