Skip to content

Commit 4fb794e

Browse files
committed
Move exportTableToDsv function to data/utils.ts
1 parent 88883bd commit 4fb794e

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/app/utils.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,3 @@ export function hashCode(str: string) {
917917
}
918918
return hash;
919919
}
920-
/**
921-
* Exports a DictTable to DSV format using d3.dsvFormat
922-
* @param table - The DictTable to export
923-
* @param delimiter - The delimiter to use (e.g., "," for CSV, "\t" for TSV)
924-
* @returns DSV string representation of the table
925-
*/
926-
export const exportTableToDsv = (table: DictTable, delimiter: string): string => {
927-
// Use d3.dsvFormat to convert the rows array to DSV
928-
return d3.dsvFormat(delimiter).format(table.rows);
929-
};

src/data/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,14 @@ export const loadBinaryDataWrapper = async (title: string, arrayBuffer: ArrayBuf
241241
return [];
242242
}
243243
};
244+
245+
/**
246+
* Exports a DictTable to DSV format using d3.dsvFormat
247+
* @param table - The DictTable to export
248+
* @param delimiter - The delimiter to use (e.g., "," for CSV, "\t" for TSV)
249+
* @returns DSV string representation of the table
250+
*/
251+
export const exportTableToDsv = (table: DictTable, delimiter: string): string => {
252+
// Use d3.dsvFormat to convert the rows array to DSV
253+
return d3.dsvFormat(delimiter).format(table.rows);
254+
};

src/views/ChartifactDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Licensed under the MIT License.
33

44
import { Chart, DictTable, FieldItem } from '../components/ComponentType';
5-
import { assembleVegaChart, prepVisTable, exportTableToDsv } from '../app/utils';
5+
import { assembleVegaChart, prepVisTable } from '../app/utils';
6+
import { exportTableToDsv } from '../data/utils';
67
import { ClientConfig } from '../app/dfSlice';
78

89
// Function to generate CSS styling based on report type

0 commit comments

Comments
 (0)