🐊Putout plugin adds ability to remove useless conditions
npm install @putout/plugin-remove-useless-conditions[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-conditions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-conditions "npm"
> The if statement executes a statement if a specified condition is truthy. If the condition is falsy, another statement can be executed.
>
> (c) MDN
🐊Putout plugin adds ability to remove useless conditions. Merged to @putout/plugin-conditions.
```
npm i @putout/plugin-remove-useless-conditions
`json`
{
"rules": {
"remove-useless-conditions/evaluate": "on",
"remove-useless-conditions/simplify": "on"
}
}
`js
const a = [];
const c = a;
if (a) {
console.log(a);
}
`
`js
const a = [];
const c = a;
console.log(a);
`
`js
if (zone?.tooltipCallback) {
zone.tooltipCallback(e);
}
if (a)
alert('hello');
else
alert('hello');
`
`js
zone?.tooltipCallback(e);
alert('hello');
``
MIT