hl7-tstd 0.3.1 → 1.0.0-dev.1

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/LICENSE.txt CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright 2025 1nandagopal
190
+ Copyright 2026 1nandagopal
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -2,13 +2,27 @@
2
2
 
3
3
  A simple package to create, parse & transform HL7 message.
4
4
 
5
+ ![GitHub License](https://img.shields.io/github/license/1nandagopal/hl7-tstd)
6
+
7
+ ```javascript
8
+ // CJS
9
+ const { HL7 } = require('hl7-tstd');
10
+ ```
11
+
12
+ ```javascript
13
+ // ESM
14
+ import { HL7 } from 'hl7-tstd';
15
+ ```
16
+
5
17
  ```typescript
6
- import HL7, { Segment } from 'hl7-tstd';
18
+ // TS
19
+ import { HL7, type Segment } from 'hl7-tstd';
7
20
 
8
21
  const hl7 = new HL7(raw); // raw: raw HL7 message string
9
22
  ```
10
23
 
11
- _Segment_ is only a typescript type.
24
+ > [!WARNING]
25
+ > ⚠️ `Segment` is only a type export aimed at helping with type annotation. Using it for other purposes can lead to runtime exceptions.
12
26
 
13
27
  ### parseOptions
14
28
 
@@ -19,9 +33,9 @@ Additional configs for hl7 parsing and building.
19
33
  | fieldDelim | `\|` | `string` |
20
34
  | repeatingDelim | `~` | `string` |
21
35
  | componentDelim | `^` | `string` |
22
- | subCompDelim | `\&` | `string` |
36
+ | subCompDelim | `&` | `string` |
23
37
  | eolDelim | `\r?\n\|\r` | `\r?\n\|\r` \| `\r\n` \| `\n` \| `\r` |
24
- | buildEolChar | `\r\n` | `string` |
38
+ | buildEolChar | `\r` | `string` |
25
39
 
26
40
  ## API References
27
41
 
@@ -30,11 +44,11 @@ Additional configs for hl7 parsing and building.
30
44
 
31
45
  Gets the value from a segment.
32
46
 
33
- | Parameter | Type | Requirement |
34
- | :---------------- | :------: | :----------: |
35
- | field | `string` | **Required** |
36
- | repeatingIndex | `number` | Default: 0 |
37
- | subComponentIndex | `number` | Default: 0 |
47
+ | Parameter | Type | Requirement |
48
+ | :---------------- | :----------------: | :----------: |
49
+ | field | `string` | **Required** |
50
+ | repeatingIndex | `number` \| `true` | Default: 0 |
51
+ | subComponentIndex | `number` \| `true` | Default: 0 |
38
52
 
39
53
  Return: `string` | `null`
40
54
 
@@ -57,7 +71,7 @@ zyxSegment.get('ZYX'); // ZYX|1|A|B|C|Repeat1~Component1^Component2~SubComp1&Sub
57
71
  // Get repeating fields
58
72
  zyxSegment.get('ZYX.5'); // Repeat1
59
73
  zyxSegment.get('ZYX.5', 2); // SubComp1&SubComp2^Component2
60
- zyxSegment.get('ZYX.5', -1); // Repeat1~Component1^Component2~SubComp1&SubComp2^Component2~Repeat3
74
+ // zyxSegment.get('ZYX.5', -1); // Repeat1~Component1^Component2~SubComp1&SubComp2^Component2~Repeat3
61
75
 
62
76
  // Get component
63
77
  zyxSegment.get('ZYX.5.1', 1); // Component1
@@ -65,7 +79,7 @@ zyxSegment.get('ZYX.5.1', 1); // Component1
65
79
  // Get subcomponent
66
80
  zyxSegment.get('ZYX.5.1', 2); // SubComp1
67
81
  zyxSegment.get('ZYX.5.1', 2, 1); // SubComp2
68
- zyxSegment.get('ZYX.5.1', 2, -1); // SubComp1&SubComp2
82
+ // zyxSegment.get('ZYX.5.1', 2, -1); // SubComp1&SubComp2
69
83
  ```
70
84
 
71
85
  </details>
@@ -307,8 +321,9 @@ Here,
307
321
  </details>
308
322
 
309
323
  <details id="transform">
310
- <summary><code>transform</code> 💀 </summary>
324
+ <summary><code>transform</code> 🗑 </summary>
311
325
 
326
+ > [!WARNING]
312
327
  > ⚠️ **Deprecated**: This method is triggered internally and doesn't need to be invoked manually.
313
328
 
314
329
  Transforms the raw HL7 message suitable for manipulation and building.