Skip to content

An RFC 4180 compliant CSV parsing library written in Javascript.

License

Notifications You must be signed in to change notification settings

jxpx777/js-csv-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An RFC 4180 compliant CSV parsing library written in Javascript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published