build/modelscript.umd.js
function rowSplit(rowStr, param) {
              if (rowStr === "") {
                return { cols: [], closed: true };
              }
              var quote = param.quote;
              var trim = param.trim;
              var escape = param.escape;
              if (param.delimiter instanceof Array || param.delimiter.toLowerCase() === "auto") {
                param.delimiter = getDelimiter_1(rowStr, param);
              }
              var delimiter = param.delimiter;
              var rowArr = rowStr.split(delimiter);
              if (quote === "off") {
                return { cols: rowArr, closed: true };
              }
              var row = [];
              var inquote = false;
              var quoteBuff = '';
              for (var i = 0, rowLen = rowArr.length; i < rowLen; i++) {
                var e = rowArr[i];
                if (!inquote && trim) {
                  e = e.trim();
                }
                var len = e.length;
                if (!inquote) {
                  if (isQuoteOpen(e, param)) { //quote open
                    e = e.substr(1);
                    if (isQuoteClose(e, param)) { //quote close
                      e = e.substring(0, e.length - 1);
                      e = _escapeQuote(e, quote, escape);
                      row.push(e);
                      continue;
                    } else {
                      inquote = true;
                      quoteBuff += e;
                      continue;
                    }
                  } else {
                    row.push(e);
                    continue;
                  }
                } else { //previous quote not closed
                  if (isQuoteClose(e, param)) { //close double quote
                    inquote = false;
                    e = e.substr(0, len - 1);
                    quoteBuff += delimiter + e;
                    quoteBuff = _escapeQuote(quoteBuff, quote, escape);
                    if (trim) {
                      quoteBuff = quoteBuff.trimRight();
                    }
                    row.push(quoteBuff);
                    quoteBuff = "";
                  } else {
                    quoteBuff += delimiter + e;
                  }
                }
              }

              if (!inquote && param._needFilterRow) {
                row = filterRow(row, param);
              }

              return { cols: row, closed: !inquote };
              // if (param.workerNum<=1){
              // }else{
              //   if (inquote && quoteBuff.length>0){//for multi core, quote will be closed at the end of line
              //     quoteBuff=_escapeQuote(quoteBuff,quote,escape);;
              //     if (trim){
              //       quoteBuff=quoteBuff.trimRight();
              //     }
              //     row.push(quoteBuff);
              //   }
              //   return {cols:row,closed:true};
              // }

            }
function rowSplit(rowStr, param) {
              if (rowStr === "") {
                return { cols: [], closed: true };
              }
              var quote = param.quote;
              var trim = param.trim;
              var escape = param.escape;
              if (param.delimiter instanceof Array || param.delimiter.toLowerCase() === "auto") {
                param.delimiter = getDelimiter_1(rowStr, param);
              }
              var delimiter = param.delimiter;
              var rowArr = rowStr.split(delimiter);
              if (quote === "off") {
                return { cols: rowArr, closed: true };
              }
              var row = [];
              var inquote = false;
              var quoteBuff = '';
              for (var i = 0, rowLen = rowArr.length; i < rowLen; i++) {
                var e = rowArr[i];
                if (!inquote && trim) {
                  e = e.trim();
                }
                var len = e.length;
                if (!inquote) {
                  if (isQuoteOpen(e, param)) { //quote open
                    e = e.substr(1);
                    if (isQuoteClose(e, param)) { //quote close
                      e = e.substring(0, e.length - 1);
                      e = _escapeQuote(e, quote, escape);
                      row.push(e);
                      continue;
                    } else {
                      inquote = true;
                      quoteBuff += e;
                      continue;
                    }
                  } else {
                    row.push(e);
                    continue;
                  }
                } else { //previous quote not closed
                  if (isQuoteClose(e, param)) { //close double quote
                    inquote = false;
                    e = e.substr(0, len - 1);
                    quoteBuff += delimiter + e;
                    quoteBuff = _escapeQuote(quoteBuff, quote, escape);
                    if (trim) {
                      quoteBuff = quoteBuff.trimRight();
                    }
                    row.push(quoteBuff);
                    quoteBuff = "";
                  } else {
                    quoteBuff += delimiter + e;
                  }
                }
              }

              if (!inquote && param._needFilterRow) {
                row = filterRow(row, param);
              }

              return { cols: row, closed: !inquote };
              // if (param.workerNum<=1){
              // }else{
              //   if (inquote && quoteBuff.length>0){//for multi core, quote will be closed at the end of line
              //     quoteBuff=_escapeQuote(quoteBuff,quote,escape);;
              //     if (trim){
              //       quoteBuff=quoteBuff.trimRight();
              //     }
              //     row.push(quoteBuff);
              //   }
              //   return {cols:row,closed:true};
              // }

            }
function rowSplit ( rowStr , param ) { if ( rowStr === "" ) { return { cols : [ ] , closed : true } ; } var quote = param . quote ; var trim = param . trim ; var escape = param . escape ; if ( param . delimiter instanceof Array || param . delimiter . toLowerCase ( ) === "auto" ) { param . delimiter = getDelimiter_1 ( rowStr , param ) ; } var delimiter = param . delimiter ; var rowArr = rowStr . split ( delimiter ) ; if ( quote === "off" ) { return { cols : rowArr , closed : true } ; } var row = [ ] ; var inquote = false ; var quoteBuff = '' ; for ( var i = 0 , rowLen = rowArr . length ; i < rowLen ; i ++ ) { var e = rowArr [ i ] ; if ( ! inquote && trim ) { e = e . trim ( ) ; } var len = e . length ; if ( ! inquote ) { if ( isQuoteOpen ( e , param ) ) { //quote open e = e . substr ( 1 ) ; if ( isQuoteClose ( e , param ) ) { //quote close e = e . substring ( 0 , e . length - 1 ) ; e = _escapeQuote ( e , quote , escape ) ; row . push ( e ) ; continue ; } else { inquote = true ; quoteBuff += e ; continue ; } } else { row . push ( e ) ; continue ; } } else { //previous quote not closed if ( isQuoteClose ( e , param ) ) { //close double quote inquote = false ; e = e . substr ( 0 , len - 1 ) ; quoteBuff += delimiter + e ; quoteBuff = _escapeQuote ( quoteBuff , quote , escape ) ; if ( trim ) { quoteBuff = quoteBuff . trimRight ( ) ; } row . push ( quoteBuff ) ; quoteBuff = "" ; } else { quoteBuff += delimiter + e ; } } } if ( ! inquote && param . _needFilterRow ) { row = filterRow ( row , param ) ; } return { cols : row , closed : ! inquote } ; // if (param.workerNum<=1){ // }else{ //   if (inquote && quoteBuff.length>0){//for multi core, quote will be closed at the end of line //     quoteBuff=_escapeQuote(quoteBuff,quote,escape);; //     if (trim){ //       quoteBuff=quoteBuff.trimRight(); //     } //     row.push(quoteBuff); //   } //   return {cols:row,closed:true}; // } }
Convert a line of string to csv columns according to its delimiter
the param._header may not be ready when this is called.
@param  {[type]} rowStr [description]
@param  {[type]} param  [Converter param]
@return {[type]}        {cols:["a","b","c"],closed:boolean} the closed field indicate if the row is a complete row
Convert a line of string to csv columns according to its delimiter the param . _header may not be ready when this is called .