@putout/printer
Advanced tools
Comparing version 10.2.0 to 10.3.0
@@ -8,14 +8,31 @@ 'use strict'; | ||
indent.inc(); | ||
maybe.write.newline(elementTypes.length); | ||
for (const elementType of elementTypes) { | ||
indent(); | ||
const isSame = isSameType(elementTypes); | ||
maybe.write.newline(isSame && elementTypes.length); | ||
const n = elementTypes.length - 1; | ||
for (const [i, elementType] of elementTypes.entries()) { | ||
maybe.indent(isSame); | ||
traverse(elementType); | ||
write(','); | ||
write.newline(); | ||
maybe.write(i < n || isSame, ','); | ||
maybe.write.newline(isSame); | ||
maybe.write.space(i < n && !isSame); | ||
} | ||
indent.dec(); | ||
indent(); | ||
maybe.indent(isSame && elementTypes.length); | ||
write(']'); | ||
}; | ||
function isSameType(array) { | ||
let type; | ||
for (const current of array) { | ||
if (type && current.type !== type) | ||
return false; | ||
({type} = current); | ||
} | ||
return true; | ||
} |
{ | ||
"name": "@putout/printer", | ||
"version": "10.2.0", | ||
"version": "10.3.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
234704
5151