summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts
blob: 70432f9be5d4be66caecb81f1678797b7393c36e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'booleanText'
})
export class BooleanTextPipe implements PipeTransform {
  transform(
    value: any,
    truthyText: string = $localize`Yes`,
    falsyText: string = $localize`No`
  ): string {
    return Boolean(value) ? truthyText : falsyText;
  }
}