underscore/contains.go
2022-01-01 14:21:05 -04:00

13 lines
253 B
Go

package underscore
import "constraints"
// Contains returns true if the value is present in the slice
func Contains[T constraints.Ordered](values []T, value T) bool {
for _, v := range values {
if v == value {
return true
}
}
return false
}