Search documentation of Plushie

# Plushie.Type.Key (Plushie v0.7.2)

Copy Markdown View Source

Event field type for keyboard key names.

Parses wire-format key name strings (PascalCase, e.g. `"ArrowRight"`, `"Escape"`) into Elixir atoms (`:arrow_right`, `:escape`). Single character keys pass through as strings (`"a"`, `"1"`).

Delegates to `Plushie.Protocol.Keys.parse_key/1` for the actual mapping.

## Examples

    iex> Plushie.Type.Key.parse("Escape")
    {:ok, :escape}

    iex> Plushie.Type.Key.parse("a")
    {:ok, "a"}

    iex> Plushie.Type.Key.parse(nil)
    :error

## Summary

### Functions

parse(value)

## Functions

# parse(value)

    @spec parse(value :: term()) :: {:ok, atom() | String.t()} | :error