@putout/plugin-convert-math-pow

5.0.2 • Public • Published

@putout/plugin-convert-math-pow NPM version

  • 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 to Math.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

Package Sidebar

Install

npm i @putout/plugin-convert-math-pow

Weekly Downloads

15,097

Version

5.0.2

License

MIT

Unpacked Size

4.2 kB

Total Files

4

Last publish

Collaborators

  • coderaiser