@putout/printer
Advanced tools
Comparing version 6.11.2 to 6.11.3
@@ -24,2 +24,4 @@ 'use strict'; | ||
isIdentifierAndIdentifier, | ||
satisfy, | ||
} = require('../../is'); | ||
@@ -51,2 +53,17 @@ | ||
const isOneLine = satisfy([ | ||
isOneSimple, | ||
isOneSpread, | ||
isIdentifierAndIdentifier, | ||
isBooleanAndSimple, | ||
isNullAndSimple, | ||
isSimpleAndCall, | ||
isTwoStringsDifferentLength, | ||
isStringAndArray, | ||
isStringAndMember, | ||
isStringAndIdentifier, | ||
isIdentifierAndString, | ||
isSimpleAndObject, | ||
]); | ||
module.exports.isMultiLine = (path, {elements, maxElementsInOneLine}) => { | ||
@@ -56,11 +73,5 @@ if (elements.length > 3 && !isObjectExpression(elements[0])) | ||
if (isOneSimple(path)) | ||
if (isOneLine(elements)) | ||
return ONE_LINE; | ||
if (isOneSpread(elements)) | ||
return ONE_LINE; | ||
if (elements.length === 2 && isIdentifierAndIdentifier(elements)) | ||
return ONE_LINE; | ||
if (isCallInsideArrow(path)) | ||
@@ -75,35 +86,8 @@ return ONE_LINE; | ||
if (isBooleanAndSimple(elements)) | ||
return ONE_LINE; | ||
if (isNullAndSimple(elements)) | ||
return ONE_LINE; | ||
if (isSimpleAndCall(elements)) | ||
return ONE_LINE; | ||
if (isShortTwoSimplesInsideCall(path, maxElementsInOneLine)) | ||
return ONE_LINE; | ||
if (isTwoStringsDifferentLength(elements)) | ||
return ONE_LINE; | ||
if (isTwoSimplesInsideObjectProperty(path)) | ||
return ONE_LINE; | ||
if (isStringAndArray(elements)) | ||
return ONE_LINE; | ||
if (isStringAndMember(elements)) | ||
return ONE_LINE; | ||
if (isStringAndIdentifier(elements)) | ||
return ONE_LINE; | ||
if (isIdentifierAndString(elements)) | ||
return ONE_LINE; | ||
if (isSimpleAndObject(elements)) | ||
return ONE_LINE; | ||
if (isStringAndString(elements) && isParentIsArrayWithFirstArrayElement(path)) | ||
@@ -166,5 +150,3 @@ return ONE_LINE; | ||
function isOneSimple(path) { | ||
const elements = path.get('elements'); | ||
function isOneSimple(elements) { | ||
if (elements.length !== 1) | ||
@@ -171,0 +153,0 @@ return false; |
@@ -63,3 +63,10 @@ 'use strict'; | ||
module.exports.isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b); | ||
module.exports.isIdentifierAndIdentifier = (elements) => { | ||
if (elements.length !== 2) | ||
return false; | ||
const [a, b] = elements; | ||
return isIdentifier(a) && isIdentifier(b); | ||
}; | ||
module.exports.isStringAndMember = ([a, b]) => isStringLiteral(a) && isMemberExpression(b); | ||
@@ -66,0 +73,0 @@ module.exports.isIdentifierAndString = ([a, b]) => isIdentifier(a) && isStringLiteral(b); |
{ | ||
"name": "@putout/printer", | ||
"version": "6.11.2", | ||
"version": "6.11.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
199929
4522