mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 00:26:24 -04:00
Cleanup: simplify by using lo.FilterMap instead of separate calls to Filter and Map
This commit is contained in:
parent
706a6c0474
commit
4a8ab6f64e
|
|
@ -324,12 +324,8 @@ func (self *Node[T]) GetPathsMatching(predicate func(*Node[T]) bool) []string {
|
|||
}
|
||||
|
||||
func (self *Node[T]) GetFilePathsMatching(predicate func(*T) bool) []string {
|
||||
matchingFileNodes := lo.Filter(self.GetLeaves(), func(node *Node[T], _ int) bool {
|
||||
return predicate(node.File)
|
||||
})
|
||||
|
||||
return lo.Map(matchingFileNodes, func(node *Node[T], _ int) string {
|
||||
return node.GetPath()
|
||||
return lo.FilterMap(self.GetLeaves(), func(node *Node[T], _ int) (string, bool) {
|
||||
return node.GetPath(), predicate(node.File)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue