Back to Lo

Core Countby

docs/data/core-countby.md

1.53.0144 B
Original Source

Counts the number of elements for which the predicate is true.

go
lo.CountBy([]int{1, 5, 1}, func(i int) bool {
    return i < 4
})
// 2