MCPcopy Index your code
hub / github.com/massCodeIO/massCode / getUniqueName

Function getUniqueName

src/main/api/routes/captures.ts:138–147  ·  view source on GitHub ↗
(baseName: string, existingNames: string[])

Source from the content-addressed store, hash-verified

136}
137
138function getUniqueName(baseName: string, existingNames: string[]): string {
139 const normalizedBase = sanitizeCaptureName(baseName, 'Captured item')
140 const hasConflict = existingNames.some(
141 name => name.trim().toLowerCase() === normalizedBase.toLowerCase(),
142 )
143
144 return hasConflict
145 ? getNextIndexedName(normalizedBase, existingNames)
146 : normalizedBase
147}
148
149function sanitizeCaptureName(name: string, fallback: string): string {
150 let sanitized = Array.from(name)

Callers 3

createCodeCaptureFunction · 0.85
createNotesCaptureFunction · 0.85
createHttpCaptureFunction · 0.85

Calls 2

sanitizeCaptureNameFunction · 0.85
getNextIndexedNameFunction · 0.70

Tested by

no test coverage detected