fix: added column separator select (comma, semicolon and both) in CSV viewer (#5604)

Co-authored-by: Henrique Dias <mail@hacdias.com>
This commit is contained in:
Ariel LeyvaandHenrique Dias authored and GitHub committed 2025-12-06 11:08:50 +01:00
1 parent f029c3005e
commit 204a3f0eea
3 files changed
+64 -7

No files matched your search

+5 -2
View File
@@ -7,7 +7,10 @@ export interface CsvData {
* Parse CSV content into headers and rows
* Supports quoted fields and handles commas within quotes
*/
export function parseCSV(content: string): CsvData {
export function parseCSV(
content: string,
columnSeparator: Array<string>
): CsvData {
if (!content || content.trim().length === 0) {
return { headers: [], rows: [] };
}
@@ -35,7 +38,7 @@ export function parseCSV(content: string): CsvData {
// Toggle quote state
inQuotes = !inQuotes;
}
} else if (char === "," && !inQuotes) {
} else if (columnSeparator.includes(char) && !inQuotes) {
// Field separator
row.push(currentField);
currentField = "";