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
604
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 6.11.1 to 6.11.2

lib/tokenize/expressions/array-expression/indent.js

30

lib/tokenize/expressions/array-expression/array-expression.js

@@ -8,3 +8,2 @@ 'use strict';

isStringAndArray,
isIndented,
} = require('../../is');

@@ -19,28 +18,15 @@

const {types} = require('@putout/babel');
const {
isObjectExpression,
isStringLiteral,
} = types;
isInsideArray,
isArrayInsideArray,
isArrayIndented,
} = require('./indent');
const {isObjectExpression} = types;
const isNextObject = (a) => a.getNextSibling().isObjectExpression();
const isArrayInsideArray = (path) => {
if (!path.isArrayExpression() || !path.parentPath.isArrayExpression())
return false;
return path.parentPath.node.elements.length <= 3;
};
const isInsideOneElementArray = ({parentPath}) => parentPath.node.elements.length === 1;
const isInsideArray = (path) => path.parentPath.isArrayExpression();
const isTwoLongStrings = ([a, b]) => {
const LONG_STRING = 20;
if (!isStringLiteral(a) || !isStringLiteral(b))
return false;
return a.node.value.length > LONG_STRING;
};
module.exports.ArrayExpression = {

@@ -76,3 +62,3 @@ beforeIf(path) {

const indented = !isArrayInsideArray(path) && (!isTwoLongStrings(elements) || !isInsideArray(path) && isIndented(elements[0]));
const indented = isArrayIndented(path);

@@ -79,0 +65,0 @@ if (indented)

{
"name": "@putout/printer",
"version": "6.11.1",
"version": "6.11.2",
"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