amount
v1.0.6
Published
Amount and currency formatter
Downloads
353
Readme
amount
Amount and currency formatter
node
npm i amount --save
yarn
yarn add amount
Usage
// amount(amount, decimals_separator, thousands_separator, decimal_digits)
amount(87686.987);
// '87686.987'
// setting decimals separator
amount(87686.987, ',');
// '87686,987'
// setting thousands separator
amount(87686.987, ',', '.');
// '87.686,987'
// setting number of decimals
amount(87686.987, ',', '.', 2);
// '87.686,98'
amount(87686.987, ',', '.', 1);
// '87.686,9'
amount(87686, ',', '.', 2);
// '87.686,00'
currency
amount.currency(87686.987, 'EUR');
// '87 686,98 €'
amount.currency(87686.987, 'USD');
// '$87,686.98'
amount.currency(87686.987, {
thousands_separator: ',',
decimals_separator: '.',
decimal_digits: 2,
symbol: '€',
symbol_on_left: false,
symbol_space: ' ',
});
// '87.686,98 €'