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.16.2 to 1.17.0

13

lib/tokenize/expressions/binary-expression.js

@@ -6,3 +6,10 @@ 'use strict';

const isLogical = (path) => path.isLogicalExpression();
const isLogical = (main, path) => {
const is = path.isLogicalExpression();
if (!is)
return false;
return main.node.operator !== path.node.operator;
};

@@ -12,4 +19,4 @@ function BinaryExpression(path, {write, traverse, maybe}) {

const right = path.get('right');
const isLeft = isLogical(left);
const isRight = isLogical(right);
const isLeft = isLogical(path, left);
const isRight = isLogical(path, right);

@@ -16,0 +23,0 @@ maybe.write(isLeft, '(');

@@ -35,3 +35,3 @@ 'use strict';

function unaryExpression(path, {print, maybe}) {
function unaryExpression(path, {maybe, traverse}) {
const {

@@ -42,13 +42,13 @@ prefix,

if (prefix)
print(operator);
const argPath = path.get('argument');
const round = argPath.isBinaryExpression();
maybe.print(isWord(
operator,
), ' ');
maybe.print(prefix, operator);
print('__argument');
maybe.print(isWord(operator), ' ');
if (!prefix)
print(operator);
maybe.print(round, '(');
traverse(argPath);
maybe.print(round, ')');
maybe.print(!prefix, operator);
}

@@ -18,3 +18,3 @@ 'use strict';

module.exports.isFirst = (path) => path.node === path.parentPath.node.body[0];
module.exports.isFirst = (path) => path.node === path.parentPath.node.body?.[0];
module.exports.isPrevBody = (path) => path.getPrevSibling().isBlockStatement();

@@ -21,0 +21,0 @@ module.exports.isNext = isNext;

@@ -62,3 +62,6 @@ 'use strict';

function shouldAddNewlineBefore(path) {
if (path.parentPath.isIfStatement())
return false;
return !isFirst(path) && !hasPrevNewline(path);
}
{
"name": "@putout/printer",
"version": "1.16.2",
"version": "1.17.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