Files
lo/docs/data/core-findkeyby.md
T
2025-10-06 17:15:49 +02:00

613 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
FindKeyBy findkeyby find.go#L140 core find https://go.dev/play/p/9IbiPElcyo8
core#find#findkeyby
core#find#findkey
core#find#findby
core#find#findorelse
90
func FindKeyBy[K comparable, V any](object map[K]V, predicate func(key K, value V) bool) (K, bool)

Returns the first key in the map for which the predicate returns true.

k, ok := lo.FindKeyBy(map[string]int{"foo":1, "bar":2, "baz":3}, func(k string, v int) bool {
    return k == "foo"
})
// "foo", true