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
1
Versions
646
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.3.0 to 1.3.1

4

lib/tokenize/expressions/call-expression.js
'use strict';
const {hasPrevNewline} = require('../mark');
const {hasPrevNewline, isMarkedParent} = require('../mark');

@@ -10,3 +10,3 @@ const {entries} = Object;

if (shouldAddNewLine(path) && !hasPrevNewline(path.parentPath)) {
if (shouldAddNewLine(path) && !hasPrevNewline(path.parentPath) && !isMarkedParent(path)) {
write.newline();

@@ -13,0 +13,0 @@ write.indent();

@@ -14,4 +14,4 @@ 'use strict';

module.exports.ObjectExpression = (path, {traverse, write, maybeWrite, maybeIndent, incIndent, decIndent}) => {
incIndent();
module.exports.ObjectExpression = (path, {traverse, write, maybe, indent}) => {
indent.inc();

@@ -21,12 +21,20 @@ const properties = path.get('properties');

const isCall = path.parentPath.isCallExpression();
const isOneLine = isCall && properties.length < 2 || isForOf(path);
const {length} = properties;
const isOneLine = !length || (isCall && length < 2 || isForOf(path));
maybeWrite(parens, '(');
maybe.write(parens, '(');
write('{');
maybeWrite(!isOneLine, '\n');
maybe.write(!isOneLine, '\n');
for (const property of properties) {
if (property.isSpreadElement()) {
maybe.indent(properties.length > 1);
traverse(property);
if (properties.length > 1) {
write(',');
write.newline();
}
continue;

@@ -37,3 +45,3 @@ }

maybeIndent(!isOneLine);
maybe.indent(!isOneLine);

@@ -45,5 +53,5 @@ if (property.isObjectMethod()) {

maybeWrite(computed, '[');
maybe.write(computed, '[');
traverse(property.get('key'));
maybeWrite(computed, ']');
maybe.write(computed, ']');

@@ -55,9 +63,9 @@ if (!shorthand) {

maybeWrite(!isOneLine, ',\n');
maybe.write(!isOneLine, ',\n');
}
decIndent();
maybeIndent(!isOneLine);
indent.dec();
maybe.indent(!isOneLine);
write('}');
maybeWrite(parens, ')');
maybe.write(parens, ')');
};

@@ -5,2 +5,1 @@ 'use strict';

module.exports.isNext = (path) => path.getNextSibling().node;

@@ -22,1 +22,5 @@ 'use strict';

module.exports.maybeMark = (a, path) => a && mark(path);
module.exports.isMarkedParent = (path) => {
return isMarked(path.parentPath);
};
'use strict';
const {mark} = require('../mark');
module.exports.ExpressionStatement = (path, {write, indent, traverse}) => {
if (isCoupleLinesExpression(path) && !isFirst(path) && shouldAddNewLine(path)) {
write.linebreak();
mark(path);
}

@@ -7,0 +9,0 @@

'use strict';
const {isMarked} = require('../mark');
const isPrevNewLine = (path) => {

@@ -9,3 +10,3 @@ const prev = path.getPrevSibling();

return prev.__putout_newline;
return isMarked(prev);
};

@@ -40,7 +41,2 @@

}
if (path.getNextSibling().node) {
//write.newline();
//path.__putout_newline = true;
}
};
{
"name": "@putout/printer",
"version": "1.3.0",
"version": "1.3.1",
"type": "commonjs",

@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

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