Function: unknownEscapeSequence()
unknownEscapeSequence(
position,body):Hl7ParseWarning
Build an UNKNOWN_ESCAPE_SEQUENCE warning for a terminated escape
sequence (\..\) whose body is not a recognized HL7 escape. The message
NEVER embeds the escape body: only its length and, when the body's first
character is a recognized HL7 escape-identifier letter (structural HL7
grammar, not PHI: e.g. Z for a vendor escape, . for a formatting
escape), that single letter. A body that doesn't start with a known escape
letter is untrusted field text and names no character at all. The sequence
itself is still preserved verbatim in the parsed output: only the WARNING
message is PHI-safe.
Parameters
position
body
string
Returns
Example
import { unknownEscapeSequence } from "@cosyte/hl7";
const w = unknownEscapeSequence({ segmentIndex: 2, fieldIndex: 3 }, "Z99");
// message: `Unknown HL7 escape sequence of type "Z" (3 chars) preserved verbatim.`