lib/cmsTxtToIntObj.js
function convertToObject(sectionString) {

    var sectionObj = {};
    //get the section title(get it raw, clean it)
    var sectionTitleRegExp = /(-){3,}([\S\s]+?)(-){3,}/;
    var sectionRawTitle = sectionString.match(sectionTitleRegExp)[0];
    var sectionTitle = cleanUpTitle(sectionRawTitle).toLowerCase();

    //get the section body
    var sectionBody;
    sectionObj.sectionTitle = sectionTitle;
    //these are very special "edge" cases

    //meta data/information about document in the beginning of the doc
    if (sectionTitle.toLowerCase().indexOf("personal health information") >= 0) {
        delete sectionObj.sectionTitle;
        sectionObj.sectionTitle = 'meta';
        sectionBody = getMetaBody(sectionString);
    } else if (sectionTitle.toLowerCase().indexOf("claim") >= 0) {
        sectionBody = getClaimsBody(sectionString);
    } else {
        sectionBody = getSectionBody(sectionString);
    }
    sectionObj.sectionBody = sectionBody;
    return sectionObj;
}
function convertToObject(sectionString) {

    var sectionObj = {};
    //get the section title(get it raw, clean it)
    var sectionTitleRegExp = /(-){3,}([\S\s]+?)(-){3,}/;
    var sectionRawTitle = sectionString.match(sectionTitleRegExp)[0];
    var sectionTitle = cleanUpTitle(sectionRawTitle).toLowerCase();

    //get the section body
    var sectionBody;
    sectionObj.sectionTitle = sectionTitle;
    //these are very special "edge" cases

    //meta data/information about document in the beginning of the doc
    if (sectionTitle.toLowerCase().indexOf("personal health information") >= 0) {
        delete sectionObj.sectionTitle;
        sectionObj.sectionTitle = 'meta';
        sectionBody = getMetaBody(sectionString);
    } else if (sectionTitle.toLowerCase().indexOf("claim") >= 0) {
        sectionBody = getClaimsBody(sectionString);
    } else {
        sectionBody = getSectionBody(sectionString);
    }
    sectionObj.sectionBody = sectionBody;
    return sectionObj;
}
function convertToObject ( sectionString ) { var sectionObj = { } ; //get the section title(get it raw, clean it) var sectionTitleRegExp = / (-){3,}([\S\s]+?)(-){3,} / ; var sectionRawTitle = sectionString . match ( sectionTitleRegExp ) [ 0 ] ; var sectionTitle = cleanUpTitle ( sectionRawTitle ) . toLowerCase ( ) ; //get the section body var sectionBody ; sectionObj . sectionTitle = sectionTitle ; //these are very special "edge" cases //meta data/information about document in the beginning of the doc if ( sectionTitle . toLowerCase ( ) . indexOf ( "personal health information" ) >= 0 ) { delete sectionObj . sectionTitle ; sectionObj . sectionTitle = 'meta' ; sectionBody = getMetaBody ( sectionString ) ; } else if ( sectionTitle . toLowerCase ( ) . indexOf ( "claim" ) >= 0 ) { sectionBody = getClaimsBody ( sectionString ) ; } else { sectionBody = getSectionBody ( sectionString ) ; } sectionObj . sectionBody = sectionBody ; return sectionObj ; }
converts each section to an  object representation
converts each section to an object representation