Skip to content

Commit

Permalink
chore: fixed .find on undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Jul 30, 2024
1 parent 3a00452 commit d6159f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/credential-branding/src/details/CredentialDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function findCorrelationIdName(correlationId: string, parties: Party[], activeUs
parties.push(activeUser)
}
return (
allParties.find((contact: Party) => contact.identities.some((identity: Identity): boolean => identity.identifier.correlationId === correlationId))
allParties?.find((contact: Party) => contact.identities.some((identity: Identity): boolean => identity.identifier.correlationId === correlationId))
?.contact.displayName ?? correlationId
)
}
Expand Down Expand Up @@ -119,7 +119,7 @@ export const toNonPersistedCredentialSummary = (
}

export const getDate = (...dates: (number | string | undefined)[]): number | undefined => {
const date = dates.find(date => date !== null && date !== undefined)
const date = dates?.find(date => date !== null && date !== undefined)
if (!date) {
return
} else if (typeof date === 'number') {
Expand Down

0 comments on commit d6159f8

Please sign in to comment.