Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@putout/plugin-remove-double-negations

coderaiser25.8kMIT4.0.1

putout plugin adds ability to remove double negations

putout, putout-plugin, plugin, logical, negation

readme

@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