fix(NodePath.prune): make `prune` more defensive, code review suggestions.