support prefix search for ids and authors (nip01 update).

This commit is contained in:
fiatjaf
2022-02-08 16:44:33 -03:00
parent 86853004ef
commit 5266482b2a
2 changed files with 11 additions and 2 deletions

View File

@@ -62,6 +62,15 @@ func (haystack StringList) Contains(needle string) bool {
return false
}
func (haystack StringList) ContainsPrefixOf(needle string) bool {
for _, hay := range haystack {
if strings.HasPrefix(needle, hay) {
return true
}
}
return false
}
func (haystack IntList) Contains(needle int) bool {
for _, hay := range haystack {
if hay == needle {