mirror of
https://github.com/misskey-dev/misskey
synced 2024-06-16 07:30:41 +02:00
16 lines
451 B
TypeScript
16 lines
451 B
TypeScript
import * as misskey from 'misskey-js';
|
|
import * as Acct from 'misskey-js/built/acct';
|
|
import { url } from '@/config';
|
|
|
|
export const acct = (user: misskey.Acct) => {
|
|
return Acct.toString(user);
|
|
};
|
|
|
|
export const userName = (user: misskey.entities.User) => {
|
|
return user.name || user.username;
|
|
};
|
|
|
|
export const userPage = (user: misskey.Acct, path?, absolute = false) => {
|
|
return `${absolute ? url : ''}/@${acct(user)}${(path ? `/${path}` : '')}`;
|
|
};
|