(cell: unknown)
| 249 | } |
| 250 | |
| 251 | const escapeCell = (cell: unknown): string => { |
| 252 | if (cell === null || cell === undefined) return '' |
| 253 | const stringValue = String(cell) |
| 254 | const mustQuote = /[",\n\r]/.test(stringValue) |
| 255 | const doubledQuotes = stringValue.replace(/"/g, '""') |
| 256 | return mustQuote ? `"${doubledQuotes}"` : doubledQuotes |
| 257 | } |
| 258 | |
| 259 | const rowsAsStrings = (table as unknown[]).map((row) => { |
| 260 | if (!Array.isArray(row)) { |
no test coverage detected