MCPcopy
hub / github.com/fosrl/pangolin / sanitize

Function sanitize

server/lib/traefik/pathEncoding.test.ts:5–14  ·  view source on GitHub ↗
(input: string | null | undefined)

Source from the content-addressed store, hash-verified

3// ── Pure function copies (inlined to avoid pulling in server dependencies) ──
4
5function sanitize(input: string | null | undefined): string | undefined {
6 if (!input) return undefined;
7 if (input.length > 50) {
8 input = input.substring(0, 50);
9 }
10 return input
11 .replace(/[^a-zA-Z0-9-]/g, "-")
12 .replace(/-+/g, "-")
13 .replace(/^-|-$/g, "");
14}
15
16function encodePath(path: string | null | undefined): string {
17 if (!path) return "";

Callers 2

oldKeyComputationFunction · 0.70
newKeyComputationFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected