Skip to content

Commit

Permalink
removed extra condition
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmadFaraz-crypto committed May 6, 2024
1 parent 5c8990b commit d59cff7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ function fn() {
inlineTest('jsx with dynamic Component tag #2',
`
function fn() {
const Components = ["div", "a"]
const components = ["div", "a"]
return React.createElement(
Components[0],
components[0],
null,
"Hello",
);
Expand Down
7 changes: 1 addition & 6 deletions packages/unminify/src/transformations/un-jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function toJSX(j: JSCodeshift, path: ASTPath<CallExpression>, pragmas: string[],
},
}).forEach((path: any) => {
const { id: { loc: { identifierName } } } = path.node
if (tag.name === identifierName) {
if (tag.name.toLowerCase() === identifierName.toLowerCase()) {
tag = { ...tag, name: path.node?.init?.value }
}
})
Expand Down Expand Up @@ -188,11 +188,6 @@ function toJSX(j: JSCodeshift, path: ASTPath<CallExpression>, pragmas: string[],
}
})
}
else {
if (variableDeclaration.declarations[0].init?.alternate?.value) {
tag = { ...tag, name: variableDeclaration.declarations[0].init.alternate.value }
}
}
// insertBefore(j, path, variableDeclaration)
scope.markAsStale()
}
Expand Down

0 comments on commit d59cff7

Please sign in to comment.