From 125687ddeb6624e27a9d6b962a7de7aa5863133a Mon Sep 17 00:00:00 2001 From: 59naga Date: Tue, 3 Jul 2018 06:04:43 +0900 Subject: [PATCH] pref: code refactor refs #58 (thx @loganfsmyth) --- src/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 9739332..7c3ec09 100644 --- a/src/index.js +++ b/src/index.js @@ -7,13 +7,7 @@ module.exports = ({template, types}) => { let pluginOptions const ExportsDefaultVisitor = { AssignmentExpression (path) { - // Not `object.anything`, skip - if (!path.get('left.object').node) { - return - } - - const name = `${path.get('left.object.name').node}.${path.get(`left.property.name`).node}` - if (name === 'exports.default') { + if (path.get('left').matchesPattern('exports.default')) { const finder = new ExportsFinder(path) if (!finder.isOnlyExportsDefault()) { return