@putout/printer
Advanced tools
Comparing version 11.11.0 to 11.12.0
'use strict'; | ||
const {isLast, isNext} = require('../../is'); | ||
const {maybeParens} = require('../../maybe/maybe-parens'); | ||
@@ -6,0 +5,0 @@ |
'use strict'; | ||
const {types} = require('@putout/babel'); | ||
const {markAfter} = require('../../mark'); | ||
const {exists, isNext} = require('../../is'); | ||
const { | ||
isBlockStatement, | ||
isFunctionDeclaration, | ||
} = types; | ||
const isInside = ({parentPath}) => !parentPath.parentPath.isProgram(); | ||
@@ -19,2 +24,17 @@ const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement(); | ||
const isLastEmptyInsideBody = (path) => { | ||
const {parentPath} = path; | ||
if (!isBlockStatement(parentPath)) | ||
return false; | ||
if (!isBlockStatement(path.node.consequent)) | ||
return false; | ||
if (path.node.consequent.body.length) | ||
return false; | ||
return isFunctionDeclaration(path.parentPath.parentPath); | ||
}; | ||
module.exports.IfStatement = { | ||
@@ -83,2 +103,5 @@ print: (path, {indent, print, maybe, write, traverse}) => { | ||
print.newline(); | ||
if (isLastEmptyInsideBody(path)) | ||
print.newline(); | ||
}, | ||
@@ -85,0 +108,0 @@ afterSatisfy: () => [isNext], |
{ | ||
"name": "@putout/printer", | ||
"version": "11.11.0", | ||
"version": "11.12.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
244886
5350