MCPcopy Create free account
hub / github.com/simstudioai/sim / escapeCsvValue

Function escapeCsvValue

apps/sim/lib/copilot/request/tools/files.ts:88–95  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

86}
87
88export function escapeCsvValue(value: unknown): string {
89 if (value === null || value === undefined) return ''
90 const str = typeof value === 'object' ? JSON.stringify(value) : String(value)
91 if (str.includes(',') || str.includes('"') || str.includes('\n') || str.includes('\r')) {
92 return `"${str.replace(/"/g, '""')}"`
93 }
94 return str
95}
96
97export function convertRowsToCsv(rows: Record<string, unknown>[]): string {
98 if (rows.length === 0) return ''

Callers 1

convertRowsToCsvFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected