@putout/plugin-conditions 9.0.1 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,8 +167,9 @@ function notBlockNoNext() {
167
167
  if (a) {
168
168
  x();
169
169
  return;
170
- } else
171
- b();
170
+ }
171
+
172
+ b();
172
173
  }
173
174
  ```
174
175
 
@@ -17,6 +17,7 @@ export const replace = () => ({
17
17
  'if (__a) __b; else __c': ({__b}, path) => {
18
18
  if (isBlockStatement(__b)) {
19
19
  __b.body.push(returnStatement());
20
+
20
21
  return path;
21
22
  }
22
23
 
@@ -46,5 +47,18 @@ function check(vars, path) {
46
47
  return false;
47
48
  }
48
49
 
49
- return true;
50
+ return !hasReturn(path);
51
+ }
52
+
53
+ function hasReturn(path) {
54
+ let has = false;
55
+
56
+ path.traverse({
57
+ ReturnStatement(path) {
58
+ has = true;
59
+ path.stop();
60
+ },
61
+ });
62
+
63
+ return has;
50
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-conditions",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds support of conditions transformations",