Warpath.delete
You're seeing just the function
delete
, go back to Warpath module for more information.
Specs
Remove an item(s) from a nested data structure via the given selector
.
If the selector does not evaluate anything, it returns the data structure unchanged.
This function rely on
Access
behaviour, that means structs must implement that behaviour to got support.
Examples
iex> users = %{"john" => %{"age" => 27, "country" => "Brasil"}, "meg" => %{"age" => 23, "country" => "U.K"}}
...> Warpath.delete(users, "$..age")
{:ok, %{"john" => %{"country" => "Brasil"}, "meg" => %{"country" => "U.K"}}}
iex> numbers = %{"numbers" => [20, 3, 50, 6, 7]}
...> Warpath.delete(numbers, "$.numbers[?(@ < 10)]")
{:ok, %{"numbers" => [20, 50]}}
iex> users = %{"john" => %{"age" => 27}, "meg" => %{"age" => 23}}
...> Warpath.delete(users, "$..city")
{:ok, %{"john" => %{"age" => 27}, "meg" => %{"age" => 23}}} # Unchanged