@putout/printer
Advanced tools
Comparing version 1.15.4 to 1.16.0
@@ -7,2 +7,3 @@ 'use strict'; | ||
} = require('./is'); | ||
const { | ||
@@ -13,3 +14,3 @@ markBefore, | ||
module.exports.parseLeadingComments = (path, {print, indent}) => { | ||
module.exports.parseLeadingComments = (path, {print, maybe}) => { | ||
const {leadingComments} = path.node; | ||
@@ -23,4 +24,6 @@ | ||
const isClass = !path.isClassMethod(); | ||
for (const {type, value} of leadingComments) { | ||
indent(); | ||
maybe.indent(isClass); | ||
@@ -37,5 +40,6 @@ if (type === 'CommentLine') { | ||
if (path.isStatement()) { | ||
if (path.isStatement() || path.isClassMethod()) { | ||
print.newline(); | ||
markBefore(path); | ||
maybe.indent(path.isClassMethod()); | ||
} | ||
@@ -42,0 +46,0 @@ |
@@ -6,5 +6,15 @@ 'use strict'; | ||
module.exports.AssignmentPattern = (path, {print, maybe}) => { | ||
maybe.print(isArg(path), '__left'); | ||
maybe.print(shouldPrint(path), '__left'); | ||
print(' = '); | ||
print('__right'); | ||
}; | ||
function shouldPrint(path) { | ||
if (isArg(path)) | ||
return true; | ||
if (path.parentPath.isArrayPattern()) | ||
return true; | ||
return false; | ||
} |
@@ -6,5 +6,9 @@ 'use strict'; | ||
const memberExpressions = require('./member-expressions'); | ||
const {ClassDeclaration} = require('./class-declaration'); | ||
const { | ||
ClassExpression, | ||
ClassDeclaration, | ||
} = require('./class'); | ||
const { | ||
CallExpression, | ||
@@ -48,2 +52,3 @@ OptionalCallExpression, | ||
CallExpression, | ||
ClassExpression, | ||
ClassDeclaration, | ||
@@ -50,0 +55,0 @@ ConditionalExpression, |
@@ -23,2 +23,3 @@ 'use strict'; | ||
const keyPath = property.get('key'); | ||
const isAssign = valuePath.isAssignmentPattern(); | ||
const {shorthand} = property.node; | ||
@@ -34,3 +35,3 @@ | ||
if (valuePath.isAssignmentPattern()) | ||
if (isAssign) | ||
print(valuePath); | ||
@@ -37,0 +38,0 @@ |
'use strict'; | ||
const {round} = Math; | ||
const fullstore = require('fullstore'); | ||
@@ -233,8 +232,6 @@ const isObject = (a) => a && typeof a === 'object'; | ||
}; | ||
const computePath = (path, maybeLine) => { | ||
if (isString(maybeLine) && maybeLine.startsWith(GET)) | ||
return get( | ||
path, | ||
maybeLine, | ||
); | ||
return get(path, maybeLine); | ||
@@ -246,2 +243,1 @@ if (isObject(maybeLine)) | ||
}; | ||
{ | ||
"name": "@putout/printer", | ||
"version": "1.15.4", | ||
"version": "1.16.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
60571
1718