3d8eda14a2
* chore(misskey-js): Unchanged files with check annotationsで紛らわしい部分の警告を抑制 ロジック面は後で直す * dummy change to see if the feature do not report them (to be reverted after the check) * refactor: 型合わせ * refactor: fix warnings fromc22dd6358b
* lint * 型合わせ * キャスト * pnpm build-misskey-js-with-types * Revert "dummy change to see if the feature do not report them (to be reverted after the check)" This reverts commit67072e3ca6
. * eliminate reversiGame any * move reversiGame types * lint * Update packages/misskey-js/src/streaming.ts Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> * Update acct.ts * run api extractor * re-run api extractor --------- Co-authored-by: Kisaragi Marine <kisaragi.effective@gmail.com> Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
16 lines
403 B
TypeScript
16 lines
403 B
TypeScript
export type Acct = {
|
|
username: string;
|
|
host: string | null;
|
|
};
|
|
|
|
export function parse(_acct: string): Acct {
|
|
let acct = _acct;
|
|
if (acct.startsWith('@')) acct = acct.substring(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}`;
|
|
}
|