You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@putout/printer

Package Overview
Dependencies
Maintainers
1
Versions
779
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/printer - npm Package Compare versions

Comparing version
15.27.0
to
15.28.0
+22
lib/tokenize/expressions/object-pattern/comments.js
'use strict';
const createPrintCommentLine = (fn) => (value) => fn(`//${value}`);
const createPrintCommentBlock = (fn) => (value) => fn(`/*${value}*/`);
module.exports.printLeadingComments = (path, {print}) => {
const printCommentLine = createPrintCommentLine(print);
const printCommentBlock = createPrintCommentBlock(print);
const {leadingComments} = path.node;
if (!leadingComments)
return;
for (const {type, value} of leadingComments) {
if (type === 'CommentLine')
printCommentLine(value);
else
printCommentBlock(value);
print.breakline();
}
};
+18
-0
'use strict';
const {types} = require('@putout/babel');
const {wrongShorthand} = require('./wrong-shorthand');

@@ -23,2 +24,4 @@

const {printLeadingComments} = require('./comments');
const {

@@ -156,2 +159,5 @@ isObjectExpression,

printLeadingComments(property, {
print,
});
printKey(property, printer);

@@ -278,2 +284,11 @@

function hasPropertyLeadingComment(properties) {
for (const property of properties) {
if (property.node.leadingComments)
return true;
}
return false;
}
function shouldAddNewline(path, semantics) {

@@ -284,2 +299,5 @@ const {parentPath} = path;

if (hasPropertyLeadingComment(properties))
return true;
const {

@@ -286,0 +304,0 @@ maxPropertiesInOneLine,

+2
-2

@@ -91,5 +91,5 @@ 'use strict';

const last = index === n;
const penulty = index === n - 1;
const penalty = index === n - 1;
maybe.write.newline(penulty && defaults.length);
maybe.write.newline(penalty && defaults.length);
maybe.write.newline(last);

@@ -96,0 +96,0 @@ }

{
"name": "@putout/printer",
"version": "15.27.0",
"version": "15.28.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