@rethinkhealth/hl7v2-utils 0.2.10 → 0.2.11

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/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @rethinkhealth/hl7v2-utils
10
10
 
11
11
  ## Contributing
12
12
 
13
- We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for more details.
13
+ We welcome contributions! Please see our [Contributing Guide][github-contributing] for more details.
14
14
 
15
15
  1. Fork the repository
16
16
  2. Create your feature branch (`git checkout -b feature/amazing-feature`)
@@ -20,10 +20,14 @@ We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING
20
20
 
21
21
  ## Code of Conduct
22
22
 
23
- To ensure a welcoming and positive environment, we have a [Code of Conduct](../../CODE_OF_CONDUCT.md) that all contributors and participants are expected to adhere to.
23
+ To ensure a welcoming and positive environment, we have a [Code of Conduct][github-code-of-conduct] that all contributors and participants are expected to adhere to.
24
24
 
25
25
  ## License
26
26
 
27
27
  Copyright 2025 Rethink Health, SUARL. All rights reserved.
28
28
 
29
- This program is licensed to you under the terms of the [MIT License](https://opensource.org/licenses/MIT). This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [LICENSE](../../LICENSE) file for details.
29
+ This program is licensed to you under the terms of the [MIT License](https://opensource.org/licenses/MIT). This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [LICENSE][github-license] file for details.
30
+
31
+ [github-code-of-conduct]: https://github.com/rethinkhealth/hl7v2/blob/main/CODE_OF_CONDUCT.md
32
+ [github-license]: https://github.com/rethinkhealth/hl7v2/blob/main/LICENSE
33
+ [github-contributing]: https://github.com/rethinkhealth/hl7v2/blob/main/CONTRIBUTING.md
package/dist/index.d.ts CHANGED
@@ -1,15 +1,4 @@
1
1
  import type { Nodes } from '@rethinkhealth/hl7v2-ast';
2
- /**
3
- * HL7v2 Delimiters type
4
- */
5
- export type HL7v2Delimiters = {
6
- field: string;
7
- component: string;
8
- subcomponent: string;
9
- repetition: string;
10
- escape: string;
11
- segment: string;
12
- };
13
2
  export declare const DEFAULT_DELIMITERS: {
14
3
  field: string;
15
4
  component: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAMtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;CAO9B,CAAC;AAMF;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CA2BnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAMtD,eAAO,MAAM,kBAAkB;;;;;;;CAO9B,CAAC;AAMF;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CA2BnE"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Nodes } from '@rethinkhealth/hl7v2-ast';\n\n// -------------\n// Delimiters\n// -------------\n\n/**\n * HL7v2 Delimiters type\n */\nexport type HL7v2Delimiters = {\n field: string;\n component: string;\n subcomponent: string;\n repetition: string;\n escape: string;\n segment: string; // now always a string\n};\n\nexport const DEFAULT_DELIMITERS = {\n field: '|',\n component: '^',\n repetition: '~',\n subcomponent: '&',\n escape: '\\\\',\n segment: '\\r',\n};\n\n// -------------\n// General\n// -------------\n\n/**\n * Utility: check if a node is semantically empty\n */\nexport function isEmptyNode(node: Nodes | null | undefined): boolean {\n if (!node) {\n return true;\n }\n\n // If node has a \"value\" property (Subcomponent, maybe Component)\n if ('value' in node) {\n return !node.value || node.value.trim() === '';\n }\n\n // If node has children (Field, Component, Repetition, Segment, Root, etc.)\n if ('children' in node) {\n if (!node.children || node.children.length === 0) {\n return true;\n }\n\n // If node has more than one child, then it is considered non-empty\n if (node.children.length > 1) {\n return false;\n }\n\n // If node has only one child, then it is considered empty if the child is also empty\n return isEmptyNode(node.children[0]);\n }\n\n // Fallback: consider unknown node as non-empty\n return false;\n}\n"],"mappings":";AAkBO,IAAM,qBAAqB;AAAA,EAChC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,SAAS;AACX;AASO,SAAS,YAAY,MAAyC;AACnE,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAGA,MAAI,WAAW,MAAM;AACnB,WAAO,CAAC,KAAK,SAAS,KAAK,MAAM,KAAK,MAAM;AAAA,EAC9C;AAGA,MAAI,cAAc,MAAM;AACtB,QAAI,CAAC,KAAK,YAAY,KAAK,SAAS,WAAW,GAAG;AAChD,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,SAAS,SAAS,GAAG;AAC5B,aAAO;AAAA,IACT;AAGA,WAAO,YAAY,KAAK,SAAS,CAAC,CAAC;AAAA,EACrC;AAGA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Nodes } from '@rethinkhealth/hl7v2-ast';\n\n// -------------\n// Delimiters\n// -------------\n\nexport const DEFAULT_DELIMITERS = {\n field: '|',\n component: '^',\n repetition: '~',\n subcomponent: '&',\n escape: '\\\\',\n segment: '\\r',\n};\n\n// -------------\n// General\n// -------------\n\n/**\n * Utility: check if a node is semantically empty\n */\nexport function isEmptyNode(node: Nodes | null | undefined): boolean {\n if (!node) {\n return true;\n }\n\n // If node has a \"value\" property (Subcomponent, maybe Component)\n if ('value' in node) {\n return !node.value || node.value.trim() === '';\n }\n\n // If node has children (Field, Component, Repetition, Segment, Root, etc.)\n if ('children' in node) {\n if (!node.children || node.children.length === 0) {\n return true;\n }\n\n // If node has more than one child, then it is considered non-empty\n if (node.children.length > 1) {\n return false;\n }\n\n // If node has only one child, then it is considered empty if the child is also empty\n return isEmptyNode(node.children[0]);\n }\n\n // Fallback: consider unknown node as non-empty\n return false;\n}\n"],"mappings":";AAMO,IAAM,qBAAqB;AAAA,EAChC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,SAAS;AACX;AASO,SAAS,YAAY,MAAyC;AACnE,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAGA,MAAI,WAAW,MAAM;AACnB,WAAO,CAAC,KAAK,SAAS,KAAK,MAAM,KAAK,MAAM;AAAA,EAC9C;AAGA,MAAI,cAAc,MAAM;AACtB,QAAI,CAAC,KAAK,YAAY,KAAK,SAAS,WAAW,GAAG;AAChD,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,SAAS,SAAS,GAAG;AAC5B,aAAO;AAAA,IACT;AAGA,WAAO,YAAY,KAAK,SAAS,CAAC,CAAC;AAAA,EACrC;AAGA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rethinkhealth/hl7v2-utils",
3
3
  "description": "hl7v2 utilities",
4
- "version": "0.2.10",
4
+ "version": "0.2.11",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Melek Somai",
@@ -24,9 +24,9 @@
24
24
  "typescript": "^5.8.3",
25
25
  "unist-builder": "^4.0.0",
26
26
  "vitest": "^3.2.4",
27
- "@rethinkhealth/testing": "0.0.1",
27
+ "@rethinkhealth/hl7v2-ast": "0.2.11",
28
28
  "@rethinkhealth/tsconfig": "0.0.1",
29
- "@rethinkhealth/hl7v2-ast": "0.2.10"
29
+ "@rethinkhealth/testing": "0.0.1"
30
30
  },
31
31
  "repository": "rethinkhealth/hl7v2.git",
32
32
  "homepage": "https://www.rethinkhealth.io/hl7v2/docs",