Skip to content

Commit

Permalink
refactor: Remove unnecessary check
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Nov 20, 2024
1 parent eb24633 commit dcdb6fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/converter/replacer/replaceModuleExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export function replaceModuleExports(sourceFile: SourceFile) {
const right = binaryExpression.getRight();

// Handle `module.exports = <expression>;`
if (left === 'module.exports' && right) {
if (left === 'module.exports') {
const {comment} = NodeUtil.extractComment(binaryExpression.getLeft());
defaultExport = right.getText();
sourceFile.addStatements(`${comment}export default ${defaultExport};`);
statement.remove();
} else if (left.startsWith('module.exports.') && right) {
} else if (left.startsWith('module.exports.')) {
// Handle `module.exports.<name> = <value>;`
const exportName = left.split('.')[2];
if (exportName) {
Expand Down

0 comments on commit dcdb6fb

Please sign in to comment.