-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ff.Filter, ff.MapFilter, pipe.MapFilter[SrcT, DstT]
- Loading branch information
Dima Kossovich
committed
Jan 21, 2024
1 parent
ac47a8d
commit 3162bf1
Showing
6 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ff | ||
|
||
import "github.com/koss-null/funcfrog/pkg/pipe" | ||
|
||
// Filter is a short way to create a Pipe from a slice of SrcT applying Filter function fn. | ||
func Filter[SrcT any](a []SrcT, fn func(*SrcT) bool) pipe.Piper[SrcT] { | ||
return pipe.Slice(a).Filter(fn) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ff | ||
|
||
import "github.com/koss-null/funcfrog/pkg/pipe" | ||
|
||
// MapFilter is a short way to create a Pipe of DstT from a slice of SrcT applying MapFilter function fn. | ||
func MapFilter[SrcT, DstT any](a []SrcT, fn func(SrcT) (DstT, bool)) pipe.Piper[DstT] { | ||
return pipe.MapFilter(pipe.Slice(a), fn) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters