Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
format-money-js
Advanced tools
Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.
Zero dependency tiny JavaScript library (841 bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value. Size of library: 841 bytes in zip and 1.2 kByte in min formats.
from: money and currency formatting;
un: removes all formatting/cruft and returns the raw float value.
const { FormatMoney } = require('format-money-js');
const fm = new FormatMoney({
decimals: 2
});
console.log(fm.from(12345.67, { symbol: '$' })); // return string: $12,345.67
console.log(fm.un('€12,345;67')); // return number: 12345.67
const { FormatMoney } = require('format-money-js');
const fm = new FormatMoney({
decimals: 2
});
console.log(fm.from(
12345.67,
{ symbol: '$' },
true // Parse, return object
)
);
/* return object:
{
source: 12345.67,
negative: false,
fullAmount: '12,345.67',
amount: '12,345',
decimals: '.67',
symbol: '$'
}*/
You can added options in construct of class and in method. But method will be primary.
const fm = new FormatMoney({ symbol: '$' });
console.log(fm.from(12345.67, { symbol: '€' })); // €12,345.67
console.log(fm.un('€12.345,67', { decimalPoint: ',' })); // 12345.67
Name | Default | Type | Example |
---|---|---|---|
grouping | true | Boolean | 1,000 (true) vs 1000 (false) |
separator | , | String | 1,000 |
decimalPoint | . | String | 1,234.56 |
decimals | 0 | Number | 1,234 (0 - without decimals) |
symbol | None | String | $1,234.56 (if append false) |
append | false | String | 1,234.56$ (if append true) |
leadZeros | true | Boolean | true - 1.10, false - 1.1 (leading zeros) |
FAQs
Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.
The npm package format-money-js receives a total of 2,130 weekly downloads. As such, format-money-js popularity was classified as popular.
We found that format-money-js 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.