fast-csv
fast-csv copied to clipboard
[FEATURE] - line number
Parsing or Formatting?
- [ ] Formatting
- [X] Parsing
Is your feature request related to a problem? Please describe.
Ffor better UI i want to bind parsed data with csv file line numbers . For example to give message like:
Import error. Csv line 134 803. Value of field [Product ] is missing from the database. Do you want to add it?
Because of headers, ignored and comment lines there is no simple rule between parsed data row index and csv line.
Describe the solution you'd like
const csv = parse( stream, {
addLineNumber: true,
});
csv.on('data', row => console.log(row.lineNumber));
where new parameter:
addLineNumber?: boolean | string | Symbol; // default property name is `lineNumber`
enabling new feature (true) and optionaly allow change property name for row counter (string | Symbol)