I am using jquery CSV library (https://github.com/evanplaice/jquery-csv/) , to parse and convert a CSV file into an array of objects. This is my code
this.parsedData = $.csv.toObjects(data);
if (this.parsedData.length === 0) {
**console.log('In valid'); /**/ This gets printed
} else {
console.log('valid')
}
My CSV file is this:
""__stream_code","project_code","process","due_date","root_table"
"DASH_PLAY_001","DEV","Plate",2013-02-02,"stream"
"DASH_PLAY_001","DEV","DepthAssess",2013-02-03,"stream""
Now, if I remove quotes, it works fine, but with quotes it doesn't. Most of the time, my application is going to handle CSV with values in quotes. Is there any way to fix it?
jQuery.csvnamespace. Edit: Altough that particular library seems OK, claiming to have implemented the RFC format.ifcondition backwards? If the CSV is valid, it will return an array of objects, solengthwill be non-zero.nullorundefinedif it gets an error, not a zero-length array.