lofi v0.1.5 Lofi.Tags
Utilities for working with Lofi element tags
Summary
Functions
Fetches the value for a specific name
in the given tags
Get value for a content tag
Check whether a tags map has a certain flag tag
Functions
Fetches the value for a specific name
in the given tags
iex> Lofi.Tags.fetch_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "name")
{:ok, %{texts: ["Alice Jones"]}}
iex> Lofi.Tags.fetch_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "abc")
{:error, :not_content}
iex> Lofi.Tags.fetch_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "def")
{:error, :missing}
Get value for a content tag
iex> Lofi.Tags.get_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "name")
%{texts: ["Alice Jones"]}
iex> Lofi.Tags.get_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "abc")
nil
iex> Lofi.Tags.get_content(%{"name" => {:content, %{texts: ["Alice Jones"]}}, "abc" => {:flag, true}}, "abc", "default")
"default"