zerobyte/app/lib/username.ts
Nico dda7b9939f
Some checks failed
Release Workflow / determine-release-type (push) Has been cancelled
Release Workflow / checks (push) Has been cancelled
Release Workflow / e2e-tests (push) Has been cancelled
Release Workflow / build-images (push) Has been cancelled
Release Workflow / publish-release (push) Has been cancelled
refactor: allow more characters in usernames (#529)
2026-02-16 21:37:15 +01:00

5 lines
269 B
TypeScript

const USERNAME_ALLOWED_CHARACTERS_REGEX = /^[a-z0-9_.-]+$/i;
export const normalizeUsername = (username: string): string => username.trim().toLowerCase();
export const isValidUsername = (username: string): boolean => USERNAME_ALLOWED_CHARACTERS_REGEX.test(username);