Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getTag = (t, path) => {
const namePath = path.get('name')
if (t.isJSXIdentifier(namePath)) {
const name = namePath.get('name').node
if (path.scope.hasBinding(name) && !htmlTags.includes(name) && !svgTags.includes(name)) {
return t.identifier(name)
} else {
return t.stringLiteral(name)
}
}
/* istanbul ignore else */
if (t.isJSXMemberExpression(namePath)) {
return transformJSXMemberExpression(t, namePath)
}
/* istanbul ignore next */
throw new Error(`getTag: ${namePath.type} is not supported`)
}
const isComponent = (t, path) => {
const name = path.get('name')
if (t.isJSXMemberExpression(name)) {
return true
}
const tag = name.get('name').node
return !htmlTags.includes(tag) && !svgTags.includes(tag)
}