rebuildRecursive function

Node Function(Node) rebuildRecursive(
  1. Node f(
    1. Node
    )
)

Applies f to all children of this node, recursively.

Use this alongside rebuild.

Implementation

Node Function(Node) rebuildRecursive(Node Function(Node) f) {
  Node _build(Node node) {
    return NodeBuilder.from(f(node)).mapChildren(_build).build();
  }

  return _build;
}