use comparable constraint in contains (#12)

Co-authored-by: Ruidy <ruidy.nemausat@gmail.com>
This commit is contained in:
Ruidy 2022-02-12 16:08:46 -04:00 committed by GitHub
parent 7d422c59d3
commit 28f85bdc94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,7 @@
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 {
func Contains[T comparable](values []T, value T) bool {
for _, v := range values {
if v == value {
return true