# `Unicode.JoiningType`
[🔗](https://github.com/elixir-unicode/unicode/blob/v2.0.0/lib/unicode/property/joining_type.ex#L1)

Functions to introspect the Unicode joining type property for binaries (Strings) and codepoints.

The primary API is `joining_type/1` which returns the joining type for a codepoint or the list of joining types for a string.

The functions `fetch/1`, `get/1` and `count/1` provide introspection of the codepoint ranges associated with a given joining type. `joining_types/0`, `known_joining_types/0` and `aliases/0` return the underlying property data.

# `aliases`

Returns a map of aliases for Unicode joining types.

An alias is an alternative name for referring to a joining type. Aliases are resolved by the `fetch/1` and `get/1` functions.

### Returns

* A map with the alias as a string key and the joining type name as an atom value.

### Examples

    iex> Unicode.JoiningType.aliases() |> Map.get("dualjoining")
    :d

# `count`

Returns the count of the number of characters for a given joining type.

### Arguments

* `joining_type` is any joining type name as an atom, or a string alias for a joining type.

### Returns

* The number of codepoints that have the given joining type.

* `:error` if the joining type name is not known.

### Examples

    iex> Unicode.JoiningType.count(:d)
    615

# `fetch`

Returns the Unicode codepoint ranges for a given joining type.

Aliases are resolved by this function.

### Arguments

* `joining_type` is any joining type name as an atom, or a string alias for a joining type.

### Returns

* `{:ok, range_list}` where `range_list` is a list of codepoint ranges as 2-tuples.

* `:error` if the joining type name is not known.

### Examples

    iex> Unicode.JoiningType.fetch(:c)
    {:ok, [{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]}

    iex> Unicode.JoiningType.fetch(:invalid)
    :error

# `get`

Returns the Unicode codepoint ranges for a given joining type.

Aliases are resolved by this function.

### Arguments

* `joining_type` is any joining type name as an atom, or a string alias for a joining type.

### Returns

* `range_list` which is a list of codepoint ranges as 2-tuples.

* `nil` if the joining type name is not known.

### Examples

    iex> Unicode.JoiningType.get(:c)
    [{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]

    iex> Unicode.JoiningType.get(:invalid)
    nil

# `joining_type`

Returns the joining type name(s) for the given binary or codepoint.

### Arguments

* `codepoint_or_string` is either an integer codepoint or a string.

### Returns

* In the case of a codepoint, a single joining type name as an atom. Codepoints with no explicit `Joining_Type` assignment default to `:u` (Non_Joining).

* In the case of a string, a list of the distinct joining type names represented by the codepoints in the string.

### Examples

    iex> Unicode.JoiningType.joining_type(?A)
    :u

    iex> Unicode.JoiningType.joining_type(0x0628)
    :d

# `joining_types`

Returns the map of Unicode joining types.

### Returns

* A map with the joining type name as the key and a list of codepoint ranges as 2-tuples as the value.

### Examples

    iex> Unicode.JoiningType.joining_types() |> Map.get(:c)
    [{1600, 1600}, {2042, 2042}, {2179, 2181}, {6154, 6154}, {8205, 8205}]

# `known_joining_types`

Returns a list of known Unicode joining type names.

This function does not return the names of any joining type aliases.

### Returns

* A list of joining type names as atoms.

### Examples

    iex> Unicode.JoiningType.known_joining_types() |> Enum.sort()
    [:c, :d, :l, :r, :t]

---

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