Socket
Socket
Sign inDemoInstall

currency-formatter

Package Overview
Dependencies
3
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.5 to 1.5.0

8

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc