@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
Math.pow
to exponentiation operator. Merged to @putout/plugin-math.
Install
npm i @putout/plugin-convert-math-pow -D
Rule
{
"rules": {
"convert-math-pow": "on"
}
}
❌ Example of incorrect code
Math.pow(2, 4);
✅ Example of correct code
2 ** 4;
Comparison
Linter | Rule | Fix |
---|---|---|
convert-math-pow |
||
⏣ ESLint | prefer-exponentiation-operator |
License
MIT