MCPcopy
hub / github.com/simstudioai/sim / sanitizeName

Function sanitizeName

apps/sim/lib/table/import.ts:166–178  ·  view source on GitHub ↗
(raw: string, fallbackPrefix = 'col')

Source from the content-addressed store, hash-verified

164 * is a letter or underscore (prefixing with `fallbackPrefix` otherwise).
165 */
166export function sanitizeName(raw: string, fallbackPrefix = 'col'): string {
167 let name = raw
168 .trim()
169 .replace(/[^a-zA-Z0-9_]/g, '_')
170 .replace(/_+/g, '_')
171 .replace(/^_+|_+$/g, '')
172
173 if (!name || /^\d/.test(name)) {
174 name = `${fallbackPrefix}_${name}`
175 }
176
177 return name
178}
179
180/**
181 * Returns column definitions inferred from CSV headers + sample rows. Duplicate

Callers 9

executeFunction · 0.90
resolveSetupFunction · 0.90
import.test.tsFile · 0.90
route.tsFile · 0.90
buildTableFunction · 0.90
route.tsFile · 0.90
inferSchemaFromCsvFunction · 0.70
buildAutoMappingFunction · 0.70
sanitizeJsonHeadersFunction · 0.70

Calls 2

testMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected