@putout/plugin-convert-sqrt-to-hypot

1.0.2 • Public • Published

@putout/plugin-convert-sqrt-to-hypot NPM version

The Math.hypot() function returns the square root of the sum of squares of its arguments.

(c) MDN

🐊Putout plugin adds ability to convert Math.sqrt() to Math.hypot(). Check out in 🐊Putout Editor. Merged to @putout/plugin-math.

Install

npm i @putout/plugin-sqrt-to-hypot -D

Rule

Rule convert-sqrt-to-hypot is enabled by default, to disable add to .putout.json:

{
    "rules": {
        "convert-sqrt-to-hypot": "off"
    }
}

Example of incorrect code

Math.sqrt(a ** 2, b ** 2);

Example of correct code

Math.hypot(a, b);

License

MIT

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @putout/plugin-convert-sqrt-to-hypot

    Weekly Downloads

    712

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    4.12 kB

    Total Files

    4

    Last publish

    Collaborators

    • coderaiser