currency-formatter
Advanced tools
Comparing version 1.4.5 to 1.5.0
{ | ||
"name": "currency-formatter", | ||
"version": "1.4.5", | ||
"version": "1.5.0", | ||
"description": "A simple Javascript utility that helps you to display currency properly", | ||
@@ -25,10 +25,10 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "^3.3.0", | ||
"mocha": "^2.3.3" | ||
"chai": "^4.1.2", | ||
"mocha": "^5.2.0" | ||
}, | ||
"dependencies": { | ||
"accounting": "^0.4.1", | ||
"locale-currency": "0.0.1", | ||
"locale-currency": "0.0.2", | ||
"object-assign": "^4.1.1" | ||
} | ||
} |
@@ -7,2 +7,39 @@ # Currency Formatter | ||
STOP! You probably don't need this library | ||
= | ||
#### TL;DR: This library was created a long time ago. You should use [Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) instead. | ||
Please don't add another dependency which you don't need. All modern browsers (and node.js) have this functionality built-in and do a much better job at formatting currencies. e.g. [#57](https://github.com/smirzaei/currency-formatter/issues/57) | ||
* Browser support: https://caniuse.com/#search=intl | ||
* Polyfill: https://github.com/andyearnshaw/Intl.js | ||
* ECMA402 reference: https://tc39.github.io/ecma402/ | ||
Example: | ||
```JS | ||
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(100000000) | ||
// => "$100,000,000.00" | ||
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' }).format(100000000) | ||
// => "€100,000,000.00" | ||
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'USD' }).format(100000000) | ||
// => "100.000.000,00 $" | ||
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(100000000) | ||
// => "100.000.000,00 €" | ||
new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR' }).format(100000000) | ||
// => "100 000 000,00 €" | ||
``` | ||
With that being said use this library if you need: | ||
* Support old browsers. | ||
* Consistent formatting across all browsers. | ||
* You don't like the Intl APIs | ||
* ??? | ||
Install | ||
@@ -9,0 +46,0 @@ = |
Sorry, the diff of this file is not supported yet
56211
197
+ Addedlocale-currency@0.0.2(transitive)
- Removedlocale-currency@0.0.1(transitive)
Updatedlocale-currency@0.0.2