would you believe that I'm adding even more generics

This commit is contained in:
Jesse Duffield
2022-03-19 19:51:48 +11:00
parent 1b75ed3740
commit 94a53484a1
14 changed files with 62 additions and 51 deletions

View File

@@ -200,10 +200,7 @@ func getLeaves(node INode) []INode {
return []INode{node}
}
output := []INode{}
for _, child := range node.GetChildren() {
output = append(output, getLeaves(child)...)
}
return output
return slices.FlatMap(node.GetChildren(), func(child INode) []INode {
return getLeaves(child)
})
}