Skip to content
Snippets Groups Projects
anschrift-to-string.pipe.ts 527 B
Newer Older
  • Learn to ignore specific revisions
  • import { EMPTY_STRING } from '@alfa-client/tech-shared';
    import { Anschrift } from '@alfa-client/zustaendige-stelle-shared';
    import { Pipe, PipeTransform } from '@angular/core';
    import { isNil } from 'lodash-es';
    
    @Pipe({
      standalone: true,
      name: 'anschriftToString',
    })
    export class AnschriftToStringPipe implements PipeTransform {
      transform(anschrift: Anschrift): string {
        if (isNil(anschrift)) return EMPTY_STRING;
        return `${anschrift.strasse} ${anschrift.hausnummer}, ${anschrift.plz} ${anschrift.ort}`;
      }
    }