shystruk / csv-file-validator

🔧🔦 Validation of CSV file against user defined schema (returns back object with data and invalid messages)
https://www.npmjs.com/package/csv-file-validator
MIT License
93 stars 42 forks source link

Allow parsing options to be given when validating a CSV #34

Closed Liiva closed 3 years ago

Liiva commented 4 years ago

My use case is that users often provide CSV files with a trailing newline and this library considers that to be an invalid file if any of the headers is required. I'd like to simply skip these lines and PapaParse has an option for this in skipEmptyLines: true, however the current structure has no way for me to pass this option to the internal PapaParse instance.

I've currently forked this repo and added a commit to fix above issue by allowing a third "options" argument to be given to the validator. If you like this approach then I can create a pull request for it.

shystruk commented 4 years ago

@Liiva Good point. I would like to see and merge your pull request. Thanks!

Liiva commented 4 years ago

Just a small update: I'm having some issues reproducing this case in the unit tests, which is holding me back from submitting the pull request. I still intend on doing this but time is short...

shystruk commented 4 years ago

@Liiva thanks for the update. Take your time :)

shystruk commented 3 years ago

Hi @Liiva, By default skipEmptyLines: true is passing to PapaParse. Currently, no other configs are supported. If you need some please create a new issue.