mayo v0.1.0 Mayo.Any
Summary
Functions
Checks if the value is a boolean or true
, false
, yes
, no
,
on
, off
, 1
, 0
, 1, 0
Sets to the default value if the value is nil
Checks if the value is a number
Checks if the value is nil
Checks if the value is a string
Functions
Checks if the value is a boolean or true
, false
, yes
, no
,
on
, off
, 1
, 0
, 1, 0.
iex> Mayo.Any.boolean(true)
true
iex> Mayo.Any.boolean("yes")
true
iex> Mayo.Any.boolean("foo")
{:error, %Mayo.Error{type: "any.boolean"}}
Sets to the default value if the value is nil.
iex> Mayo.Any.default("test", "default")
"test"
iex> Mayo.Any.default(nil, "default")
"default"
Checks if the value is a number.
iex> Mayo.Any.number(23)
23
iex> Mayo.Any.number("test")
{:error, %Mayo.Error{type: "any.number"}}
Checks if the value is nil.
iex> Mayo.Any.required("test")
"test"
iex> Mayo.Any.required(nil)
{:error, %Mayo.Error{type: "any.required"}}