Skip to content

Commit

Permalink
feat: Add Contains() to Coords
Browse files Browse the repository at this point in the history
  • Loading branch information
minitauros committed Jul 23, 2022
1 parent ee52e14 commit 7edca88
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions coord.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ func (coords *Coords) Remove(coordsToRemove ...Coord) {
*coords = newCoords
}

// Contains returns true if the given coord is in the current collection of coords.
func (coords Coords) Contains(coord Coord) bool {
for _, c := range coords {
if c.Equals(coord) {
return true
}
}
return false
}

// String satisfies stringer.
func (coords Coords) String() string {
chunks := make([]string, 0, len(coords))
Expand Down

0 comments on commit 7edca88

Please sign in to comment.