mafintosh / mafintosh/csv-parser
strict: false - headers lost after row with wrong number of columns
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
* Operating System: MacOS 10.14.6
* Node Version: v12.11.1
* NPM Version: 6.11.3
* csv-parser Version: 2.3.1
### Expected Behavior
headers created with "mapHeaders" should be used for all valid records, even for records with to many or to less columns
### Actual Behavior
* when a line contains more columns than headers the broken record is returned with indexed keys.
* any valid line following the broken line is returned with indexed key and not with the headers
### How Do We Reproduce?
https://github.com/aheissenberger/csv-parser?organization=aheissenberger&organization=aheissenberger
```
1 test failed
strictNo › strictNo
/Users/ah/SVN-Checkouts/DEV/csv-parser/test/strictNo.test.js:9
8: const headersLastLine = Object.keys(lines[2])
9: t.deepEqual(headersFirstLine, headersLastLine)
10: t.false(err, 'no err')
Difference:
[
- 'a',
+ '0',
- 'b',
+ '1',
- 'c',
+ '2',
]
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/strictNo.test.js and reproduce the failing assertion for the record after a row with too many columns. Trace the parser behavior that follows the malformed row; done means strict:false preserves the mapHeaders keys for subsequent valid records without producing an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100