// Prev returns the previous page reletive to the given page.
func (p Pages) Prev(cur *Page) *Page {
for x, c := range p {
- if c.UniqueID() == cur.UniqueID() {
+ if c.Eq(cur) {
if x == 0 {
+ // TODO(bep) consider return nil here to get it line with the other Prevs
return p[len(p)-1]
}
return p[x-1]
// Next returns the next page reletive to the given page.
func (p Pages) Next(cur *Page) *Page {
for x, c := range p {
- if c.UniqueID() == cur.UniqueID() {
+ if c.Eq(cur) {
if x < len(p)-1 {
return p[x+1]
}
+ // TODO(bep) consider return nil here to get it line with the other Nexts
return p[0]
}
}