16 lines
361 B
Elixir
16 lines
361 B
Elixir
defmodule BasketballWebsite do
|
|
def extract_from_path(data, path) do
|
|
path
|
|
|> String.split(".")
|
|
|> get_path(data)
|
|
end
|
|
|
|
defp get_path(_list, nil), do: nil
|
|
defp get_path([], data), do: data
|
|
defp get_path([head | tail], data), do: get_path(tail, data[head])
|
|
|
|
def get_in_path(data, path) do
|
|
get_in(data, String.split(path, "."))
|
|
end
|
|
end
|