Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
currency-formatter
Advanced tools
A simple Javascript utility that helps you to display currency properly
A simple Javascript utility that helps you to display currency properly
npm install currency-formatter --save
var currencyFormatter = require('currency-formatter');
currencyFormatter.format(1000000, { code: 'USD' });
// => '$1,000,000.00'
currencyFormatter.format(1000000, { code: 'GBP' });
// => '£1,000,000.00'
currencyFormatter.format(1000000, { code: 'EUR' });
// => '1 000 000,00 €'
You can also get the currency information.
var currencyFormatter = require('currency-formatter');
currencyFormatter.findCurrency('USD');
// returns:
// {
// code: 'USD',
// symbol: '$',
// thousandsSeparator: ',',
// decimalSeparator: '.',
// symbolOnLeft: true,
// spaceBetweenAmountAndSymbol: false,
// decimalDigits: 2
// }
Currency Formatter uses accounting library under the hood, and you can use its options to override the default behavior.
var currencyFormatter = require('currency-formatter');
currencyFormatter.format(1000000, {
symbol: '@',
decimal: '*',
thousand: '^',
precision: 1,
format: '%v %s' // %s is the symbol and %v is the value
});
// => '1^000^000*0 @'
You could also get a list of all the currencies here using one of the following:
var currencies = require('currency-formatter/currencies');
// OR
var currencyFormatter = require('currency-formatter');
var currencies = currencyFormatter.currencies;
FAQs
A simple Javascript utility that helps you to display currency properly
The npm package currency-formatter receives a total of 40,818 weekly downloads. As such, currency-formatter popularity was classified as popular.
We found that currency-formatter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.