MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / sanitizeForPathSegment

Function sanitizeForPathSegment

src/core/createCompat.ts:324–333  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

322}
323
324function sanitizeForPathSegment(value: string): string {
325 return value
326 .trim()
327 .split("")
328 .filter((char) => !INVALID_PATH_SEGMENT_CHARS.has(char) && !isControlCharacter(char))
329 .join("")
330 .replace(/[\\/]+/g, "-")
331 .replace(/\s+/g, " ")
332 .trim();
333}
334
335function isControlCharacter(value: string): boolean {
336 if (value.length === 0) return false;

Callers 1

buildTemplateValuesFunction · 0.85

Calls 2

isControlCharacterFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected