-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathJSEDINotation.ts
More file actions
69 lines (51 loc) · 1.68 KB
/
Copy pathJSEDINotation.ts
File metadata and controls
69 lines (51 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"use strict";
import { X12SerializationOptions } from "./X12SerializationOptions.ts";
export class JSEDINotation {
constructor(header?: string[], options?: X12SerializationOptions) {
this.header = header === undefined ? new Array<string>() : header;
this.options = options === undefined ? {} : options;
this.functionalGroups = new Array<JSEDIFunctionalGroup>();
}
options?: X12SerializationOptions;
header: string[];
functionalGroups: JSEDIFunctionalGroup[];
addFunctionalGroup(header: string[]): JSEDIFunctionalGroup {
const functionalGroup = new JSEDIFunctionalGroup(header);
this.functionalGroups.push(functionalGroup);
return functionalGroup;
}
}
export class JSEDIFunctionalGroup {
constructor(header?: string[]) {
this.header = header === undefined ? new Array<string>() : header;
this.transactions = new Array<JSEDITransaction>();
}
header: string[];
transactions: JSEDITransaction[];
addTransaction(header: string[]): JSEDITransaction {
const transaction = new JSEDITransaction(header);
this.transactions.push(transaction);
return transaction;
}
}
export class JSEDITransaction {
constructor(header?: string[]) {
this.header = header === undefined ? new Array<string>() : header;
this.segments = new Array<JSEDISegment>();
}
header: string[];
segments: JSEDISegment[];
addSegment(tag: string, elements: string[]): JSEDISegment {
const segment = new JSEDISegment(tag, elements);
this.segments.push(segment);
return segment;
}
}
export class JSEDISegment {
constructor(tag: string, elements: string[]) {
this.tag = tag;
this.elements = elements;
}
tag: string;
elements: string[];
}