Quartz/Chartbuilder — pull request #54 by petermlm (2013-08-04 23:24:25+00:00)
Title: Parser now validates the input.

Hello!

I made a few changes to correct issue #50. Bellow is the justification. I, off course, tested everything, so the code should work out of the box.

The function getNewData was changed. In the previous version this function would read the input, create the data object and populate the table bellow the input box. I decided to change it a little bit for several reasons.

So now this function only reads the CSV in the input and makes a matrix with it's information. You may notice that this function no longer uses the $.csv.toArray utility. This is because the function will validate the input while it creates the matrix, to see if it is well formatted. If it is the function will create the matrix and return it. If it isn't the function, at some point, will return null.

With the return of getNewData the new function, makeDataObj will make an object that is equivalent to the object returned by the getNewData function in the previous version.

Lastly, in the previous version, the function createTable is called at the end of getNewData. I changed it's calling location. It is now called after the function makeDataObj. This is mostly because the function getNewData is a getter function and therefore it shouldn't have other side effects, like updating the table. But that is just my opinion. If you would like I can commit another version with the function in the right place.