@putout/printer
Advanced tools
Comparing version 12.19.1 to 12.20.0
@@ -131,2 +131,4 @@ 'use strict'; | ||
module.exports.isInsideIf = (path) => path.parentPath?.isIfStatement(); | ||
module.exports.isNewlineBetweenSiblings = (path) => { | ||
@@ -133,0 +135,0 @@ const endCurrent = path.node?.loc?.end?.line; |
'use strict'; | ||
const {isNext} = require('../is'); | ||
const {isNext, isInsideIf} = require('../is'); | ||
const isInsideBlock = (path) => path.parentPath.isBlockStatement(); | ||
const isInsideIf = (path) => path.parentPath.isIfStatement(); | ||
@@ -7,0 +6,0 @@ module.exports.DebuggerStatement = { |
@@ -6,3 +6,7 @@ 'use strict'; | ||
const {markAfter} = require('../../mark'); | ||
const {exists, isNext} = require('../../is'); | ||
const { | ||
exists, | ||
isNext, | ||
isInsideIf, | ||
} = require('../../is'); | ||
@@ -24,3 +28,2 @@ const { | ||
const isInsideIf = (path) => path.parentPath.parentPath?.isIfStatement(); | ||
const isEmptyBody = (path) => !path.node.body.length; | ||
@@ -45,3 +48,4 @@ | ||
print: (path, {indent, print, maybe, write, traverse}) => { | ||
const partOfAlternate = path.parentPath.get('alternate'); | ||
const {parentPath} = path; | ||
const partOfAlternate = parentPath.get('alternate'); | ||
@@ -66,3 +70,3 @@ if (path !== partOfAlternate) | ||
if (isInsideIf(path) || isInsideNestedBody(path)) | ||
if (isInsideIf(path.parentPath) || isInsideNestedBody(path)) | ||
maybe.print.newline(isEmptyBody(consequent)); | ||
@@ -69,0 +73,0 @@ } else { |
@@ -20,3 +20,3 @@ 'use strict'; | ||
const {ExportDefaultDeclaration} = require('./export-declaration/export-default-declaration'); | ||
const {BreakStatement} = require('./break-statement'); | ||
const {BreakStatement} = require('./break-statement/break-statement'); | ||
const {DoWhileStatement} = require('./do-while-statement'); | ||
@@ -23,0 +23,0 @@ const {Program} = require('./program/program'); |
{ | ||
"name": "@putout/printer", | ||
"version": "12.19.1", | ||
"version": "12.20.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
253885
5519