revert change to csv parsing

pull/68/head
Michael Aschauer 2018-10-23 17:24:55 +02:00
rodzic 38450e729a
commit 6ddf489044
1 zmienionych plików z 1 dodań i 21 usunięć

Wyświetl plik

@ -2789,7 +2789,7 @@ Process.prototype.parseCSV = function (string) {
// by lines.
// taken from:
// https://stackoverflow.com/questions/8493195/how-can-i-parse-a-csv-string-with-javascript-which-contains-comma-in-data
/*
var re_valid = /^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/,
re_value = /(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g,
a = [];
@ -2817,26 +2817,6 @@ Process.prototype.parseCSV = function (string) {
a.push('');
}
return new List(a);
*/
let ret = [''], i = 0, p = '', s = true;
for (let l in string) {
l = string[l];
if ('"' === l) {
s = !s;
if ('"' === p) {
ret[i] += '"';
l = '-';
} el
l = '-';
} else if (s && ',' === l)
l = ret[++i] = '';
else
ret[i] += l;
p = l;
}
return new List(ret);
};
// Process debugging