import type { Nodes } from "@rethinkhealth/hl7v2-ast"; /** * Check if an HL7v2 AST node is semantically empty. * * A node is empty when it contains no meaningful data — no subcomponent * anywhere in its subtree has a non-empty string value. * * This follows the HL7v2 specification (Chapter 2, Section 2.5.3) and * Conformance Methodology R1 (2019) definition of "non-empty value": * at least one character must be a non-whitespace character. * * ## HL7v2 emptiness semantics * * | Encoding | Wire form | isEmpty? | Meaning | * |-------------|---------------|----------|----------------------------------| * | `value` | `\|value\|` | `false` | Field has data | * | `^DOE` | `\|^DOE\|` | `false` | Component 2 has data | * | `~value` | `\|~value\|` | `false` | Repetition 2 has data | * | `""` | `\|""\|` | `false` | Explicit null (delete indicator) | * | (empty) | `\|\|` | `true` | Not present | * | `^^` | `\|^^\|` | `true` | Empty components | * | `~` | `\|~\|` | `true` | Empty repetitions | * | `~^^` | `\|~^^\|` | `true` | Empty reps with empty components | * * @param node - The HL7v2 AST node to check (or null/undefined) * @returns `true` if the node has no meaningful data */ export declare function isEmptyNode(node?: Nodes | null | undefined): boolean; /** * Calculate the byte length of any HL7v2 AST node. * * For literal nodes (Subcomponent), returns the UTF-8 byte length of the value. * For parent nodes, recursively calculates the length of all children. Delimiters are NOT included. * * @param node - The HL7v2 AST node to measure * @returns The total byte length of the node content * * @example * ```ts * const field: Field = { type: "field", children: [...] }; * const length = getByteLength(field); // e.g., 42 * ``` */ export declare function getByteLength(node?: Nodes | null | undefined): number; /** * Calculate the string length of any HL7v2 AST node. * * For literal nodes (Subcomponent), returns `value.length`. * For parent nodes, recursively calculates the length of all children. Delimiters are NOT included. * * Note: Returns JavaScript string length (UTF-16 code units). For UTF-8 byte * length (e.g., for wire protocol), use `getByteLength` instead. * * @param node - The HL7v2 AST node to measure * @returns The total string length of the node content * * @example * ```ts * const field: Field = { type: "field", children: [...] }; * const length = getLength(field); // e.g., 42 * ``` */ export declare function getLength(node?: Nodes | null | undefined): number; //# sourceMappingURL=utils.d.ts.map