Skip to content

Commit

Permalink
Fix display name with empty last name
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenz Stechauner <lorenz.stechauner@necronda.net>
  • Loading branch information
NerLOR committed Feb 5, 2021
1 parent 89adcae commit a481bcf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,17 @@ export default class Contact {
case 'firstName':
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> John Stevenson
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).reverse().join(' ')

case 'lastName':
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> Stevenson, John
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).join(', ')
}
}
Expand All @@ -420,6 +426,9 @@ export default class Contact {
if (n && !isEmpty(n)) {
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> John Stevenson
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).reverse().join(' ')
}
// LAST chance, use the org ir that's the only thing we have
Expand Down

0 comments on commit a481bcf

Please sign in to comment.