@databiosphere/findable-ui 21.1.0 → 21.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "21.1.0"
2
+ ".": "21.1.1"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [21.1.1](https://github.com/DataBiosphere/findable-ui/compare/v21.1.0...v21.1.1) (2025-01-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * quote values in tsv export when they contain syntactic characters ([#314](https://github.com/DataBiosphere/findable-ui/issues/314)) ([#315](https://github.com/DataBiosphere/findable-ui/issues/315)) ([d6832a5](https://github.com/DataBiosphere/findable-ui/commit/d6832a56f5245281e635902000dcecaab62c155f))
9
+
3
10
  ## [21.1.0](https://github.com/DataBiosphere/findable-ui/compare/v21.0.0...v21.1.0) (2025-01-30)
4
11
 
5
12
 
@@ -63,11 +63,17 @@ function formatDataToTSV(data) {
63
63
  .map((row) => {
64
64
  return row
65
65
  .map((data) => {
66
- // Concatenate array values.
67
- if (Array.isArray(data)) {
68
- return data.join(", ");
69
- }
70
- return data;
66
+ // Use empty string in place of undefined and null.
67
+ if (data === undefined || data === null)
68
+ return "";
69
+ // Convert to string.
70
+ const dataString = Array.isArray(data)
71
+ ? data.join(", ")
72
+ : String(data);
73
+ // Quote if necessary.
74
+ return /[\t\r\n"]/.test(dataString)
75
+ ? `"${dataString.replaceAll('"', '""')}"`
76
+ : dataString;
71
77
  })
72
78
  .join("\t");
73
79
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "21.1.0",
3
+ "version": "21.1.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -99,11 +99,16 @@ function formatDataToTSV(data: TableData[][]): string {
99
99
  .map((row) => {
100
100
  return row
101
101
  .map((data) => {
102
- // Concatenate array values.
103
- if (Array.isArray(data)) {
104
- return data.join(", ");
105
- }
106
- return data;
102
+ // Use empty string in place of undefined and null.
103
+ if (data === undefined || data === null) return "";
104
+ // Convert to string.
105
+ const dataString = Array.isArray(data)
106
+ ? data.join(", ")
107
+ : String(data);
108
+ // Quote if necessary.
109
+ return /[\t\r\n"]/.test(dataString)
110
+ ? `"${dataString.replaceAll('"', '""')}"`
111
+ : dataString;
107
112
  })
108
113
  .join("\t");
109
114
  })