mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 08:31:16 +00:00
28 lines
345 B
Go
28 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)
|
||
|
}
|