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

Function normalizeImportName

src/main/http/import/normalize.ts:54–75  ·  view source on GitHub ↗
(value: unknown, fallback: string)

Source from the content-addressed store, hash-verified

52}
53
54export function normalizeImportName(value: unknown, fallback: string): string {
55 const raw = typeof value === 'string' ? value : ''
56 let name = [...raw.trim()]
57 .map(char =>
58 INVALID_NAME_CHARS.has(char) || char.charCodeAt(0) <= 0x1F ? '-' : char,
59 )
60 .join('')
61 name = name
62 .replace(/^\.+/, '')
63 .replace(/[. ]+$/g, '')
64 .trim()
65
66 if (!name || name === '.' || name === '..') {
67 name = fallback
68 }
69
70 if (WINDOWS_RESERVED_NAME_RE.test(name)) {
71 name = `${name} item`
72 }
73
74 return name
75}
76
77export function normalizeHttpMethod(
78 value: unknown,

Callers 15

createUniqueFolderFunction · 0.90
createUniqueRequestFunction · 0.90
createUniqueEnvironmentFunction · 0.90
getCollectionNameFunction · 0.90
getRequestNameFunction · 0.90
getFolderIdFunction · 0.90
parseEnvironmentFunction · 0.90
parseRequestFunction · 0.90
walkItemsFunction · 0.90
parseCollectionFunction · 0.90
parsePostmanFilesFunction · 0.90
parseEnvironmentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected