Skip to content

Commit

Permalink
using string templates instead of concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
Janther committed Dec 22, 2023
1 parent a61335e commit d3c436b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/nodes/ContractDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const body = (node, path, options, print) => {
export const ContractDefinition = {
print: ({ node, options, path, print }) => [
group([
node.kind + (node.kind === 'abstract' ? ' contract ' : ' ') + node.name,
`${node.kind}${node.kind === 'abstract' ? ' contract ' : ' '}${
node.name
}`,
inheritance(node, path, print),
'{'
]),
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/StringLiteral.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const StringLiteral = {
(part, index) =>
// node.isUnicode is an array of the same length as node.parts
// that indicates if that string fragment has the unicode prefix
(node.isUnicode[index] ? 'unicode' : '') + printString(part, options)
`${node.isUnicode[index] ? 'unicode' : ''}${printString(part, options)}`
);

return join(hardline, list);
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/UnaryOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const UnaryOperation = {
print: ({ node, path, print }) =>
node.isPrefix
? [
node.operator + (node.operator === 'delete' ? ' ' : ''),
`${node.operator}${node.operator === 'delete' ? ' ' : ''}`,
path.call(print, 'subExpression')
]
: [path.call(print, 'subExpression'), node.operator]
Expand Down

0 comments on commit d3c436b

Please sign in to comment.