Compare commits

...

3 commits

Author SHA1 Message Date
0c4d42f3c1
style: remove function names from implicit util functions
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2025-07-16 11:27:35 +02:00
f2fcdbf733
Merge branch 'update-friend-landing-page' into sort-members-list 2025-07-16 11:26:16 +02:00
d5b7669291
fix: allow optional argument instead of defaulting to undefined
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
ci/woodpecker/pull_request_closed/build-and-publish Pipeline was successful
2025-07-16 11:25:36 +02:00
5 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
import type { GuildMemberResponse, UserResponse } from "~/types/interfaces";
export function getDisplayName(user: UserResponse, member: GuildMemberResponse | undefined = undefined): string {
export default (user: UserResponse, member?: GuildMemberResponse): string => {
if (member?.nickname) return member.nickname
if (user.display_name) return user.display_name
return user.username

View file

@ -1,4 +1,4 @@
export async function hashPassword(password: string) {
export default async (password: string) => {
const encodedPass = new TextEncoder().encode(password);
const hashBuffer = await crypto.subtle.digest("SHA-384", encodedPass);
const hashArray = Array.from(new Uint8Array(hashBuffer));

View file

@ -1,6 +1,6 @@
import type { GuildMemberResponse } from "~/types/interfaces";
export default function sortMembers(members: GuildMemberResponse[]): GuildMemberResponse[] {
export default (members: GuildMemberResponse[]): GuildMemberResponse[] => {
return members.sort((a, b) => {
return getDisplayName(a.user, a).localeCompare(getDisplayName(b.user, b))
})

View file

@ -1,6 +1,6 @@
import type { UserResponse } from "~/types/interfaces";
export default function sortUsers(users: UserResponse[]): UserResponse[] {
export default (users: UserResponse[]): UserResponse[] => {
return users.sort((a, b) => {
return getDisplayName(a).localeCompare(getDisplayName(b))
})

View file

@ -1,3 +1,3 @@
export function validateUsername(username: string) {
export default (username: string) => {
return /^[\w.-]+$/.test(username);
}