CSV-JS - A Comma-Separated Values parser for JS
Built to rfc4180 standard, with options for adjusting strictness:
- optional carriage returns for non-microsoft sources
- automatically type-cast numeric an boolean values
- relaxed mode which: ignores blank lines, ignores gargabe following quoted tokens, does not enforce a consistent record length
Adopted for UnityBase by pavel.mash
Usage sample:
var csv = require('@unitybase/base').csv;
// simple
var rows = csv.parse('one,two,three\nfour,five,six')
// rows equals [["one","two","three"],["four","five","six"]]
// or read from file system
var fs = require('fs'), f = fs.readFileSync('c:/csv.txt');
var rows = csv.parse(f);
for( var i =0; i < rows.length; i++){
console.log(rows[i]);
}