jquery-csv
node example
pseudo code
var input = `
"apple","100g"
"orange","150g"
"grape","20g"
`;
require("javascript-csv").toArrays(input);
// [
// ["apple", "100g"],
// ["orange", "150g"],
// ["grape", "20g"]
// ]
more examples
more examples in examples folder (javascript demo but work perfectly with node)
Summary
Javascript is growing up and HTML is finally maturing the point where webapps are being built to completely displace desktop applications. It's about time that the supporting libraries grow up too.
Looking for a complete, end-to-end, battle tested, performance optimized CSV parser that's available in the familiar jQuery syntax style? Welcome...
This library is a different creature, featuring a slim Chomsky - Type III parser implementation. Full (that means 100%) IETF RFC 4180 compliance. Including coverage for a few edge cases that even the spec fails to cover.
- Convert a CSV String to an array
- Convert a multi-line CSV string to a 2D array
- Convert a multi-line CSV string to an array of objects (ie header:value pairs)
- Hooks to extend the default parsing process (under development)
- Customizable delimiter (default: ") and separator (default: ,) characters
- Node.js support (ie CommonJS importing and async callback support)
More information on a original projects page.
Fork
How this fork differs from the origin:
- It can convert an array of values to CSV
- It can convert an array of objects to CSV
- It can be launched on nodejs.
jQuery
is no longer required to be require
d :)