underscore/contains.go
Ruidy 28f85bdc94
use comparable constraint in contains (#12)
Co-authored-by: Ruidy <ruidy.nemausat@gmail.com>
2022-02-12 21:08:46 +01:00

11 lines
222 B
Go

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