MCPcopy Index your code
hub / github.com/coder/mux / sanitizeProjectSegment

Function sanitizeProjectSegment

src/node/runtime/remoteProjectLayout.ts:16–23  ·  view source on GitHub ↗
(segment: string)

Source from the content-addressed store, hash-verified

14}
15
16function sanitizeProjectSegment(segment: string): string {
17 const sanitized = segment
18 .trim()
19 .replace(/[^A-Za-z0-9._-]+/g, "-")
20 .replace(/-+/g, "-")
21 .replace(/^-|-$/g, "");
22 return sanitized.length > 0 ? sanitized : "project";
23}
24
25function hashText(input: string): string {
26 return crypto.createHash("sha256").update(input).digest("hex").slice(0, 12);

Callers 1

createRemoteProjectIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected