1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00
Files
browser/libs/angular/src/pipes/user-name.pipe.ts
Oscar Hinton ac49e594c1 Add standalone false to all non migrated (#14797)
Adds standalone: false to all components since Angular is changing the default to true and we'd rather not have the angular PR change 300+ files.
2025-05-15 10:44:07 -04:00

27 lines
565 B
TypeScript

// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Pipe, PipeTransform } from "@angular/core";
export interface User {
name?: string;
email?: string;
}
@Pipe({
name: "userName",
standalone: false,
})
export class UserNamePipe implements PipeTransform {
transform(user?: User): string {
if (user == null) {
return null;
}
if (user.name == null && user.email == null) {
return null;
}
return user.name == null || user.name.trim() === "" ? user.email : user.name;
}
}