bigbuffet-rw/app/soapbox/utils/input.ts
2022-09-16 10:42:05 -05:00

13 lines
No EOL
271 B
TypeScript

/** Trim the username and strip the leading @. */
const normalizeUsername = (username: string): string => {
const trimmed = username.trim();
if (trimmed[0] === '@') {
return trimmed.slice(1);
} else {
return trimmed;
}
};
export {
normalizeUsername,
};