@putout/plugin-merge-if-statements
Version:
πPutout plugin adds ability to merge if-statements
49 lines (35 loc) β’ 1.01 kB
Markdown
# @putout/plugin-merge-if-statements [![NPM version][NPMIMGURL]][NPMURL]
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-merge-if-statements.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-merge-if-statements "npm"
> The `if` statement executes a statement `if` a specified condition is truthy.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)
π[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to merge `if` statements. Merged to [`@putout/plugin-conditions`](https://www.npmjs.com/package/@putout/plugin-conditions).
## Install
```
npm i @putout/plugin-merge-if-statements
```
## Rule
```json
{
"rules": {
"merge-if-statements": "on"
}
}
```
## β Example of incorrect code
```js
if (a > b) {
if (b < c) {
console.log('hello');
}
}
```
## β
Example of correct code
```js
if (a > b && b < c) {
console.log('hello');
}
```
## License
MIT