def has.go

emerging-ezjson@1.3.0.0 · src/value.bend:394

import emerging-ezjson@1.3.0.0/src/value.bend as Value
import Base
import emerging-ezjson@1.3.0.0/src/lazy.bend as Lazy

394# whether a chain of pairs has the key, stopping at the first match
395def has.go(cells: Json, +key: String) -> Bool:
396  match cells:
397    case JPair{k2, _, rr}:
398      Lazy.stop(Bool, find.eq(k2, key), True{}, _u => has.go(rr, key))
399    case JBind{src, nn, _, rr}:
400      Lazy.stop(Bool, span.eq(src, nn, key), True{}, _u => has.go(rr, key))
401    case _:
402      False{}

Uses (6)

Used by (1)