* @param value a string to be internationalized. * @param mapping an object that indicates the text that should be displayed * for different values of the provided `value`.
(value: string | null | undefined, mapping: {[key: string]: string})
| 39 | * for different values of the provided `value`. |
| 40 | */ |
| 41 | transform(value: string | null | undefined, mapping: {[key: string]: string}): string { |
| 42 | if (value == null) return ''; |
| 43 | |
| 44 | if (typeof mapping !== 'object' || typeof value !== 'string') { |
| 45 | throw invalidPipeArgumentError(I18nSelectPipe, mapping); |
| 46 | } |
| 47 | |
| 48 | if (Object.hasOwn(mapping, value)) { |
| 49 | return mapping[value]; |
| 50 | } |
| 51 | |
| 52 | if (Object.hasOwn(mapping, 'other')) { |
| 53 | return mapping['other']; |
| 54 | } |
| 55 | |
| 56 | return ''; |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected