MCPcopy Create free account
hub / github.com/HelloCSV/HelloCSV / escapeCsvCell

Function escapeCsvCell

src/utils/index.ts:64–78  ·  view source on GitHub ↗
(value: ImporterOutputFieldType)

Source from the content-addressed store, hash-verified

62}
63
64function escapeCsvCell(value: ImporterOutputFieldType): string {
65 if (value == null) {
66 return '';
67 }
68
69 let cell = String(value);
70
71 cell = cell.replace(/"/g, '""');
72
73 if (/[",\n\r]/.test(cell)) {
74 cell = `"${cell}"`;
75 }
76
77 return cell;
78}
79
80export function generateCsvContent(
81 sheetDefinition: SheetDefinition,

Callers 1

generateCsvContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected