impl all
This commit is contained in:
@@ -4,6 +4,8 @@ import "regexp"
|
||||
|
||||
type Like func(Delta) bool
|
||||
|
||||
type likes []Like
|
||||
|
||||
func LikeAcc(pattern string) Like {
|
||||
return func(d Delta) bool {
|
||||
return like(pattern, d.Account)
|
||||
@@ -13,3 +15,12 @@ func LikeAcc(pattern string) Like {
|
||||
func like(pattern string, other string) bool {
|
||||
return regexp.MustCompile(pattern).MatchString(other)
|
||||
}
|
||||
|
||||
func (likes likes) all(delta Delta) bool {
|
||||
for i := range likes {
|
||||
if !likes[i](delta) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user