(subreddit: string)
| 10 | * @throws Error if the subreddit name contains invalid characters |
| 11 | */ |
| 12 | export function normalizeSubreddit(subreddit: string): string { |
| 13 | const normalized = subreddit.trim().replace(SUBREDDIT_PREFIX, '') |
| 14 | const validation = validatePathSegment(normalized, { paramName: 'subreddit' }) |
| 15 | if (!validation.isValid) { |
| 16 | throw new Error(validation.error) |
| 17 | } |
| 18 | return normalized |
| 19 | } |
no test coverage detected