
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@cdjs/js-math
Advanced tools
A lightweight Javascript math library.
npm install @cdjs/js-math
// or
yarn add @cdjs/js-math
// es6 module
import jsMath, { multiply, add, subtract, devide, round } from '@cdjs/js-math'
// commonjs
const { multiply, add, subtract, devide, round, default: jsMath } = require('@cdjs/js-math')
| Method | Desc | Args |
|---|---|---|
| multiply | 乘 | ...Array |
| add | 加 | ...Array |
| subtract | 减 | ...Array |
| devide | 除 | ...Array |
| round | 四舍五入 | ratio: Number 精度 number?: Number 需要处理的数字 |
| value | 获取最终值 | / |
| setPrecision | 设置浮点数最大保留精度,默认 12 位 | number: Number |
| enableCheck | 是否开启对运算结果是否超出 js 安全数值的提醒,默认 false | check: Boolean |
#####Simple use
// 乘
multiply(3, 2) // 6
add(0,1, 0.2) // 0.3
// 四舍五入
round(0.345, 2) // 0.35
#####Chained use
jsMath
.multiply(0.2, 10, 100)
.add(1, 2, 3, 5, 10, 1000)
.subtract(0.1, 0.3, 0.4)
.devide(2, 5, 5, 20)
.round(2)
.value() // 1.22
FAQs
A simple math calculation library for JavaScript and Node.js
We found that @cdjs/js-math 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.