mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
16 lines
297 B
TypeScript
16 lines
297 B
TypeScript
|
export const buildName = (user?: {
|
||
|
first_name?: string
|
||
|
last_name?: string
|
||
|
email?: string
|
||
|
}) => {
|
||
|
const name = [user?.first_name, user?.last_name].filter(Boolean).join(' ')
|
||
|
|
||
|
if (name) {
|
||
|
return name
|
||
|
}
|
||
|
if (user?.email) {
|
||
|
return user.email.split('@')[0]
|
||
|
}
|
||
|
return 'Unknown'
|
||
|
}
|