Parsing and stringifying CSV correctly — quotes, commas-in-cells, CRLF and delimiter detection.
Overview
CSV looks trivial until commas-in-quotes, quotes-in-quotes, newlines-in-cells and CRLF. This handles the RFC 4180 edge cases correctly, returns typed row objects, stringifies with minimal quoting, and auto-detects comma/tab/semicolon — in a few hundred bytes.
Install
$ npm install @lacspace/csv
Quick example
@lacspace/csvts
parse("name,age\nAda,36")
Returns [{ name, age }]
Tips
It returns typed row objects and auto-detects comma/tab/semicolon delimiters.
Zero-dependency and isomorphic — safe to import on the server, in the browser, on the edge and in React Native. It tree-shakes, so you only ship what you import.