Function: parseHd()
parseHd(
rep,enc):HD
Parse an HL7 v2 HD repetition into a structured HD object. Components
are returned verbatim (already decoded once by the tokenizer: never
re-unescaped). Absent / empty components are OMITTED
from the result (exactOptionalPropertyTypes semantics).
Parameters
rep
enc
Returns
Example
import { parseHd, DEFAULT_ENCODING_CHARACTERS } from "@cosyte/hl7";
const rep = { components: [
{ subcomponents: ["EPIC"] },
{ subcomponents: ["1.2.840.114350"] },
{ subcomponents: ["ISO"] },
] };
const hd = parseHd(rep, DEFAULT_ENCODING_CHARACTERS);
console.log(hd.namespaceId); // "EPIC"
console.log(hd.universalIdType); // "ISO"