feat(NodePath.prune): add a new method to NodePath `prune`

This method removes a node and its parent if the parent has no other child nodes.