Wrapper for csvtojson that handles filepaths and csv strings directly
npm install @concierge-auctions/csv-parserMost of the credit goes to csvtojson. This package is a thin wrapper on top of csvtojson tailored to our anticipated use cases.
Features
* Promise API
* Transform column names
* Returns JS object or JSON string
* Parse CSV from a string or file
* Non-blocking (5-6ms ticks on average)
* Don't lose the configurability of csvtojson
Future concerns:
* Blocking for "data" path (split and reverse). The cost of this isn't terribly high, but could become a concern with larger datasets. (~70ms for 200k lines @ 25 columns)
* columnNameMapper option (function) so that we could pass in a toCamelCase function or something.
* columnTypeMapper map function for each value (integer for some columns, date for others)
* Allow a stream to be passed in instead a string of filename
Check out tests for usage examples