BootEnv v0.1.1 BootEnv.Util View Source
Link to this section Summary
Link to this section Functions
Link to this function
deep_get!(some, list) View Source
Strict get_in/2 function to fetch
deep data from map/keyword list
Examples
iex> BootEnv.Util.deep_get!(%{foo: [bar: 123]}, [:foo, :bar])
123
iex> BootEnv.Util.deep_get!(%{foo: [bar: 123]}, [:foo, :bar, :baz])
** (BootEnv.Exception.InvalidConfig) 123
iex> BootEnv.Util.deep_get!(%{foo: [bar: 123]}, [:foo, :hello])
** (BootEnv.Exception.MissingParam) :hello
iex> BootEnv.Util.deep_get!(%{foo: [bar: 123]}, [:hello])
** (BootEnv.Exception.MissingParam) :hello
Link to this function
deep_put(acc, list, v) View Source
Safe put_in/2 function to put
value to nested map
Examples
iex> BootEnv.Util.deep_put(%{foo: 123}, [:bar, :baz], 321)
%{foo: 123, bar: %{baz: 321}}
iex> BootEnv.Util.deep_put(%{foo: %{hello: 123}}, [:foo, :bar, :baz], 321)
%{foo: %{hello: 123, bar: %{baz: 321}}}