@putout/printer
Advanced tools
Comparing version 8.16.0 to 8.17.0
@@ -70,2 +70,5 @@ 'use strict'; | ||
if (isTopParentLast(path)) | ||
return; | ||
print.newline(); | ||
@@ -76,2 +79,19 @@ maybe.markAfter(store(), path); | ||
function isTopParentLast({parentPath}) { | ||
if (!parentPath.isIfStatement()) | ||
return false; | ||
const nextParent = parentPath.parentPath; | ||
if (!nextParent.isIfStatement()) | ||
return false; | ||
const nextNext = nextParent.parentPath; | ||
if (!nextNext.isIfStatement()) | ||
return false; | ||
return isLast(nextNext); | ||
} | ||
function isNotLastBody(path) { | ||
@@ -78,0 +98,0 @@ return path.parentPath.get('body') === path; |
@@ -59,3 +59,8 @@ 'use strict'; | ||
} else if (alternate.isIfStatement()) { | ||
write(' else '); | ||
if (alternate.get('consequent').isBlockStatement()) | ||
write.space(); | ||
else | ||
indent(); | ||
write('else '); | ||
traverse(alternate); | ||
@@ -73,2 +78,5 @@ } else if (exists(alternate)) { | ||
if (!isNext(path) && !consequent.isBlockStatement()) | ||
return; | ||
if (path === partOfAlternate && isInside(path)) | ||
@@ -75,0 +83,0 @@ print.newline(); |
{ | ||
"name": "@putout/printer", | ||
"version": "8.16.0", | ||
"version": "8.17.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
211467
4701