// defaults to English number formatting and USD currency constformat = formatters.create(); format.toNumber(-12345.67890); // '-12,345.679' format.toCurrency(-12345.67890); // '-$12,345.68'
example
// specify US region of English constformat = formatters.create({ locale:'en-US' }); format.toNumber(-12345.67890); // '-12,345.679' format.toCurrency(-12345.67890); // '-$12,345.68'
example
// British English number formatting and Pound Sterling currency constformat = formatters.create({ locale:'en-GB', numberOptions: { notation:'scientific', maximumFractionDigits:5, }, currencyOptions: { currency:'GBP', currencySign:'accounting', }, }); format.toNumber(-12345.67890); // '-1.23457E4' format.toCurrency(-12345.67890); // '(£12,345.68)'
Creates a new Formatter instance with the given options.
example
// defaults to English number formatting and USD currency constformat = formatters.create(); format.toNumber(-12345.67890); // '-12,345.679' format.toCurrency(-12345.67890); // '-$12,345.68'
example
// specify US region of English constformat = formatters.create({ locale:'en-US' }); format.toNumber(-12345.67890); // '-12,345.679' format.toCurrency(-12345.67890); // '-$12,345.68'
example
// British English number formatting and Pound Sterling currency constformat = formatters.create({ locale:'en-GB', numberOptions: { notation:'scientific', maximumFractionDigits:5, }, currencyOptions: { currency:'GBP', currencySign:'accounting', }, }); format.toNumber(-12345.67890); // '-1.23457E4' format.toCurrency(-12345.67890); // '(£12,345.68)'
Provides functionality to control text output.