DeepClean
Provide functionality to exclude elements in nested maps or list.
Installation
If available in Hex, the package can be installed
by adding deep_clean to your list of dependencies in mix.exs:
def deps do
[{:deep_clean, "~> 0.1.1"}]
endDocumentation can be generated with ExDoc and published on HexDocs. The docs can be found at https://hexdocs.pm/deep_clean.
Usage
Simply call the DeepClean.exclude_in/2 function sending the following params:
deep_elem: a map or list with nested elementsclean_list: a list with the keys to be exclude from the deep_elem separated by dots by each nested level
Example
iex> DeepClean.exclude_in(%{a: %{aa: 1, ab: 2}, b: %{ba: 3, bb: 4}}, ["a.ab", "b.bb"])
.. > %{a: %{aa: 1}, b: %{ba: 3}}
iex> DeepClean.exclude_in(%{a: [%{aa: 1, ab: 2}, %{aa: 11, ab: 22},], b: [%{ba: 3, bb: 4}, %{ba: 33, bb: 44}]}, ["a.ab", "b.bb"])
.. > %{a: [%{aa: 1}, %{aa: 11}], b: [%{ba: 3}, %{ba: 33}]}