MCPcopy Index your code
hub / github.com/angular/angular / transform

Method transform

packages/common/src/pipes/i18n_select_pipe.ts:41–57  ·  view source on GitHub ↗

* @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})

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 1

invalidPipeArgumentErrorFunction · 0.90

Tested by

no test coverage detected