Skip to content

Commit

Permalink
refactor: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsop-d committed Nov 12, 2024
1 parent 3912d76 commit 3d1accc
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions package/plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,17 @@ module.exports = function babelPlugin(babel, options) {
toRemove.push(index);
}
});
if (
toRemove.length > 1 &&
toRemove.length === path.node.specifiers.length
) {
path.remove();
} else if (toRemove.length > 0) {
removeItemsByIndexesInPlace(toRemove, path.node.specifiers);

if (toRemove.length) {
if (toRemove.length === path.node.specifiers.length) {
// The whole line is up for removal
path.remove();
} else {
// Only some specifiers are up for removal
removeItemsByIndexesInPlace(toRemove, path.node.specifiers);
}
}
});
// } catch (e) {
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ');
// console.log('=============================== failed to process ', e);
// }
},
},
};
Expand Down

0 comments on commit 3d1accc

Please sign in to comment.