5.0.2 β’ Published 3 years ago
@putout/plugin-convert-math-pow v5.0.2
@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 -DRule
{
"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