mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 17:56:30 -05:00
UsersService: Merge if-statements and add null
to return type in toUserDto
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
5bd1259949
commit
ab4ecf6a8f
1 changed files with 3 additions and 7 deletions
|
@ -26,13 +26,9 @@ export class UsersService {
|
|||
}
|
||||
}
|
||||
|
||||
toUserDto(user: User): UserInfoDto {
|
||||
if (user === undefined) {
|
||||
this.logger.warn('toUserDto recieved undefined argument!');
|
||||
return null;
|
||||
}
|
||||
if (user === null) {
|
||||
this.logger.warn('toUserDto recieved null argument!');
|
||||
toUserDto(user: User | null | undefined): UserInfoDto | null {
|
||||
if (!user) {
|
||||
this.logger.warn(`toUserDto recieved ${user} argument!`);
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue