View Source Flamel.Map.Indifferent (flamel v1.5.0)

Summary

Functions

Get a value from a map whether the key is a string or atom

Functions

Link to this function

get(map, key, default \\ nil)

View Source

Get a value from a map whether the key is a string or atom

Examples

iex> Flamel.Map.Indifferent.get(%{test: "value"}, "test")
"value"

iex> Flamel.Map.Indifferent.get(%{test: "value"}, :test)
"value"

iex> Flamel.Map.Indifferent.get(%{"test" => "value"}, :test)
"value"

iex> Flamel.Map.Indifferent.get(%{"test" => "value"}, "test")
"value"

iex> Flamel.Map.Indifferent.get(%{"test" => "value"}, "does-not-exist", "default")
"default"