We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de4a048 commit d6832a5Copy full SHA for d6832a5
src/components/Table/common/utils.ts
@@ -99,11 +99,16 @@ function formatDataToTSV(data: TableData[][]): string {
99
.map((row) => {
100
return row
101
.map((data) => {
102
- // Concatenate array values.
103
- if (Array.isArray(data)) {
104
- return data.join(", ");
105
- }
106
- return data;
+ // Use empty string in place of undefined and null.
+ if (data === undefined || data === null) return "";
+ // Convert to string.
+ const dataString = Array.isArray(data)
+ ? data.join(", ")
107
+ : String(data);
108
+ // Quote if necessary.
109
+ return /[\t\r\n"]/.test(dataString)
110
+ ? `"${dataString.replaceAll('"', '""')}"`
111
+ : dataString;
112
})
113
.join("\t");
114
0 commit comments