Function: resolvePath()
resolvePath(
path,segments,_enc):string|undefined
Resolve a dot-path string against a raw segment tree to its decoded
leaf value. Returns undefined whenever the path does not resolve (missing
segment, out-of-range field/component/subcomponent/repetition), and never
throws on a missing value. Throws TypeError only when path itself is
malformed: callers relying on "never throws" should pre-validate or wrap
in try/catch.
Parameters
path
string
segments
readonly RawSegment[]
_enc
Returns
string | undefined
Example
import { parseHL7, resolvePath } from "@cosyte/hl7";
const msg = parseHL7(raw);
resolvePath("PID.5.1", msg.rawSegments, msg.encodingCharacters); // "Smith"
resolvePath("NOT.9", msg.rawSegments, msg.encodingCharacters); // undefined