mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
use comparable constraint in contains (#12)
Co-authored-by: Ruidy <ruidy.nemausat@gmail.com>
This commit is contained in:
parent
7d422c59d3
commit
28f85bdc94
1 changed files with 1 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue