$ cnpm install @putout/plugin-convert-math-pow
- 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
????Putout plugin adds ability to convert Math.pow to exponentiation operator.
npm i @putout/plugin-convert-math-pow -D
Rule convert-math-pow is enabled by default, to disable add to .putout.json:
{
"rules": {
"convert-math-pow": "off"
}
}
Math.pow(2, 4);
2 ** 4;
| Linter | Rule | Fix |
|---|---|---|
| ???? Putout | convert-math-pow |
✅ |
| ???? ESLint | prefer-exponentiation-operator |
✅ |
MIT
Copyright 2013 - present © cnpmjs.org | Home |