$ cnpm install @putout/plugin-remove-useless-conditions
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
{
"rules": {
"remove-useless-conditions/evaluate": "on",
"remove-useless-conditions/simplify": "on"
}
}
const a = [];
const c = a;
if (a) {
console.log(a);
}
const a = [];
const c = a;
console.log(a);
if (zone?.tooltipCallback) {
zone.tooltipCallback(e);
}
if (a)
alert('hello');
else
alert('hello');
zone?.tooltipCallback(e);
alert('hello');
MIT
Copyright 2013 - present © cnpmjs.org | Home |