hl7v2 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/HL7Field.js CHANGED
@@ -122,6 +122,14 @@ class HL7Field {
122
122
  this._data[0].value = value;
123
123
  }
124
124
 
125
+ get asHL7() {
126
+ return this.toHL7();
127
+ }
128
+
129
+ set asHL7(v) {
130
+ this.parse(v);
131
+ }
132
+
125
133
  /**
126
134
  *
127
135
  * @param {*} value
@@ -102,6 +102,14 @@ class HL7FieldData {
102
102
  else this._value = value;
103
103
  }
104
104
 
105
+ get asHL7() {
106
+ return this.toHL7();
107
+ }
108
+
109
+ set asHL7(v) {
110
+ this.parse(v);
111
+ }
112
+
105
113
  /**
106
114
  *
107
115
  * @param {*} value
package/lib/HL7Message.js CHANGED
@@ -64,6 +64,14 @@ class HL7Message {
64
64
  return this.getSegment('MSH');
65
65
  }
66
66
 
67
+ get asHL7() {
68
+ return this.toHL7();
69
+ }
70
+
71
+ set asHL7(v) {
72
+ this.parse(v);
73
+ }
74
+
67
75
  /**
68
76
  * Creates a new segment to the end of the this message
69
77
  * @param {string} type
@@ -167,7 +175,8 @@ class HL7Message {
167
175
  }
168
176
 
169
177
  toHL7() {
170
- this.MSH.VersionId.value = this.version;
178
+ if (this.MSH)
179
+ this.MSH.VersionId.value = this.version;
171
180
  let out = '';
172
181
  for (const s of this._segments)
173
182
  out += s.toHL7() + CR;
package/lib/HL7Segment.js CHANGED
@@ -83,6 +83,14 @@ class HL7Segment {
83
83
  return this.message.segments.indexOf(this);
84
84
  }
85
85
 
86
+ get asHL7() {
87
+ return this.toHL7();
88
+ }
89
+
90
+ set asHL7(v) {
91
+ this.parse(v);
92
+ }
93
+
86
94
  defineField(sequence, def) {
87
95
  if (!(sequence > 0))
88
96
  throw new ArgumentError('Sequence argument must be greater than zero');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hl7v2",
3
3
  "description": "HL7 v2 parser, serializer, validator and tcp client/server for NodeJS",
4
- "version": "0.13.0",
4
+ "version": "0.14.0",
5
5
  "author": "Panates Ltd.",
6
6
  "contributors": [
7
7
  "Eray Hanoglu <e.hanoglu@panates.com>"
@@ -27,10 +27,10 @@
27
27
  "putil-waterfall": "^2.1.1"
28
28
  },
29
29
  "devDependencies": {
30
- "babel-eslint": "^10.1.0",
31
- "eslint": "^8.19.0",
30
+ "@babel/eslint-parser": "^7.19.1",
31
+ "eslint": "^8.30.0",
32
32
  "eslint-config-google": "^0.14.0",
33
- "mocha": "^10.0.0",
33
+ "mocha": "^10.2.0",
34
34
  "nyc": "^15.1.0"
35
35
  },
36
36
  "engines": {