expug v0.9.2 Expug.Visitor View Source

Internal helper for traversing an AST.

iex> node = %{
...>   title: "Hello",
...>   children: [
...>     %{title: "fellow"},
...>     %{title: "humans"}
...>   ]
...> }
iex> Expug.Visitor.visit(node, fn node ->
...>   {:ok, Map.update(node, :title, ".", &(&1 <> "."))}
...> end)
%{
   title: "Hello.",
   children: [
     %{title: "fellow."},
     %{title: "humans."}
   ]
}

Link to this section Summary

Functions

Returns a function fun recursively across node and its descendants

Visits all children lists recursively across node and its descendants

Link to this section Functions

Returns a function fun recursively across node and its descendants.

Link to this function visit_children(node, fun) View Source

Visits all children lists recursively across node and its descendants.

Works just like visit/2, but instead of operating on nodes, it operates on node children (lists).