mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
Replace usage of golang.org/x/exp/constraints with Go 1.22 cmp/slices. Update .golangci.yml to new v2 format and enable gofmt/goimports. Refactor imports and type constraints across codebase for consistency.
9 lines
307 B
Go
9 lines
307 B
Go
package underscore
|
|
|
|
import "slices"
|
|
|
|
// Any returns true if any of the values in the slice pass the predicate truth test.
|
|
// Short-circuits and stops traversing the slice if a true element is found.
|
|
func Any[T any](values []T, predicate func(T) bool) bool {
|
|
return slices.ContainsFunc(values, predicate)
|
|
}
|