hippofish/src/misc/acct.ts
tamaina ea8e6d88ab
enhance: shareページでより多くの情報を渡せるように (#7606)
* shareでより多くの情報を渡せるように

* from chat ui post-form, remove instant and add share

* fix await eating array, make document

* add changelog

* 3581bf9a06 (r692265037)

* reply, renoteにも型定義

* 🎨

* 閉じなければ100ms後タイムラインに
2021-10-20 03:10:36 +09:00

11 lines
373 B
TypeScript

import * as Misskey from 'misskey-js';
export const getAcct = (user: Misskey.Acct) => {
return user.host == null ? user.username : `${user.username}@${user.host}`;
};
export const parseAcct = (acct: string): Misskey.Acct => {
if (acct.startsWith('@')) acct = acct.substr(1);
const split = acct.split('@', 2);
return { username: split[0], host: split[1] || null };
};