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

Method transform

packages/common/src/pipes/number_pipe.ts:178–191  ·  view source on GitHub ↗

* * @param value The number to be formatted as a percentage. * @param digitsInfo Decimal representation options, specified by a string * in the following format: * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} . * - `minIntegerDigits`: The minimum number

(
    value: number | string | null | undefined,
    digitsInfo?: string,
    locale?: string,
  )

Source from the content-addressed store, hash-verified

176 * See [Setting your app locale](guide/i18n/locale-id).
177 */
178 transform(
179 value: number | string | null | undefined,
180 digitsInfo?: string,
181 locale?: string,
182 ): string | null {
183 if (!isValue(value)) return null;
184 locale ||= this._locale;
185 try {
186 const num = strToNumber(value);
187 return formatPercent(num, locale, digitsInfo);
188 } catch (error) {
189 throw invalidPipeArgumentError(PercentPipe, (error as Error).message);
190 }
191 }
192}
193
194/**

Callers

nothing calls this directly

Calls 4

formatPercentFunction · 0.90
invalidPipeArgumentErrorFunction · 0.90
isValueFunction · 0.85
strToNumberFunction · 0.85

Tested by

no test coverage detected