chore: integrate misskey-js as a workspace item (git subtree) (#10409)

* Additional changes for the merge

* api-misskey-js
This commit is contained in:
Kagami Sascha Rosylight 2023-03-30 02:33:19 +02:00 committed by GitHub
parent a529b0e5a3
commit cee1d5e2d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 7008 additions and 97 deletions

View file

@ -0,0 +1,14 @@
export type Acct = {
username: string;
host: string | null;
};
export function parse(acct: string): Acct {
if (acct.startsWith('@')) acct = acct.substr(1);
const split = acct.split('@', 2);
return { username: split[0], host: split[1] || null };
}
export function toString(acct: Acct): string {
return acct.host == null ? acct.username : `${acct.username}@${acct.host}`;
}