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

Function normalizeImportEntryName

src/main/import/snippets/normalizers.ts:31–52  ·  view source on GitHub ↗
(
  value: unknown,
  fallback: string,
)

Source from the content-addressed store, hash-verified

29}
30
31export function normalizeImportEntryName(
32 value: unknown,
33 fallback: string,
34): string {
35 const raw = typeof value === 'string' ? value : ''
36 let name = replaceInvalidEntryChars(raw.trim())
37
38 name = name
39 .replace(/^\.+/, '')
40 .replace(/[. ]+$/g, '')
41 .trim()
42
43 if (!name || name === '.' || name === '..') {
44 name = fallback
45 }
46
47 if (WINDOWS_RESERVED_NAME_RE.test(name)) {
48 name = `${name} item`
49 }
50
51 return name
52}
53
54export function normalizeImportTag(value: unknown): string | null {
55 if (typeof value !== 'string') {

Callers 13

ensureFolderPathFunction · 0.90
createSnippetFunction · 0.90
parseVSCodeSnippetFilesFunction · 0.90
getSnippetNameFunction · 0.90
parseGitHubGistResponseFunction · 0.90
getFolderPathFunction · 0.90
parseRaycastSnippetFilesFunction · 0.90
visitFunction · 0.90
parseSnippetsLabFilesFunction · 0.90
ensureFolderPathFunction · 0.90
createNoteFunction · 0.90
getFolderPathFunction · 0.90

Calls 1

replaceInvalidEntryCharsFunction · 0.85

Tested by

no test coverage detected