mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
27 lines
345 B
Go
27 lines
345 B
Go
package linkcheck
|
|
|
|
import "strings"
|
|
|
|
type (
|
|
stack struct {
|
|
visits []string
|
|
}
|
|
)
|
|
|
|
func (s stack) Count(url string) (n int) {
|
|
for _, v := range s.visits {
|
|
if strings.EqualFold(v, url) {
|
|
n++
|
|
}
|
|
}
|
|
|
|
return n
|
|
}
|
|
|
|
func (s stack) Height() int {
|
|
return len(s.visits)
|
|
}
|
|
|
|
func (s *stack) Visit(url string) {
|
|
s.visits = append(s.visits, url)
|
|
}
|