FindLoaderID looks in the specified node and in all its children for a node with the specified loaderID and if found returns it. Returns nil if not found.
(id string)
| 282 | // for a node with the specified loaderID and if found returns it. |
| 283 | // Returns nil if not found. |
| 284 | func (n *Node) FindLoaderID(id string) INode { |
| 285 | |
| 286 | var finder func(parent INode, id string) INode |
| 287 | finder = func(parent INode, id string) INode { |
| 288 | pnode := parent.GetNode() |
| 289 | if pnode.loaderID == id { |
| 290 | return parent |
| 291 | } |
| 292 | for _, child := range pnode.children { |
| 293 | found := finder(child, id) |
| 294 | if found != nil { |
| 295 | return found |
| 296 | } |
| 297 | } |
| 298 | return nil |
| 299 | } |
| 300 | return finder(n, id) |
| 301 | } |
| 302 | |
| 303 | // Children returns the list of children. |
| 304 | func (n *Node) Children() []INode { |
no test coverage detected