Last active
July 12, 2018 03:00
-
-
Save ktravers/1d1d706c5626c41c9675e49b37705eee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const displayName = (user) => { | |
if (user.firstName.length > 0) { | |
if (user.lastName.length > 0) { | |
return `${user.firstName} ${user.lastName}`.trim(); | |
} else { | |
return `${user.firstName}`.trim(); | |
} | |
} else if (user.username.length > 0) { | |
return user.username; | |
} else { | |
return 'New User'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment