asafdav / ng-csv

Simple directive that turns arrays and objects into downloadable CSV files
MIT License
573 stars 215 forks source link

Create default options object when none is provided #210

Open DavidVotrubec opened 7 years ago

DavidVotrubec commented 7 years ago

Method CSV.stringify() requires 2 arguments. Data and Options. I believe that Options should be optional, especially when supplying empty object is sufficient.

The second issue is that the options should have some reasonable default values, which could be optionally overrided. Fox example the options.txtDelim should have default value of '\"'.

If options.txtDelim is not provided and data contain comma in the middle of some text property, then this comma is not automatically escaped and creates new column in generated CSV.