mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-25 05:29:07 +01:00
15 lines
383 B
TypeScript
15 lines
383 B
TypeScript
export type Acct = {
|
|
username: string;
|
|
host: string | null;
|
|
};
|
|
|
|
export const getAcct = (user: Acct) => {
|
|
return user.host == null ? user.username : `${user.username}@${user.host}`;
|
|
};
|
|
|
|
export const parseAcct = (acct: string): Acct => {
|
|
if (acct.startsWith('@')) acct = acct.substr(1);
|
|
const split = acct.split('@', 2);
|
|
return { username: split[0], host: split[1] || null };
|
|
};
|