4.0.1 ā€¢ Published 2 years ago

@putout/plugin-remove-double-negations v4.0.1

Weekly downloads
2,812
License
MIT
Repository
github
Last release
2 years ago

@putout/plugin-remove-double-negations NPM version

To explicitly convert its return value (or any expression in general) to the corresponding boolean value can be used a double NOT operator (!!).

(c) MDN

šŸŠPutout plugin adds ability to remove double negations from conditionals. Merged to remove-unused-type-convertion

Install

npm i @putout/plugin-remove-double-negations

Rule

{
    "rules": {
        "remove-double-negations": "off"
    }
}

āŒ Example of incorrect code

if (!!a) {
    console.log('hi');
}

āœ… Example of correct code

if (a) {
    console.log('hi');
}

License

MIT