Interface: ParseOptions
Options accepted by parseHL7 to tune lenient/strict behaviour, inject a
profile, and configure optional preprocessing steps. Every field is
optional; parseHL7(raw, {}) is valid and produces the library defaults.
Remarks
With exactOptionalPropertyTypes: true, callers cannot pass
{ strict: undefined }: either omit the key or pass a boolean. The
profile: null form is the explicit opt-out from the process-scoped
default profile (PROF-08 semantics); profile omitted means "use the
default if one is registered".
Example
import { parseHL7, type ParseOptions } from "@cosyte/hl7";
const opts: ParseOptions = {
strict: true,
onWarning: (w) => console.warn(w.code),
dateFormats: ["YYYY-MM-DD"],
};
parseHL7(raw, opts);
Properties
charset?
readonlyoptionalcharset?:string
Override the character set used to decode Buffer input. When supplied
this wins over MSH-18 auto-discovery. When both are supplied and they
disagree (after alias normalization) the parser emits
ENCODING_MISMATCH and honours this override. Ignored for string
input.
Example
import { parseHL7 } from "@cosyte/hl7";
parseHL7(buf, { charset: "ISO-8859-1" });
dateFormats?
readonlyoptionaldateFormats?: readonlystring[]
onWarning?
readonlyoptionalonWarning?:OnWarningCallback
profile?
readonlyoptionalprofile?:Profile|null
strict?
readonlyoptionalstrict?:boolean
stripMllpFraming?
readonlyoptionalstripMllpFraming?:boolean
trimFields?
readonlyoptionaltrimFields?:boolean