import { Pipe, PipeTransform } from '@angular/core';

/**
 * Convert sex id to sex name
 *
 * Usage:
 *   value | sexName
 * Example:
 *   {{ 'male' | sexName }}
 *   return Kluci
 */
@Pipe({ name: 'sexName' })
export class SexNamePipe implements PipeTransform {
    transform(value: string): string {
        let res: string = ';';
        if (value && value === 'male') {
            res = 'Kluci';
        } else if (value && value === 'female') {
            res = 'Holky';
        } else {
            res = value;
        }

        return res;
    }
}
