
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
accounting-js
Advanced tools
accounting-js is a tiny JavaScript library for number, money and currency parsing/formatting. It's lightweight, fully localizable, has no dependencies, and works great client-side or server-side. Use standalone or as a nodeJS/npm and AMD/requireJS module.
npm install accounting-js
import { formatNumber } from 'accounting-js';
// Default usage
formatNumber(5318008);
// ⇨ 5,318,008
// Custom format
formatNumber(9876543.21, { precision: 3, thousand: " " });
// ⇨ 9 876 543.210
import { formatMoney } from 'accounting-js';
// Default usage
formatMoney(12345678);
// ⇨ $12,345,678.00
// European formatting (custom symbol and separators)
formatMoney(4999.99, { symbol: "€", precision: 2, thousand: ".", decimal: "," });
// ⇨ €4.999,99
import { unformat } from 'accounting-js';
unformat('£ 12,345,678.90 GBP');
// ⇨ 12345678.9
// Native toFixed has rounding issues
(0.615).toFixed(2);
// ⇨ '0.61'
// With accounting-js
toFixed(0.615, 2);
// ⇨ '0.62'
Copyright (c) 2016-present Stanislav Lesnikov, MIT License
Copyright (c) 2014 Open Exchange Rates, MIT License
2.0.3
tsup
, vitest
)is-string
and objectAssign
packagesformatColumn
format
and parse
aliasesformatMoney()
, formatNumber()
and unformat()
not accept Array
as first argument. If you wish format/unformat arrays you should use formatMoneyArray()
, formatNumberArray()
and unformatArray()
FAQs
Number, money and currency formatting library.
The npm package accounting-js receives a total of 56,296 weekly downloads. As such, accounting-js popularity was classified as popular.
We found that accounting-js demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.