Skip to content

Latest commit

 

History

History
35 lines (20 loc) · 1.88 KB

README.md

File metadata and controls

35 lines (20 loc) · 1.88 KB

CSV.js

Codeship Status for jxpx777/js-csv-parser Code Climate Coverage Status

What?

A parser for RFC 4180 compliant CSV data written in Javascript. It handles double-quoted fields and multi-line rows. It's strict mode compliant, has no warnings or errors against JSHint, and includes Jasmine specs to make sure things keep working well.

Why?

I needed one and couldn't find anything great that didn't suffer from edge cases I'd bumped into in other languages' libraries in the past.

How?

Import csv.js. Create a new CSVParser(stringOfCSVData[, options]) and call parse.

Options: The second parameter to the constructor is an options object. Supported options:

{
  fieldSeparator : ",", 
  strict : true,
  ignoreEmpty: true
}

The values above are the defaults. strict enforces that every row has the same number of fields. ignoreEmpty prevents having rows of data with all empty values.

Support

If you're using this, I'd love to know. If you run into bugs, report them and I'll see what I can do. Better yet, if you see a problem, fork, fix, and send a pull request. Pull requests without tests will be rejected. You should be writing tests for your code.

Bitdeli Badge

Credits

Kirtan initially shared the regular expression on Stack Overflow Huge credit goes there.