Emoshi (Emoshi v0.1.0)

View Source

Main module to query and access emoji data.

See https://www.unicode.org/reports/tr51/ for information about emojis.

Summary

Functions

Returns the closest emojis by slug.

Returns all emojis for the given group

Returns all emojis for the given groups

Returns all emojis for the given group and subgroup(s).

Returns whether an emoji group exists

Returns all the emojis' groups

Returns all Emoshi.t/0 where the slug matches the input argument.

Returns all the subgroups for a group or nil if the group does not exist

Returns the specs version used to generate the module

Types

emoji_status()

@type emoji_status() ::
  :unqualified | :fully_qualified | :minimally_qualified | :component

t()

@type t() :: %Emoshi{
  emoji: String.t(),
  group: String.t(),
  name: String.t(),
  slug: String.t(),
  status: emoji_status(),
  subgroup: String.t()
}

Functions

closest(search_slug, opts \\ [])

@spec closest(String.t(), Keyword.t()) :: [t()]

Returns the closest emojis by slug.

Uses String.jaro_distance/2 internally to find the closest emojis.

Options

  • :ignore_variations - boolean/0. Whether to ignore variations such as skin color. Defaults to true.
  • :take- pos_integer/0. The number of emojis to retrieve. Defaults to 5

for_group(group)

@spec for_group(String.t()) :: [t()]

Returns all emojis for the given group

for_groups(groups)

@spec for_groups([String.t(), ...]) :: [t()]

Returns all emojis for the given groups

for_subgroups(group, subgroups)

@spec for_subgroups(String.t(), String.t() | [String.t(), ...]) :: [t()]

Returns all emojis for the given group and subgroup(s).

Accepts both a single subgroup and a list of subgroups

group?(group_name)

@spec group?(String.t()) :: boolean()

Returns whether an emoji group exists

groups()

@spec groups() :: [String.t()]

Returns all the emojis' groups

search(search_slug, opts \\ [])

@spec search(String.t(), Keyword.t()) :: [t()]

Returns all Emoshi.t/0 where the slug matches the input argument.

Unlike closest/2 this function checks for substring comparison.

Options

  • :ignore_variations - boolean/0. Whether to ignore variations such as skin color. Defaults to true.
  • :take - pos_integer/0. The maximum number of emojis to retrieve. Keep in mind that unlike closest/2 which always returns the specified :take number, this function may return fewer results if there are not enough matches. Defaults to 5

subgroups(group)

@spec subgroups(String.t()) :: [String.t()] | nil

Returns all the subgroups for a group or nil if the group does not exist

version()

@spec version() :: String.t()

Returns the specs version used to generate the module