mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-08 21:54:57 -05:00
* improvement(code-quality): centralize regex checks, normalization * simplify resolution * fix(copilot): don't allow duplicate name blocks * centralize uuid check
11 lines
378 B
TypeScript
11 lines
378 B
TypeScript
const SUBREDDIT_PREFIX = /^r\//
|
|
|
|
/**
|
|
* Normalizes a subreddit name by removing the 'r/' prefix if present and trimming whitespace.
|
|
* @param subreddit - The subreddit name to normalize
|
|
* @returns The normalized subreddit name without the 'r/' prefix
|
|
*/
|
|
export function normalizeSubreddit(subreddit: string): string {
|
|
return subreddit.trim().replace(SUBREDDIT_PREFIX, '')
|
|
}
|