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
623
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.54.2 to 1.54.3

lib/tokenize/expressions/functions/function-declaration.js

15

lib/tokenize/expressions/array-expression.js

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

function isCallInsideArrow(path) {
const {parentPath} = path;
if (!parentPath.isCallExpression())
return false;
if (!parentPath.parentPath.isFunction())
return false;
return path.node.elements.length < 4;
}
function isNewlineBetweenElements(path, {elements}) {
if (isCallInsideArrow(path))
return false;
if (isTwoElementReturn(path, {elements}))

@@ -180,0 +195,0 @@ return false;

29

lib/tokenize/expressions/functions/functions.js
'use strict';
const {hasPrevNewline} = require('../../mark');
const isFirst = (path) => !path.getPrevSibling().node;
const {ArrowFunctionExpression} = require('./arrow-function-expression');
const {FunctionDeclaration} = require('./function-declaration');
module.exports.ArrowFunctionExpression = ArrowFunctionExpression;
module.exports.FunctionDeclaration = FunctionDeclaration;

@@ -67,27 +67,2 @@ module.exports.FunctionExpression = (path, {print, maybe, write, traverse}) => {

module.exports.FunctionDeclaration = (path, {print, maybe}) => {
const {async} = path.node;
if (!isFirst(path) && !hasPrevNewline(path) && !path.parentPath.isExportDeclaration())
print('\n');
maybe.print(async, 'async ');
print('function ');
print('__id');
print('(');
const params = path.get('params');
const n = params.length - 1;
for (let i = 0; i <= n; i++) {
print(params[i]);
if (i < n)
print(', ');
}
print(') ');
print('__body');
};
module.exports.ClassMethod = (path, {print, maybe}) => {

@@ -94,0 +69,0 @@ const {kind} = path.node;

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

for (const condition of conditions)
if (condition(path))
return true;
return false;
return false;
};
'use strict';
const {isNewlineBetweenStatements} = require('../is');
const {isMarkedAfter} = require('../mark');
module.exports.ExportDefaultDeclaration = {
/*
beforeIf(path) {
return path.getPrevSibling().isTSTypeAliasDeclaration();
const prev = path.getPrevSibling();
if (isMarkedAfter(prev))
return false;
return isNewlineBetweenStatements(prev);
},
before(path, {print}) {
print.breakline();
print.newline();
},
*/print(path, {print, traverse, maybe}) {
print(path, {print, traverse, maybe}) {
const declaration = path.get('declaration');

@@ -13,0 +20,0 @@ print('export default ');

'use strict';
const {isLast} = require('../is');
const {markAfter} = require('../mark');
const isNextType = (a) => a.getNextSibling().isTSTypeAliasDeclaration();

@@ -34,3 +35,4 @@

print.newline();
markAfter(path);
},
};
{
"name": "@putout/printer",
"version": "1.54.2",
"version": "1.54.3",
"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