-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- moved ParserPlan class to its own file - updated it so that its properties match the options that could be set - unit tests check for non-standard delimiters and parses the MSH correctly (batches not done yet) #4
- Loading branch information
Showing
6 changed files
with
119 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
/** | ||
* Used to figure out the current HL7 message(s)/batch delimited used to encode this particular HL7 message. | ||
* @since 1.0.0 | ||
*/ | ||
export class ParserPlan { | ||
/** @internal */ | ||
separatorField?: string | ||
/** @internal */ | ||
separatorComponent?: string | ||
/** @internal */ | ||
separatorRepetition?: string | ||
/** @internal */ | ||
separatorEscape?: string | ||
/** @internal */ | ||
separatorSubComponent?: string | ||
|
||
/** | ||
* @since 1.0.0 | ||
* @param data | ||
*/ | ||
constructor (data: string) { | ||
const seps = data.split('') | ||
|
||
this.separatorField = seps[0] | ||
if (seps.length > 2) { | ||
this.separatorRepetition = seps[2] | ||
} else { | ||
this.separatorRepetition = '~' | ||
} | ||
if (seps.length > 1) { | ||
this.separatorComponent = seps[1] | ||
} else { | ||
this.separatorComponent = '^' | ||
} | ||
if (seps.length > 4) { | ||
this.separatorSubComponent = seps[4] | ||
} else { | ||
this.separatorSubComponent = '&' | ||
} | ||
if (seps.length > 3) { | ||
this.separatorEscape = seps[3] | ||
} else { | ||
this.separatorEscape = '\\' | ||
} | ||
} | ||
} |