MCPcopy Create free account
hub / github.com/Keyang/node-csvtojson / parseMultiLines

Method parseMultiLines

src/rowSplit.ts:197–219  ·  view source on GitHub ↗
(lines: Fileline[])

Source from the content-addressed store, hash-verified

195 return segment.replace(regExp, this.quote);
196 }
197 parseMultiLines(lines: Fileline[]): MultipleRowResult {
198 const csvLines: string[][] = [];
199 let left = "";
200 while (lines.length) {
201 const line = left + lines.shift();
202 const row = this.parse(line);
203 if (row.cells.length === 0 && this.conv.parseParam.ignoreEmpty) {
204 continue;
205 }
206 if (row.closed || this.conv.parseParam.alwaysSplitAtEOL) {
207 if (this.conv.parseRuntime.selectedColumns) {
208 csvLines.push(filterArray(row.cells, this.conv.parseRuntime.selectedColumns));
209 } else {
210 csvLines.push(row.cells);
211 }
212
213 left = "";
214 } else {
215 left = line + (getEol(line, this.conv.parseRuntime) || "\n");
216 }
217 }
218 return { rowsCells: csvLines, partial: left };
219 }
220}
221export interface MultipleRowResult {
222 rowsCells: string[][];

Callers 5

browser.jsFile · 0.80
csvtojson.min.jsFile · 0.80
ProcessorLocal.jsFile · 0.80
funcFunction · 0.80
processCSVBodyMethod · 0.80

Calls 2

parseMethod · 0.95
filterArrayFunction · 0.90

Tested by 1

funcFunction · 0.64