def Kube.named
import bend-kube-runtime@0.2.0.0/src/config.bend as Configimport Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
129# The entry of a named list ("clusters", "users", "contexts") with this
130# name, as its inner object (cluster, user or context).
131def Kube.named(xs: List<&2, J.Json>, +name: String, +field: String) -> J.Json:
132 match xs:
133 case Nil{}:
134 J.JNull{}
135 case Con{+x, t}:
136 Kube.named.if(x, field, Kube.named(t, name, field),
137 String.eq(J.Json.str_or(J.Json.get(x, "name"), ""), name))