re: Are there functions similar to Ruby's `dig` in other languages? VIEW POST

FULL DISCUSSION
 

In Elixir use Kernel.get_in/2 for maps

iex(1)> m = %{foo: %{bar: %{baz: 1}}}
%{foo: %{bar: %{baz: 1}}}
iex(2)> get_in m, [:foo, :bar, :baz]
1
iex(3)> get_in m, [:foo, :zot]
nil
code of conduct - report abuse