This commit is contained in:
Bel LaPointe
2023-10-23 10:38:28 -06:00
parent 078c425d9e
commit e5bc3b3840
3 changed files with 22 additions and 9 deletions

View File

@@ -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
}