Skip to main content
Version: v0.0.9

Variable: NON_SPEC_SEGMENT_ID

const NON_SPEC_SEGMENT_ID: "(non-spec)" = "(non-spec)"

The value X12Segment.id takes when the first element does not match the X12 segment-id grammar. Not a valid segment id, so it can never collide with a real one in a seg.id === "NM1" comparison.

Example

import { parseX12, NON_SPEC_SEGMENT_ID } from "@cosyte/x12";
const seg = parseX12(raw).groups[0]?.transactions[0]?.segments[1];
if (seg?.id === NON_SPEC_SEGMENT_ID) {
// the sender's "segment" name is not a spec segment id; its bytes are on seg.raw
}