underscore
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

ContainsBy

ContainsBy returns true if any element satisfies the predicate.

package main

import (
 "fmt"
 u "github.com/rjNemo/underscore"
)

func main() {
 nums := []int{1, 3, 5, 8}
 fmt.Println(u.ContainsBy(nums, func(n int) bool { return n%2 == 0 })) // true
}