Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@putout/printer

Package Overview
Dependencies
Maintainers
1
Versions
600
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 1.15.4 to 1.16.0

lib/tokenize/expressions/class.js

10

lib/tokenize/comments.js

@@ -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

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