@putout/plugin-convert-math-pow
v5.0.2
Published
šPutout plugin adds ability to convert 'Math.pow()' to 'exponentiation operator'
Downloads
30,456
Maintainers
Readme
@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. 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
--------|-------|------------|
š Putout | convert-math-pow
| ā
ā£ ESLint | prefer-exponentiation-operator
| ā
License
MIT