# `Machete.MapMatcher`
[🔗](https://github.com/mtrudel/machete/blob/main/lib/machete/matchers/map_matcher.ex#L1)

Defines a matcher that matches maps

# `opts`

```elixir
@type opts() :: [
  keys: Machete.Matchable.t(),
  values: Machete.Matchable.t(),
  size: non_neg_integer(),
  min: non_neg_integer(),
  max: non_neg_integer()
]
```

Describes the arguments that can be passed to this matcher

# `t`

```elixir
@opaque t()
```

Describes an instance of this matcher

# `map`

```elixir
@spec map(opts()) :: t()
```

Matches maps. Useful for cases where you wish to match against the general shape / size of
a map, but cannot match against a literal map (or use the `Machete.Superset` / `Machete.Subset`
matchers)

Takes the following arguments:

* `keys`: A matcher to use against all keys in the map
* `values`: A matcher to use against all values in the map
* `size`: Requires the matched map to be exactly the specified size
* `min`: Requires the matched map to be greater than or equal to the specified size
* `max`: Requires the matched map to be less than or equal to the specified size

Examples:

    iex> assert %{a: 1} ~> map()
    true

    iex> assert %{a: 1} ~> map(keys: atom())
    true

    iex> assert %{a: 1} ~> map(values: integer())
    true

    iex> assert %{a: 1} ~> map(size: 1)
    true

    iex> assert %{a: 1} ~> map(min: 1)
    true

    iex> assert %{a: 1} ~> map(max: 2)
    true

---

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