def home

near-v-framework@0.4.0.0 · domain/architecture/ops.bend:381

import near-v-framework@0.4.0.0/domain/architecture/ops.bend as Ops
import Base
import near-v-framework@0.4.0.0/general/compound/ops.bend as CO
import near-v-framework@0.4.0.0/domain/architecture/system/container/type.bend as Ct

381# The container a key belongs to: itself, or the one its component sits in, else the key itself.
382def home(+k: String, cs: List<&2, Ct.Container>) -> String:
383  match cs:
384    case []:
385      k
386    case c <> rest:
387      match c:
388        case Ct.Container{+ck, _, _, _, _, _, _, _, _, _, _, _, _, comps, _}:
389          Bool.pick(String, String.eq(k, ck) || CO.has(component_keys(comps), k), ck, home(k, rest))

Uses (8)

Used by (3)