import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'formatCityStatePipe', standalone: true, }) export class FormatCityStatePipe implements PipeTransform { transform(city: string, state: string): string { if (!city && !state) { return 'Invalid city, Invalid state'; } if (!city) { return `Invalid city, ${state}`; } if (!state) { return `${city}, Invalid state`; } return `${city}, ${state}`; } }