# `Croma.SubtypeOfMap`
[🔗](https://github.com/skirino/croma/blob/main/lib/croma/subtype.ex#L437)

Helper module to define map-based types.
The following members are generated by `use Croma.SubtypeOfMap`:

- `@type t`
- `@spec valid?(term) :: boolean`
- If `key_module` and/or `value_module` exports `new/1`,
    - `@spec new(term) :: Croma.Result.t(t)`
    - `@spec new!(term) :: t`

Options:
- `:key_module` - A type module for keys.
- `:value_module` - A type module for values.
- `:min_size` - Minimum size of valid values of this type (inclusive).
- `:max_size` - Maximum size of valid values of this type (inclusive).
- `:default` - Default value for this type. Passing this option generates `default/0`.

## Examples
    defmodule MyMap do
      use Croma.SubtypeOfMap, key_module: MyString, value_module: MyInt, default: %{}
    end

---

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