From 186476f7255efe47dcaafeadd3a8e84deefb792a Mon Sep 17 00:00:00 2001 From: Klaus Hott Date: Wed, 22 Nov 2023 01:05:44 +1300 Subject: [PATCH] more readable bracket selection --- src/nodes/TupleExpression.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/nodes/TupleExpression.js b/src/nodes/TupleExpression.js index 664a370f1..984912168 100644 --- a/src/nodes/TupleExpression.js +++ b/src/nodes/TupleExpression.js @@ -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 ]); } };