number.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Represent a number as an integer, percent or currency value
  3. *
  4. * Available in MessageFormat strings as `{VAR, number, integer|percent|currency}`.
  5. * Internally, calls Intl.NumberFormat with appropriate parameters. `currency` will
  6. * default to USD; to change, set `MessageFormat#currency` to the appropriate
  7. * three-letter currency code, or use the `currency:EUR` form of the argument.
  8. *
  9. * @example
  10. * ```js
  11. * var mf = new MessageFormat('en', { currency: 'EUR'});
  12. *
  13. * mf.compile('{N} is almost {N, number, integer}')({ N: 3.14 })
  14. * // '3.14 is almost 3'
  15. *
  16. * mf.compile('{P, number, percent} complete')({ P: 0.99 })
  17. * // '99% complete'
  18. *
  19. * mf.compile('The total is {V, number, currency}.')({ V: 5.5 })
  20. * // 'The total is €5.50.'
  21. *
  22. * mf.compile('The total is {V, number, currency:GBP}.')({ V: 5.5 })
  23. * // 'The total is £5.50.'
  24. * ```
  25. */
  26. export declare function numberFmt(value: number, lc: string | string[], arg: string, defaultCurrency: string): string;
  27. export declare const numberCurrency: (value: number, lc: string | string[], arg: string) => string;
  28. export declare const numberInteger: (value: number, lc: string | string[]) => string;
  29. export declare const numberPercent: (value: number, lc: string | string[]) => string;