FindEachWithBreak functions the same as FindEach but allows to break the loop by returning false from the callback function `cb`. Important: this method is deprecated, instead, use .. = range Find(){}.
(top *Node, expr string, cb func(int, *Node) bool)
| 136 | // by returning false from the callback function `cb`. |
| 137 | // Important: this method is deprecated, instead, use .. = range Find(){}. |
| 138 | func FindEachWithBreak(top *Node, expr string, cb func(int, *Node) bool) { |
| 139 | for i, n := range Find(top, expr) { |
| 140 | if !cb(i, n) { |
| 141 | break |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | type NodeNavigator struct { |
| 147 | root, curr *Node |