Skip to content

Commit

Permalink
fix: reduce approach
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck committed Nov 18, 2024
1 parent 82766f6 commit 75f20e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/src/services/listing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,11 @@ export class ListingService implements OnModuleInit {
const emailFromAddress = getEmailFromAddress
? rawJuris?.emailFromAddress
: null;
const userEmails: string[] = [];
rawUsers?.forEach((user) => user?.email && userEmails.push(user.email));

const userEmails: string[] = rawUsers?.reduce((userEmails, user) => {
if (user?.email) userEmails.push(user.email);
return userEmails;
}, []);
return { emails: userEmails, publicUrl, emailFromAddress };
}

Expand Down

0 comments on commit 75f20e2

Please sign in to comment.