Back to Lo

Core Someby

docs/data/core-someby.md

1.53.0228 B
Original Source

Returns true if the predicate returns true for any element in the collection. Returns false for an empty collection.

go
ok := lo.SomeBy(
    []int{1, 2, 3, 4},
    func(x int) bool {
        return x < 3
    },
)
// true