mafintosh / mafintosh/csv-parser
Why's this code so ugly?
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/mafintosh/csv-parser/blob/master/index.js#L3-L4
```js
const [cr] = Buffer.from('\r')
const [nl] = Buffer.from('\n')
```
Apparently it's CR and LF, CR `0x0d` and LF `0x0a`. Why does it need a Buffer to get these values?
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 at index.js lines 3-4 and trace where cr and nl are consumed. Determine whether the Buffer conversion is required for the parser's byte comparisons or can be simplified without changing behavior. Done means documenting the reason or agreeing on a minimal cleanup, then running the repository's existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100