@putout/printer
Advanced tools
Comparing version 1.40.1 to 1.40.2
@@ -48,3 +48,3 @@ 'use strict'; | ||
module.exports.parseTrailingComments = (path, {print}) => { | ||
module.exports.parseTrailingComments = (path, {write, maybe}) => { | ||
const {trailingComments} = path.node; | ||
@@ -58,6 +58,9 @@ | ||
for (const {type, value} of trailingComments) { | ||
for (const {type, value, loc} of trailingComments) { | ||
if (type === 'CommentLine') { | ||
print.space(); | ||
print(`//${value}`); | ||
const sameLine = isSameLine(path, loc); | ||
maybe.write.space(sameLine); | ||
maybe.indent(!sameLine); | ||
write(`//${value}`); | ||
maybe.write.newline(!sameLine); | ||
@@ -72,1 +75,5 @@ continue; | ||
} | ||
function isSameLine(path, loc) { | ||
return path.node.loc.start.line === loc.start.line; | ||
} |
{ | ||
"name": "@putout/printer", | ||
"version": "1.40.1", | ||
"version": "1.40.2", | ||
"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
78631
2162