Skip to content

Commit

Permalink
refactor(referencesImport): simplify member expression computed branches
Browse files Browse the repository at this point in the history
Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
jeysal and nicolo-ribaudo committed Jan 15, 2021
1 parent 095c07e commit f22c8b5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/babel-traverse/src/path/introspection.js
Expand Up @@ -160,10 +160,9 @@ export function referencesImport(moduleSource, importName) {
if (!this.isReferencedIdentifier()) {
if (
(this.isMemberExpression() || this.isOptionalMemberExpression()) &&
((!this.node.computed && this.node.property.name === importName) ||
(this.node.computed &&
t.isStringLiteral(this.node.property) &&
this.node.property.value === importName))
(this.node.computed
? t.isStringLiteral(this.node.property, { value: importName })
: this.node.property.name === importName)
) {
return this.get("object").referencesImport(moduleSource, "*");
}
Expand Down

0 comments on commit f22c8b5

Please sign in to comment.