expug v0.7.3 Expug.Visitor

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."}
   ]
}

Summary

Functions

Returns a function fun recursively across node and its descendants

Visits all children lists recursively across node and its descendants

Functions

visit(node, fun)

Returns a function fun recursively across node and its descendants.

visit_children(node, fun)

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).