Skip to content

Commit

Permalink
translator: add convenience function on TipSpecRx to check for a tip
Browse files Browse the repository at this point in the history
  • Loading branch information
mpontillo authored and xlab committed Feb 26, 2024
1 parent 2942bd1 commit 38432bd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ func (t TipSpecRx) TipAt(i int) Tip {
return t.Default
}

func (t TipSpecRx) HasTip(q Tip) bool {
for _, tip := range t.tips {
if tip.IsValid() && tip == q {
return true
}
}
return false
}

func (t TipSpecRx) Self() Tip {
if t.self.IsValid() {
return t.self
Expand Down

0 comments on commit 38432bd

Please sign in to comment.