Skip to content

Commit

Permalink
added SliceContains
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-M committed Mar 15, 2023
1 parent 81846e4 commit a676d2c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/utils/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ func MapKeys[K comparable, V any](m map[K]V) []K {
}
return res
}

func SliceContains[T comparable](s []T, e T) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

0 comments on commit a676d2c

Please sign in to comment.