refactor: replace explicit fields with tag-based property system
This commit is contained in:
@@ -6,11 +6,11 @@ import (
|
||||
"slices"
|
||||
)
|
||||
|
||||
var mentionRegex = regexp.MustCompile(`@([a-z0-9_]+)`)
|
||||
var r = regexp.MustCompile(`@([a-z0-9_]+)`)
|
||||
|
||||
func Mentions(text string) []string {
|
||||
func Mentions(t string) []string {
|
||||
seen := make(map[string]bool)
|
||||
for _, m := range mentionRegex.FindAllStringSubmatch(text, -1) {
|
||||
for _, m := range r.FindAllStringSubmatch(t, -1) {
|
||||
seen[m[1]] = true
|
||||
}
|
||||
return slices.Collect(maps.Keys(seen))
|
||||
|
||||
Reference in New Issue
Block a user