mayo v0.2.0 Mayo.Number
Summary
Functions
Check if the number is even
Check if the number is a float
Checks if the number is greater than the limit
Check if the number is an integer
Checks if the number is less than the limit
Checks the maximum value of a number
Checks the minimum value of a number
Checks if the number is negative
Check if the number is odd
Checks if the number is positive
Functions
Check if the number is even.
iex> Mayo.Number.even(2)
2
iex> Mayo.Number.even(1)
{:error, %Mayo.Error{type: "number.even"}}
Check if the number is a float.
iex> Mayo.Number.float(3.14)
3.14
iex> Mayo.Number.float(3)
{:error, %Mayo.Error{type: "number.float"}}
Checks if the number is greater than the limit.
iex> Mayo.Number.greater(4, 3)
4
iex> Mayo.Number.greater(3, 3)
{:error, %Mayo.Error{type: "number.greater"}}
Check if the number is an integer.
iex> Mayo.Number.integer(2)
2
iex> Mayo.Number.integer(3.14)
{:error, %Mayo.Error{type: "number.integer"}}
Checks if the number is less than the limit.
iex> Mayo.Number.less(2, 3)
2
iex> Mayo.Number.less(3, 3)
{:error, %Mayo.Error{type: "number.less"}}
Checks the maximum value of a number.
iex> Mayo.Number.max(4, 5)
4
iex> Mayo.Number.max(6, 5)
{:error, %Mayo.Error{type: "number.max"}}
Checks the minimum value of a number.
iex> Mayo.Number.min(4, 3)
4
iex> Mayo.Number.min(1, 3)
{:error, %Mayo.Error{type: "number.min"}}
Checks if the number is negative.
iex> Mayo.Number.negative(-2)
-2
iex> Mayo.Number.negative(0)
0
iex> Mayo.Number.negative(2)
{:error, %Mayo.Error{type: "number.negative"}}
Check if the number is odd.
iex> Mayo.Number.odd(1)
1
iex> Mayo.Number.odd(2)
{:error, %Mayo.Error{type: "number.odd"}}