# `Yex.MapPrelim`
[🔗](https://github.com/satoren/y_ex/blob/main/lib/shared_type/map.ex#L399)

A preliminary map representation used for initializing map content.
This module provides functionality for creating map content before it is
inserted into a shared document.

## Use Cases
- Creating map content before inserting into a document
- Serializing map content for transfer between documents
- Initializing map content with specific key-value pairs
- Preparing nested data structures for shared documents

## Examples
    iex> doc = Yex.Doc.new()
    iex> array = Yex.Doc.get_array(doc, "array")
    iex> Yex.Array.insert(array, 0, Yex.MapPrelim.from(%{ "key" => "value" }))
    iex> {:ok, %Yex.Map{} = map} = Yex.Array.fetch(array, 0)
    iex> Yex.Map.fetch(map, "key")
    {:ok, "value"}

# `t`

```elixir
@type t() :: %Yex.MapPrelim{map: %{required(binary()) =&gt; Yex.input_type()}}
```

# `from`

```elixir
@spec from(%{required(binary()) =&gt; Yex.input_type()} | [{binary(), Yex.input_type()}]) ::
  t()
```

Creates a new MapPrelim from an Elixir map.
This is useful when you want to initialize a shared map with predefined content.

## Parameters
  * `map` - An Elixir map to convert to a preliminary map

## Examples
    iex> prelim = Yex.MapPrelim.from(%{"key" => "value", "nested" => %{"inner" => "data"}})
    iex> doc = Yex.Doc.new()
    iex> map = Yex.Doc.get_map(doc, "map")
    iex> Yex.Map.set(map, "content", prelim)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
