Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to display contacts sorted alphabetically #154

Open
techwizardg opened this issue Feb 6, 2017 · 1 comment
Open

how to display contacts sorted alphabetically #154

techwizardg opened this issue Feb 6, 2017 · 1 comment

Comments

@techwizardg
Copy link

Not sure where to post and this is not a bug. In phone book we can have contacts stored with out name and inside the contact details we can have mobile number and email id. If the contact is stored with out name and has only email id we need to display the email id as name and if the contact is stored with multiple email ids and no name then the first email id to be displayed and if the contact is stored with mobile number and no name then the mobile number needs to be displayed. How to perform the same using this library?

@belkevich
Copy link
Contributor

let name = contact.name?.compositeName ?? contact.emails?.first?.address ?? contact.phones?.first?.number ?? "Can't display name for this contact"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants