underscore/contains.go
2021-12-29 13:46:29 -04:00

14 lines
283 B
Go

package underscore
type numbers interface {
int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64
}
func Contains[T numbers](values []T, value T) bool {
for _, v := range values {
if v == value {
return true
}
}
return false
}