package sway func (n Node) FindAll(condition func(n Node) bool) []Node { nodes := make([]Node, 0, 10) if condition(n) { nodes = append(nodes, n) } for _, child := range n.Nodes { nodes = append(nodes, child.FindAll(condition)...) } for _, child := range n.FloatingNodes { nodes = append(nodes, child.FindAll(condition)...) } return nodes } func IsOutput(n Node) bool { return n.Type == NodeTypeOutput } func IsWorkspace(n Node) bool { return n.Type == NodeTypeWorkspace } func IsContainer(n Node) bool { return n.Type == NodeTypeCon }