Iconify.Set (Iconify v0.3.0)

Copy Markdown View Source

Represents an Iconify icon set (collection of icons with a common prefix).

Summary

Functions

Returns the number of icons in the set (excluding aliases).

Gets an icon from the set by name, resolving aliases and alias transformations.

Gets an icon from the set by name, raising if not found.

Checks if an icon exists in the set.

Lists all icon names in the set (excluding aliases).

Lists all icon names including aliases.

Loads an icon set from a JSON file.

Loads an icon set from a JSON file, raising on error.

Parses an icon set from a JSON string (IconifyJSON format).

Parses an icon set from decoded IconifyJSON data.

Types

t()

@type t() :: %Iconify.Set{
  aliases: %{required(String.t()) => map()},
  categories: map() | nil,
  chars: map() | nil,
  height: pos_integer(),
  icons: %{required(String.t()) => Iconify.Icon.t()},
  info: map() | nil,
  last_modified: integer() | nil,
  left: integer(),
  not_found: [String.t()],
  prefix: String.t(),
  prefixes: map() | nil,
  provider: String.t() | nil,
  suffixes: map() | nil,
  themes: map() | nil,
  top: integer(),
  width: pos_integer()
}

Functions

count(set)

@spec count(t()) :: non_neg_integer()

Returns the number of icons in the set (excluding aliases).

get(set, name)

@spec get(t(), String.t()) :: {:ok, Iconify.Icon.t()} | :error

Gets an icon from the set by name, resolving aliases and alias transformations.

get!(set, name)

@spec get!(t(), String.t()) :: Iconify.Icon.t()

Gets an icon from the set by name, raising if not found.

has?(set, name)

@spec has?(t(), String.t()) :: boolean()

Checks if an icon exists in the set.

list(set)

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

Lists all icon names in the set (excluding aliases).

list_all(set)

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

Lists all icon names including aliases.

load(path)

@spec load(Path.t()) :: {:ok, t()} | {:error, term()}

Loads an icon set from a JSON file.

load!(path)

@spec load!(Path.t()) :: t()

Loads an icon set from a JSON file, raising on error.

parse(json)

@spec parse(String.t()) :: {:ok, t()} | {:error, term()}

Parses an icon set from a JSON string (IconifyJSON format).

parse_data(data)

@spec parse_data(map()) :: {:ok, t()} | {:error, term()}

Parses an icon set from decoded IconifyJSON data.