mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-15 17:30:56 -05: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'
|
||
|
}
|