Skip to content

Commit

Permalink
more readable bracket selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Janther authored and Klaus Hott Vidal committed Nov 29, 2023
1 parent 8af7f79 commit 186476f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/nodes/TupleExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ const contents = (node, path, print, options) => {
: printSeparatedList(path.map(print, 'components'));
};

const brackets = {
true: '[]',
false: '()'
};

export const TupleExpression = {
print: ({ node, path, print, options }) => {
const bracket = brackets[node.isArray.toString()];
const [openingBracket, closingBracket] = node.isArray ? '[]' : '()';

return group([
bracket[0],
openingBracket,
contents(node, path, print, options),
bracket[1]
closingBracket
]);
}
};

0 comments on commit 186476f

Please sign in to comment.