(value: string)
| 322 | } |
| 323 | |
| 324 | function 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 | |
| 335 | function isControlCharacter(value: string): boolean { |
| 336 | if (value.length === 0) return false; |
no test coverage detected