New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@putout/printer

Package Overview
Dependencies
Maintainers
0
Versions
641
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 12.26.0 to 12.27.0

14

lib/tokenize/comment/parse-leading-comments.js

@@ -23,2 +23,3 @@ 'use strict';

isClassMethod,
isDecorator,
} = types;

@@ -46,9 +47,10 @@

const hasDecorators = (path) => {
const {parentPath} = path;
const hasDecoratorsWithComments = (path) => {
if (isDecorator(path))
return false;
if (path.node.decorators?.length)
if (path.node.decorators)
return true;
return parentPath.node.decorators?.length;
return path?.parentPath.node?.decorators;
};

@@ -102,3 +104,3 @@

if (hasDecorators(path))
if (hasDecoratorsWithComments(path))
return;

@@ -145,3 +147,3 @@

indent();
} else if (isBinaryExpression(path)) {
} else if (isBinaryExpression(path) || isDecorator(path)) {
indent.inc();

@@ -148,0 +150,0 @@ indent();

'use strict';
const {parseComments} = require('../../comment/comment');
const noop = () => {};

@@ -5,0 +6,0 @@ const parseParams = (path) => path.get('params');

'use strict';
const {printParams} = require('./params');
const {hasLeadingComment} = require('../../is');
const isDecoratorHasLeadingComment = (path) => {
const [firstParam] = path.get('params');
const decorators = firstParam.get('decorators');
if (!decorators.length)
return false;
const [firstDecorator] = decorators;
return hasLeadingComment(firstDecorator);
};
const hasDecorators = ({decorators}) => decorators?.length;

@@ -13,3 +26,3 @@

const printBeforeFirst = createPrint({
const printBeforeFirst = createPrint(path, {
type: 'inc',

@@ -20,3 +33,3 @@ printer,

const printAfterLast = createPrint({
const printAfterLast = createPrint(path, {
type: 'dec',

@@ -34,3 +47,3 @@ printer,

const createPrint = ({isNewline, printer, type}) => () => {
const createPrint = (path, {isNewline, printer, type}) => () => {
if (!isNewline)

@@ -40,4 +53,7 @@ return;

const {indent, print} = printer;
indent[type]();
if (!isDecoratorHasLeadingComment(path))
indent[type]();
print.breakline();
};
{
"name": "@putout/printer",
"version": "12.26.0",
"version": "12.27.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc