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
/** | |
Convert Date object into HL7-timestamp string | |
@return {String} Date object formatted as HL7-timestamp | |
@requires String.prototype.lpad | |
*/ | |
Date.prototype.toHl7DateString = function() { | |
var hl7DateString = new String(); |
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
/** | |
Parse HL7-Timestamp into Date object | |
@param {String} hl7DateString - HL7-timestamp | |
@return {Date} return parsed HL7-timestamp | |
*/ | |
Date.prototype.hl7parse = function(hl7DateString) { | |
var tdate = this; |
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
/** | |
Replace String using mapping table | |
@param {Object} lookupList - mapping table | |
@param {String} defaultValue - default value, used if no mapping was found | |
@return {String} return mapped value | |
*/ | |
/** usage: |
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
/** | |
padding numbers with leading 0 | |
@param {String, Number} arg1, arg2 - arg1 padding string, arg2 length | |
@return {String} return padded string | |
*/ | |
String.prototype.lpad = function(padString, length) { | |
var str = this; | |
while (str.length < length) | |
str = padString + str; |