@putout/printer
Advanced tools
Comparing version 6.11.1 to 6.11.2
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200238
124
4525