potion v0.0.3 Potion
Summary
Functions
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
Examples
iex> Potion.get([1,2,3], 0)
1
iex> Potion.get([1,2,3], 4)
nil
iex> Potion.get({1,2,3}, 0)
1
iex> Potion.get(%{map: "some content"}, :map)
"some content"
iex> Potion.get([1,2,3], 4, 0)
0
Examples
iex> Potion.put([1], 2)
[1,2]
iex> Potion.put([1], [2])
[1,2]
iex> Potion.put(%{map: "some content"}, add: "some content")
%{map: "some content", add: "some content"}
iex> Potion.put(%{map: "some content"}, [add: "some content"])
%{map: "some content", add: "some content"}
iex> Potion.put(%{map: "some content"}, %{add: "some content"})
%{map: "some content", add: "some content"}
iex> Potion.put(%{map: "some content"}, %{map: "some content!"})
%{map: "some content!"}
iex> Potion.put({1,2,3}, 4)
{1,2,3,4}
Examples
iex> Potion.put_first([1], 2)
[2,1]
iex> Potion.put_first([1], [2])
[2,1]
iex> Potion.put_first(%{map: "some content"}, add: "some content")
%{add: "some content", map: "some content"}
iex> Potion.put_first(%{map: "some content"}, [add: "some content"])
%{add: "some content", map: "some content"}
iex> Potion.put_first(%{map: "some content"}, %{add: "some content"})
%{add: "some content", map: "some content"}
iex> Potion.put_first(%{map: "some content"}, %{map: "some content!"})
%{map: "some content"}
iex> Potion.put_first({1,2,3}, 4)
{4,1,2,3}