
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
simplecount
Advanced tools
解决 javascript 计算中因 IEEE 754 标准引起的,浮点数精度以及计算不准确的问题
且兼容超大数计算
import {add,sub,mul,divi,simpleToFixed} from 'simplecount';
const a = 0.1
const b = 0.2
const c = 1.335
const addResult = add(a,b) //->'0.3'
const subResult = sub(a,b) //->'-0.1'
const mulResult = mul(a,b) //->'0.02'
const diviResult = divi(a,b) //->'0.50'
const simpleToFixedResult = simpleToFiexed(c) //->'1.34'
const d = Number.MAX_SAFE_INTEGER //->9007199254740991
const e = 11
const f = 3
const bigAddResult = add(d,e) //->'9007199254741002'
const bigSubResult = sub(bigAddResult,f) //->'9007199254740999'
const bigMulResult = mul(bigAddResult,f) //->'27021597764223006'
const bigDiviResult = divi(bigAddResult,f) //->'3002399751580334.00'
const bigstfResult = simpleToFiexed(bigAddResult) //->'9007199254741002.00'
yarn add simplecount
或者
npm install simplecount
<script type="text/javascript" src="simplecount.js"></script>
add(a,b) 返回结果字符串,加法,a+b
sub(a,b) 返回结果字符串,减法,a-b
mul(a,b) 返回结果字符串,乘法,a*b
divi(a,b,c) 返回结果字符串,除法,a/b,保留 c 位小数,c 可不传,默认为 2
simpleToFixed(a,c) 返回结果字符串,四舍五入重构toFixed,对 a 进行定点表示法格式化,c 表示小数点后数字的个数,c可不传,默认为 2
import {add,sub,mul,divi,simpleToFixed} from 'simplecount';
const {add,sub,mul,divi,simpleToFixed} = require('simplecount');
var add = window.simplecount.add;
var sub = window.simplecount.sub;
var mul = window.simplecount.mul;
var divi = window.simplecount.divi;
var simpleToFixed = window.simplecount.simpleToFixed;
运行:
yarn test
yarn test:add
yarn test:sub
yarn test:mul
yarn test:divi
a small and simple tools for js count accuracy problems
FAQs
a small tool for js count
We found that simplecount 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.