1
0

Abolish common and misc directories

This commit is contained in:
Akihiko Odaki
2018-04-02 12:58:53 +09:00
parent a0f8b4e940
commit 5b9f3701f5
111 changed files with 133 additions and 133 deletions
+3
View File
@@ -0,0 +1,3 @@
export default user => {
return user.host === null ? user.username : `${user.username}@${user.host}`;
};
+18
View File
@@ -0,0 +1,18 @@
import { IUser, isLocalUser } from '../models/user';
import getAcct from './get-acct';
/**
* ユーザーを表す文字列を取得します。
* @param user ユーザー
*/
export default function(user: IUser): string {
let string = `${user.name} (@${getAcct(user)})\n` +
`${user.postsCount}投稿、${user.followingCount}フォロー、${user.followersCount}フォロワー\n`;
if (isLocalUser(user)) {
const account = user.account;
string += `場所: ${account.profile.location}、誕生日: ${account.profile.birthday}\n`;
}
return string + `${user.description}`;
}
+4
View File
@@ -0,0 +1,4 @@
export default acct => {
const splitted = acct.split('@', 2);
return { username: splitted[0], host: splitted[1] || null };
};