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:
David Mehren 2020-09-26 16:00:17 +02:00
parent 5bd1259949
commit ab4ecf6a8f
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -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 {