mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 12:08:02 -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
a028dac448
commit
8fada8809c
1 changed files with 3 additions and 7 deletions
|
@ -26,13 +26,9 @@ export class UsersService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toUserDto(user: User): UserInfoDto {
|
toUserDto(user: User | null | undefined): UserInfoDto | null {
|
||||||
if (user === undefined) {
|
if (!user) {
|
||||||
this.logger.warn('toUserDto recieved undefined argument!');
|
this.logger.warn(`toUserDto recieved ${user} argument!`);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (user === null) {
|
|
||||||
this.logger.warn('toUserDto recieved null argument!');
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue