Skip to content

Commit e18f600

Browse files
committed
feature: @putout/printer: ArrayExpression: isCommaAfterElement
1 parent e1f4bcd commit e18f600

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ export const ArrayExpression = {
5959
multiline,
6060
});
6161

62-
const needsComma = isCommaAfterElement(path, {
63-
trailingComma,
64-
isLast,
65-
needsIndentBeforeElement,
66-
});
67-
6862
if (isNewlineBeforeElement(element))
6963
print.newline();
7064

@@ -73,8 +67,11 @@ export const ArrayExpression = {
7367

7468
print(element);
7569

76-
if (needsComma)
77-
print(',');
70+
maybe.print(isCommaAfterElement(path, {
71+
trailingComma,
72+
isLast,
73+
needsIndentBeforeElement,
74+
}), ',');
7875

7976
if (isNewlineAfterComma(element, {multiline})) {
8077
print.newline();

0 commit comments

Comments
 (0)