def Json.lookup.go
import bend-kube-runtime@0.2.0.0/src/json.bend as Jsonimport Base
100# The value under key in an object's member chain; JNull when absent. hit
101# says whether the chain's head is key.
102def Json.lookup.go(ms: Json, +key: String, hit: Bool) -> Json:
103 match ms hit:
104 case JMem{k, v, t} True{}:
105 v
106 case JMem{k, v, +t} False{}:
107 Json.lookup.go(t, key, Json.head_is(t, key))
108 case _ _:
109 JNull{}