Activity-Relay/cli/contain.go
2021-06-18 09:25:55 +09:00

25 lines
459 B
Go

package main
import "github.com/yukimochi/Activity-Relay/models"
func contains(entries interface{}, finder string) bool {
switch entry := entries.(type) {
case string:
return entry == finder
case []string:
for i := 0; i < len(entry); i++ {
if entry[i] == finder {
return true
}
}
case []models.Subscription:
for i := 0; i < len(entry); i++ {
if entry[i].Domain == finder {
return true
}
}
return false
}
return false
}