(
value: number | string | null | undefined,
currencyCode: string = this._defaultCurrencyCode,
display: 'code' | 'symbol' | 'symbol-narrow' | string | boolean = 'symbol',
digitsInfo?: string,
locale?: string,
)
| 277 | locale?: string, |
| 278 | ): string | null; |
| 279 | transform( |
| 280 | value: number | string | null | undefined, |
| 281 | currencyCode: string = this._defaultCurrencyCode, |
| 282 | display: 'code' | 'symbol' | 'symbol-narrow' | string | boolean = 'symbol', |
| 283 | digitsInfo?: string, |
| 284 | locale?: string, |
| 285 | ): string | null { |
| 286 | if (!isValue(value)) return null; |
| 287 | |
| 288 | locale ||= this._locale; |
| 289 | |
| 290 | if (typeof display === 'boolean') { |
| 291 | if (typeof ngDevMode === 'undefined' || ngDevMode) { |
| 292 | console.warn( |
| 293 | `Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are "code", "symbol" or "symbol-narrow".`, |
| 294 | ); |
| 295 | } |
| 296 | display = display ? 'symbol' : 'code'; |
| 297 | } |
| 298 | |
| 299 | let currency: string = currencyCode || this._defaultCurrencyCode; |
| 300 | if (display !== 'code') { |
| 301 | if (display === 'symbol' || display === 'symbol-narrow') { |
| 302 | currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale); |
| 303 | } else { |
| 304 | currency = display; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | try { |
| 309 | const num = strToNumber(value); |
| 310 | return formatCurrency(num, locale, currency, currencyCode, digitsInfo); |
| 311 | } catch (error) { |
| 312 | throw invalidPipeArgumentError(CurrencyPipe, (error as Error).message); |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | function isValue(value: number | string | null | undefined): value is number | string { |
nothing calls this directly
no test coverage detected