UNPKG

@empathyco/x-components

Version:
30 lines 1.43 kB
/** * Format a value with a given format. * * @param value - Numeric value to be formatted. * @param format - Format or mask to be defined as string. * * @remarks * Format: * - Use 'i' to define integer numbers. * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's. * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group. * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more * than one character. * - Set whatever you need around the integers and decimals marks. * - Default mask: 'i.iii,dd' which returns '1.345,67'. * - If you want to hide the decimal part if it's zero (non significant), you can add the `?` symbol * after the decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of * `1.234,00`). It defines the value of `hideIntegerDecimals`: * - If true (exists) and the value is an integer without decimals, the decimal non significant * zeroes are hidden. * - If false, the default behaviour will fill with zeros the remaining length until getting * the one defined with the 'd's. * * @returns Formatted number. * * @public */ export declare function currencyFormatter(value: number, format?: string): string; //# sourceMappingURL=currency-formatter.d.ts.map