![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@putout/plugin-math
Advanced tools
🐊Putout plugin helps with Math
.
npm i @putout/plugin-math -D
{
"rules": {
"math/apply-exponentiation": "on",
"math/apply-multiplication": "on",
"math/apply-numeric-separators": "on",
"math/convert-sqrt-to-hypot": "on",
"math/declare": "on",
"math/remove-unchanged-zero-declarations": "on"
}
}
The
Math.hypot()
function returns the square root of the sum of squares of its arguments.(c) MDN
Convert Math.sqrt()
to Math.hypot()
. Check out in 🐊Putout Editor.
Math.sqrt(a ** 2, b ** 2);
Math.hypot(a, b);
- The
Math.pow()
static method, given two arguments, base and exponent, returns baseexponent.- The exponentiation operator (
**
) returns the result of raising the first operand to the power of the second operand. It is equivalent toMath.pow
, except it also accepts BigInts as operands.(c) MDN
Math.pow(2, 4);
2 ** 4;
Linter | Rule | Fix |
---|---|---|
🐊 Putout | convert-math-pow | ✅ |
⏣ ESLint | prefer-exponentiation-operator | ✅ |
Multiplying two numbers stored internally as integers (which is only possible with AsmJS with imul is the only potential circumstance where
Math.imul()
may prove performant in current browsers.(c) MDN
Check out in 🐊Putout Editor.
const a = Math.imul(b, c);
const a = b * c;
To improve readability for numeric literals, underscores (
_
) can be used as separators.(c) MDN
const t = 10000000;
const t = 10_000_000;
The
Math.round()
static method returns the value of a number rounded to the nearest integer.(c) MDN
round(bLength / aLength) > 3;
const {round} = Math;
round(bLength / aLength) > 3;
Checkout in 🐊Putout Editor.
for (let index = 0; index < n; index++) {
const tokenDelta = 0;
const templateDelta = 0;
for (let templateIndex = 0; templateIndex < templateTokensLength; templateIndex++) {
const currentTokenIndex = index + templateIndex - tokenDelta;
const currentToken = tokens[currentTokenIndex];
end = currentTokenIndex + tokenDelta;
}
}
for (let index = 0; index < n; index++) {
for (let templateIndex = 0; templateIndex < templateTokensLength; templateIndex++) {
const currentTokenIndex = index + templateIndex;
const currentToken = tokens[currentTokenIndex];
end = currentTokenIndex;
}
}
MIT
FAQs
🐊Putout plugin helps with Math
The npm package @putout/plugin-math receives a total of 3,112 weekly downloads. As such, @putout/plugin-math popularity was classified as popular.
We found that @putout/plugin-math demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.