Skip to content

Commit

Permalink
Add getWebsiteMember Function
Browse files Browse the repository at this point in the history
  • Loading branch information
timoclsn committed May 31, 2024
1 parent 1efbbdb commit 49f94f9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ export const getWebsiteMembers = async (): Promise<WebsiteMember[]> => {
return websiteMembers;
};

export const getWebsiteMember = async (name: string) => {
const members = await getWebsiteMembers();

const member = members.find((member) => {
const fullname = `${member.firstName} ${member.familyName}`;
return fullname === name;
});

if (!member) {
throw new Error(`Member ${name} not found`);
}

return member;
};

export const getMembersCount = async () => {
const result = await getActiveMembers();
return result.length;
Expand Down

0 comments on commit 49f94f9

Please sign in to comment.