Mandrake v0.0.2 Mandrake.Type

Mandrake functions for types.

Summary

Functions

Returns the extension of the tuple with the second

Always return false

Always return true

Create a copy of a value

Returns true if value is not nil

Returns true if value is nil or false

Returns true if value is nil

Returns a function that split a string with the given pattern

Removes whitespace at the beginning and at the end of the string

Returns true if value is not nil or false

Returns type of value

Functions

assign(first_tuple, second_tuple)

Returns the extension of the tuple with the second.

Examples

iex>  Mandrake.Type.assign({ "prop1", "prop2" }, { "prop3" })
{ "prop1", "prop2", "prop3" }
bool_false()

Always return false.

Examples

iex>  Mandrake.Type.bool_false()
false
bool_true()

Always return true.

Examples

iex>  Mandrake.Type.bool_true()
true
clone(object)

Create a copy of a value.

Examples

iex>  Mandrake.Type.clone([1, 2, 3, 4, 5])
[1, 2, 3, 4, 5]
exists(value)

Returns true if value is not nil.

Examples

iex>  Mandrake.Type.exists("Example")
true
iex>  Mandrake.Type.exists(nil)
false
falsy(value)

Returns true if value is nil or false.

Examples

iex>  Mandrake.Type.falsy("Example")
false
iex>  Mandrake.Type.falsy(nil)
true
is_nil(value)

Returns true if value is nil.

Examples

iex>  Mandrake.Type.is_nil([])
false
iex>  Mandrake.Type.is_nil(nil)
true
split(pattern)

Returns a function that split a string with the given pattern.

Examples

iex>  splitComma = Mandrake.Type.split(",")
...>  splitComma.("a,b,c")
["a", "b", "c"]
trim(string)

Removes whitespace at the beginning and at the end of the string.

Examples

iex>  Mandrake.Type.trim("   Example   ")
"Example"
truthy(value)

Returns true if value is not nil or false.

Examples

iex>  Mandrake.Type.truthy("Example")
true
iex>  Mandrake.Type.truthy(nil)
false
type_of(value)

Returns type of value.

Examples

iex>  Mandrake.Type.type_of(42.0)
Float