You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							704 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							704 B
						
					
					
				| var getEol = require("./getEol");
 | |
| var rowSplit = require("./rowSplit");
 | |
| /**
 | |
|  * Convert lines to csv columns
 | |
|  * @param  {[type]} lines [file lines]
 | |
|  * @param  {[type]} param [Converter param]
 | |
|  * @return {[type]}  {lines:[[col1,col2,col3...]],partial:String}
 | |
|  */
 | |
| module.exports = function(lines, param) {
 | |
|   var csvLines = [];
 | |
|   var left = "";
 | |
|   while (lines.length) {
 | |
|     var line = left + lines.shift();
 | |
|     var row = rowSplit(line, param);
 | |
|       if (row.closed || param.alwaysSplitAtEOL) {
 | |
|       csvLines.push(row.cols);
 | |
|       left = "";
 | |
|     } else {
 | |
|       left = line + (getEol(line, param) || "\n"); // if unable to getEol from data, assume "\n"
 | |
|     }
 | |
|   }
 | |
|   return {lines: csvLines, partial: left};
 | |
| };
 |