
Product
Introducing Historical Analytics – Now in Beta
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
currency-formatting
Advanced tools
Package to help you format numbers as currency and visa versa
A small package that converts a number to currency format and visa versa.
Using cdn:
<script src="https://cdn.rawgit.com/tidupls/currency-format/master/dist/currency-format.min.js"></script>
Using npm:
$ npm install --save currency-formatting
Using bower:
$ bower install currency-formatting
// Returns a formatted string.
// The number is formatted based on symbol, precision, decimal, thousand & format provided.
currency.format(5) // R 5.00
currency.format(500.555, '$') // $ 500.56
currency.format(4999.99, '€', 2, '.', ',') // € 4.999,99
// Returns a number for the string provided.
currency.unformat('$ 500,00', ',') // 500
currency.unformat('£ 12,345,678.90 GBP', '.'); // 12345678.9
Has two public methods:
format(number, symbol, precision, thousand, decimal, format)
unformat(value, decimal)
and a global settings object with defaults of:
var settings = {
symbol: "$", // default currency symbol
format: "_s _v", // format of currency _s = symbol & _v = value
decimal: ".", // decimal point separator
thousand: ",", // thousand separator
precision: 2, // decimal places
}
$ npm run test
FAQs
Package to help you format numbers as currency and visa versa
The npm package currency-formatting receives a total of 6 weekly downloads. As such, currency-formatting popularity was classified as not popular.
We found that currency-formatting 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.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.