Skip to content

CONSUME-AS-DATA-06: Name two tables in one section

A section’s content record yields several independently-named TableViews, each its own typed view.

Builds on: CONSUME-AS-DATA-05: Target rows with column / find / rowPos

A TypeScript program against the library API; inline comments show the resulting values and behavior.

const c = contract({ body: sections({}, [
section("Decision", { content: {
components: table({ anchor: "components", columns: ["#", "Component", "Resolution"] }),
risks: table({ anchor: "risks", columns: ["Risk", "Mitigation"] }),
} }),
])});
const d = c.read(src, { path: "README.md" }).body.decision;
d.components.column("Component"); // ["projection", "grammar"]
d.risks.find(r => r.Risk.includes("gfm"))?.Mitigation; // "pin in spike S6"
  • section() content record of named table() leaves
  • per-field TableView access
  • .column/.find