Shape.leaves: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/fmt/shape.bend as Shape Lines 179-189 of cswap-bend-cli@0.1.0.0/fmt/shape.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&start_line=179&end_line=189 import Base import cswap-bend-cli@0.1.0.0/json.bend as Json # The scalar leaves of a document with dotted keys; an array is one leaf. def leaves(j: Json.Json, +prefix: String) -> List<&2, Leaf>: match j: case Json.JObj{+f}: leaf.pick(is_empty_obj(f), prefix, leaves(f, prefix)) case Json.JField{k, v, +t}: List.append(&2, Leaf, leaves(v, dotted(prefix, k)), leaves(t, prefix)) case Json.JNil{}: [] case _: Leaf{prefix, cell(j)} <> [] Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&name=Leaf https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&name=cell https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&name=dotted https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&name=is_empty_obj https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/fmt/shape.bend&name=leaf.pick https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Json