asafdav / ng-csv

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

Cant add txtDelim when the seprator is not equals to (,) without setting quoteStrings to true #232

Open agoubar opened 5 years ago

agoubar commented 5 years ago
    if (options.quoteStrings || data.indexOf(',') > -1 || data.indexOf('\n') > -1 || data.indexOf('\r') > -1) {
        data = options.txtDelim + data + options.txtDelim;
    }

must be replaced by if (options.quoteStrings || data.indexOf(options.fieldSep ? options.fieldSep : ",") > -1 || data.indexOf('\n') > -1 || data.indexOf('\r') > -1) { data = options.txtDelim + data + options.txtDelim; }