Skip to content

Commit ea45b17

Browse files
author
Zvonimir Sabljic
committed
Fix so that we can process cases 'module.exports.func1 = func1' correctly
1 parent 8d40958 commit ea45b17

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/code.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,14 @@ function processAst(ast, cb) {
212212
const expression = path.node.expression;
213213
if (expression && expression.type === 'AssignmentExpression') {
214214
const left = expression.left;
215-
if (left.type === 'MemberExpression' &&
215+
if (left.object.type === 'MemberExpression' &&
216+
left.object.object.name === 'module' &&
217+
left.object.property.name === 'exports') {
218+
// When module.exports.funcName = func1
219+
if (expression.right.type === 'Identifier') {
220+
return cb(left.property.name, null, 'exportObj');
221+
}
222+
} else if (left.type === 'MemberExpression' &&
216223
left.object.name === 'module' &&
217224
left.property.name === 'exports') {
218225
// When module.exports is set to a single function

0 commit comments

Comments
 (0)