/** * Pre-defined format specifiers for use with format(). */ export declare enum NumberDisplayFormat { /** * A localized representation of a number with a decimal separator and group * separators (e.g. "12,345.67", "-42" for en-US locale). */ NUMBER = "n", /** * A localized representation of a number with a decimal separator (e.g. * "12345.67", "-42" for en-US locale). */ FIXED_POINT = "f", /** * A localized representation of a monetary amount in a specific currency * (e.g. "$123.45" for USD, "£123.45" for GBP for en-US locale). */ CURRENCY = "c", /** * Same as CURRENCY, except that in many locales, negative values may be displayed in * parentheses instead of using a "-" sign. */ ACCOUNTING = "a", /** * A localized representation of a percentage (e.g. 0.99 -\> "99%" in the * en-US locale). */ PERCENT = "p", /** * An invariant representation of a number (e.g. "12345.67"). Guarantees * that the number can be parsed back into the same number, regardless of * locale. */ ROUND_TRIP = "r", /** * A custom format string. */ CUSTOM = "custom" } /** * Options supported by {@link format}. */ export interface FormatOptions { /** * See NumberFormat.currency. */ currency?: string; /** * The custom number format. Required for a format type of 'Custom' */ customDisplayFormat?: string; /** * The number format. See {@link NumberFormatter.format}. */ format?: NumberDisplayFormat; /** * See NumberFormat.precision. */ fractionalDigits?: number; /** * The locale to use when formatting the number. */ locale: string; } export declare const DEFAULT_CURRENCY = "USD"; export declare const DEFAULT_CUSTOM_FORMAT = "#.##"; export declare const DEFAULT_FRACTIONAL_DIGITS = 4; export declare const SUPPORTED_CURRENCIES: string[]; /** * Formats a number for display. * * @param options Specifies the format settings to use. * @param num The number to format. */ export declare function format(options: FormatOptions, num: number): string;