@putout/plugin-convert-bitwise-to-logical

1.0.1 • Public • Published

@putout/plugin-convert-bitwise-to-logical NPM version

The bitwise OR operator (|) returns a 1 in each bit position for which the corresponding bits of either or both operands are 1s.

The operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).

(c) MDN

🐊Putout plugin adds ability to convert bitwise to logical operator, when one of operands is not a number, since mostly likely it is an error. Merged to @putout/plugin-logical-expressions.

Install

npm i @putout/plugin-convert-bitwise-to-logical -D

Rule

{
    "rules": {
        "convert-bitwise-to-logical": "on"
    }
}

Example of incorrect code

a | !b;

Example of correct code

a || !b;

License

MIT

Package Sidebar

Install

npm i @putout/plugin-convert-bitwise-to-logical

Weekly Downloads

1,645

Version

1.0.1

License

MIT

Unpacked Size

3.88 kB

Total Files

4

Last publish

Collaborators

  • coderaiser