mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
16 lines
386 B
TypeScript
16 lines
386 B
TypeScript
export const initialsFromName = (name: string) =>
|
|
!!name
|
|
? name
|
|
.split(' ')
|
|
.slice(0, 2)
|
|
.map((x) => x[0])
|
|
.join('')
|
|
.toUpperCase()
|
|
: '';
|
|
|
|
export const avatarHash = (
|
|
id: string,
|
|
hash: string,
|
|
bucket: 'icons' | 'avatars' = 'icons',
|
|
size: number = 256
|
|
) => `https://cdn.discordapp.com/${bucket}/${id}/${hash}.webp?size=${size}`;
|