UNPKG

@rxap/pipes

Version:

Provides a set of Angular pipes for common data transformations, including currency formatting, string manipulation, and object property access. These pipes offer standalone functionality for easy integration into Angular templates. The package includes p

100 lines (62 loc) 3.06 kB
[@rxap/pipes](../wiki/globals) / RxapCurrencyPipe # Class: RxapCurrencyPipe Defined in: [currency.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/pipes/src/lib/currency.pipe.ts#L12) ## Implements - `PipeTransform` ## Constructors ### new RxapCurrencyPipe() > **new RxapCurrencyPipe**(`currency`): [`RxapCurrencyPipe`](../wiki/Class.RxapCurrencyPipe) Defined in: [currency.pipe.ts:14](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/pipes/src/lib/currency.pipe.ts#L14) #### Parameters ##### currency `CurrencyPipe` #### Returns [`RxapCurrencyPipe`](../wiki/Class.RxapCurrencyPipe) ## Methods ### transform() > **transform**(`value`, `currencyCode`?, `display`?, `digitsInfo`?, `locale`?): `null` \| `string` Defined in: [currency.pipe.ts:50](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/pipes/src/lib/currency.pipe.ts#L50) #### Parameters ##### value `number` The number to be formatted as currency. ##### currencyCode? `string` The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be configured using the `DEFAULT_CURRENCY_CODE` injection token. ##### display? The format for the currency indicator. One of the following: - `code`: Show the code (such as `USD`). - `symbol`(default): Show the symbol (such as `$`). - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their currency. For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the locale has no narrow symbol, uses the standard symbol for the locale. - String: Use the given string value instead of a code or a symbol. For example, an empty string will suppress the currency & symbol. - Boolean (marked deprecated in v5): `true` for symbol and false for `code`. `string` | `boolean` ##### digitsInfo? `string` Decimal representation options, specified by a string in the following format:<br> <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>. - `minIntegerDigits`: The minimum number of integer digits before the decimal point. Default is `1`. - `minFractionDigits`: The minimum number of digits after the decimal point. Default is `2`. - `maxFractionDigits`: The maximum number of digits after the decimal point. Default is `2`. If not provided, the number will be formatted with the proper amount of digits, depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies. For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none. ##### locale? `string` A locale code for the locale format rules to use. When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. See [Setting your app locale](../wiki/guide/i18n#setting-up-the-locale-of-your-app). #### Returns `null` \| `string` #### Implementation of `PipeTransform.transform`