finite-csv

0.0.4 • Public • Published

finite-csv

A CSV parser that uses a finite state machine and works with Excel CSV exports.

The world doesn't need a new CSV parser but I wanted to play with a light weight finite state machine in JavaScript and I conincidentally couldn't find a parser that would properly parse CSV files output from Excel.

Most CSV parsers split on CR-LF but the spec clearly states that you can have carriage returns in the field if it's enclosed with double quotes. If you have a cell in Excel that includes a carriage return then it seems that most CSV parsers fail.

The other issue I've found with most parsers is that they require you to either enclose all or none of the fields in quotes. Excel and other programs will output fields that use quotes only when the contents contain commas or carriage returns.

Finite state machine are probably better used for workflows but I wanted to demonstrate how easy this would be to build using a state machine. Debugging was simple and it was easy to find errors.

Readme

Keywords

none

Package Sidebar

Install

npm i finite-csv

Weekly Downloads

0

Version

0.0.4

License

BSD

Last publish

Collaborators

  • mcheavyd