potion v0.0.2 Potion

Summary

Functions

Determines if the value is empty

Functions

empty?(data)
empty?(any) :: boolean

Determines if the value is empty.

Examples

iex> Potion.empty?([])
true
iex> Potion.empty?(%{})
true
iex> Potion.empty?({})
true
iex> Potion.empty?("")
true
iex> Potion.empty?(nil)
true
iex> Potion.empty?(false)
true

iex> Potion.empty?([1,2])
false
iex> Potion.empty?(%{map: "some content"})
false
iex> Potion.empty?({1, 2})
false
iex> Potion.empty?("some content")
false
iex> Potion.empty?(1)
false
iex> Potion.empty?(true)
false
get(data, key, default \\ nil)
get(any, String.t | Integer.t | Atom.t, any) :: any

Examples

iex> Potion.empty?(Potion.get([1,2,3], 0))
1
iex> Potion.empty?(Potion.get([1,2,3], 4))
nil
iex> Potion.empty?(Potion.get({1,2,3}, 0))
1
iex> Potion.get(%{map: "some content"}, :map)
"some content"
iex> Potion.empty?(Potion.get([1,2,3], 4, 0))
0