Skip to main content
Version: v0.0.3

Function: buildNarrativeIndex()

buildNarrativeIndex(textEl): ReadonlyMap<string, string>

Index a narrative <text> block by the ID attributes carried on its descendant elements, mapping each ID to that node's trimmed text. C-CDA entries reference narrative via <reference value="#id">; this index lets the entry layer resolve those references without re-walking the DOM.

Parameters

textEl

Element

Returns

ReadonlyMap<string, string>

Example

import { buildNarrativeIndex, child } from "@cosyte/ccda";
const index = buildNarrativeIndex(child(sectionEl, "text")!);
console.log(index.get("problem1"));