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
596
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 8.27.0 to 8.28.0

4

lib/printer.d.ts

@@ -27,4 +27,4 @@ import {types} from '@putout/babel';

declare namespace MaybeIndent {
type inc = () => void;
type dec = () => void;
type inc = (condition: boolean) => void;
type dec = (condition: boolean) => void;

@@ -31,0 +31,0 @@ export {

@@ -34,12 +34,22 @@ 'use strict';

const isInsideCall = ({parentPath}) => parentPath.isCallExpression();
function isInsideNestedArrayCall({parentPath}) {
if (!parentPath.isArrayExpression())
return false;
if (!parentPath.parentPath.isArrayExpression())
return false;
return isInsideCall(parentPath.parentPath);
}
module.exports.ObjectExpression = (path, printer, semantics) => {
const {trailingComma} = semantics;
const {
print,
maybe,
indent,
} = printer;
const {print, maybe} = printer;
indent.inc();
const insideNestedArrayCall = isInsideNestedArrayCall(path);
maybe.indent.inc(!insideNestedArrayCall);
const properties = path.get('properties');

@@ -78,10 +88,7 @@ const {length} = properties;

maybe.indent(manyLines && noLeadingComment(property));
print(property);
if (property.isObjectMethod()) {
print(property);
if (property.isObjectMethod())
continue;
}
print(property);
if (noTrailingComment(property) && !hasNextLeadingComment(property)) {

@@ -93,6 +100,5 @@ maybe.print.newline(manyLines);

indent.dec();
maybe.indent.dec(!insideNestedArrayCall);
maybe.indent(manyLines && !insideNestedArrayCall);
maybe.indent(manyLines);
print('}');

@@ -135,3 +141,3 @@ maybe.print(parens, ')');

if (!length)
return true;
return ONE_LINE;

@@ -138,0 +144,0 @@ if (notLastArgInsideCall(path))

@@ -12,4 +12,9 @@ 'use strict';

const isNextType = (a) => a.getNextSibling().isTSTypeAliasDeclaration();
const isNextExport = (a) => a.getNextSibling().isExportDeclaration();
module.exports.TSTypeAliasDeclaration = {
beforeIf: (path) => !path.parentPath.isExportDeclaration(),
before: (path, {indent}) => {
indent();
},
print: maybeDeclare((path, {print, maybe, store}) => {

@@ -44,3 +49,4 @@ const typeAnnotation = path.get('typeAnnotation');

},
after(path, {print}) {
after(path, {print, maybe}) {
maybe.indent(isNextExport(path));
print.newline();

@@ -50,1 +56,2 @@ markAfter(path);

};
{
"name": "@putout/printer",
"version": "8.27.0",
"version": "8.28.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