Skip to content

Commit

Permalink
Fix FN repair step for ORG
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Feb 14, 2019
1 parent 9057462 commit bdd9383
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/services/checks/missingFN.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
// -> John Stevenson
const n = contact.vCard.getFirstPropertyValue('n')
const fullName = n.slice(0, 2).reverse().join(' ')
if (fullName.trim() !== '') {
if (fullName && fullName.trim() !== '') {
contact.fullName = fullName
return true
}
Expand All @@ -50,9 +50,11 @@ export default {
const org = contact.vCard.getFirstPropertyValue('org')
// ABC, Inc.;North American Division;Marketing
// -> ABC, Inc.
const fullName = org[0]
if (fullName.trim() !== '') {
contact.fullName = fullName
if (Array.isArray(org) && org[0].trim() !== '') {
contact.fullName = org[0]
return true
} else if (org && org.trim() !== '') {
contact.fullName = org
return true
}
return false
Expand Down

0 comments on commit bdd9383

Please sign in to comment.