Segment
Defined in: packages/parser/src/reader/segment.ts:4
One segment, such as EB*1**30, with its elements split by the interchange's separators.
Properties
offset
readonlyoffset:number
Defined in: packages/parser/src/reader/segment.ts:6
The index in the text where the segment starts.
tag
readonlytag:string
Defined in: packages/parser/src/reader/segment.ts:8
The segment ID, such as EB.
Methods
components()
components(
position):string[]
Defined in: packages/parser/src/reader/segment.ts:30
Splits one element on the component separator.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | number | The element position, starting at 1. |
Returns
string[]
The components, or an empty array when the segment has fewer elements.
element()
element(
position):string|undefined
Defined in: packages/parser/src/reader/segment.ts:47
Returns one element as written, including any component or repetition separators.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | number | The element position, starting at 1: element(1) of EB*1**30 is 1. |
Returns
string | undefined
The element, '' when it is present but empty, or undefined when the segment has fewer elements.
repetitions()
repetitions(
position):string[]
Defined in: packages/parser/src/reader/segment.ts:58
Splits one element on the repetition separator.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | number | The element position, starting at 1. |
Returns
string[]
The repeated values, one value when the interchange has no repetition separator, or an empty array when the segment has fewer elements.