blob: 16876c4429df9051221d7fd7629af403960126a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
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 };
};
|