Skip to content

Commit

Permalink
Replace destructuring syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Jun 17, 2023
1 parent 11912e4 commit 2511415
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,10 @@ export function buildJsx(tree, options) {
const attribute = attributes[index]

if (attribute.type === 'JSXSpreadAttribute') {
const {argument} = attribute
if (argument.type === 'ObjectExpression') {
fields.push(...argument.properties)
if (attribute.argument.type === 'ObjectExpression') {
fields.push(...attribute.argument.properties)
} else {
fields.push({type: 'SpreadElement', argument})
fields.push({type: 'SpreadElement', argument: attribute.argument})
}

spread = true
Expand Down

0 comments on commit 2511415

Please sign in to comment.