View Source Want.Boolean (want v1.18.0)
Performs type conversions to boolean values.
Summary
Types
Functions
Cast a value to a boolean.
Examples
iex> Want.Boolean.cast("true")
{:ok, true}
iex> Want.Boolean.cast("false")
{:ok, false}
iex> Want.Boolean.cast("TRUE")
{:ok, true}
iex> Want.Boolean.cast(1.0)
{:ok, true}
iex> Want.Boolean.cast(0)
{:ok, false}
iex> Want.Boolean.cast({:a, :b})
{:error, "Failed to convert value {:a, :b} to boolean."}
Callback implementation for Want.Type.cast/2
.