Files
lo/docs/data/core-omitby.md
T
2025-10-06 19:59:26 +02:00

740 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
OmitBy omitby map.go#L142 core map https://go.dev/play/p/EtBsR43bdsd
core#map#omitby
core#map#pickby
core#map#omitbykeys
core#map#omitbyvalues
core#map#pickbykeys
core#map#pickbyvalues
core#map#filterkeys
core#map#filtervalues
90
func OmitBy[K comparable, V any, Map ~map[K]V](in Map, predicate func(key K, value V) bool) Map

Returns a map of the same type excluding entries that match the predicate.

m := lo.OmitBy(
    map[string]int{"foo": 1, "bar": 2, "baz": 3},
    func(key string, value int) bool {
        return value%2 == 1
    },
)
// map[string]int{"bar": 2}