Skip to content

Commit

Permalink
Remove unnecessary conditional statement
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamWr committed Oct 14, 2022
1 parent 930dd6a commit 0053d0c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/scriptlets/xml-prune.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ export function xmlPrune(source, propsToRemove, optionalProp = '', urlToMatch) {
return text;
}
const elems = xmlDoc.querySelectorAll(propsToRemove);
if (elems.length !== 0) {
elems.forEach((elem) => {
elem.remove();
});
const serializer = new XMLSerializer();
text = serializer.serializeToString(xmlDoc);
}
elems.forEach((elem) => {
elem.remove();
});
const serializer = new XMLSerializer();
text = serializer.serializeToString(xmlDoc);
return text;
};

Expand Down

0 comments on commit 0053d0c

Please sign in to comment.