Expose the ability to skip initial rows in CSV parser.
This commit is contained in:
@@ -129,7 +129,7 @@ this.recline.Backend.CSV = this.recline.Backend.CSV || {};
|
|||||||
|
|
||||||
// If we are at a EOF or EOR
|
// If we are at a EOF or EOR
|
||||||
if (inQuote === false && (cur === delimiter || cur === "\n")) {
|
if (inQuote === false && (cur === delimiter || cur === "\n")) {
|
||||||
field = processField(field);
|
field = processField(field);
|
||||||
// Add the current field to the current row
|
// Add the current field to the current row
|
||||||
row.push(field);
|
row.push(field);
|
||||||
// If this is EOR append row to output and flush row
|
// If this is EOR append row to output and flush row
|
||||||
@@ -169,6 +169,9 @@ this.recline.Backend.CSV = this.recline.Backend.CSV || {};
|
|||||||
row.push(field);
|
row.push(field);
|
||||||
out.push(row);
|
out.push(row);
|
||||||
|
|
||||||
|
// Expose the ability to discard initial rows
|
||||||
|
if (options.skipInitialRows) out = out.slice(options.skipInitialRows);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user