Skip to content

Commit

Permalink
Rename checkIfXML functin to isXML
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamWr committed Oct 7, 2022
1 parent c197e0a commit f358b8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scriptlets/xml-prune.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function xmlPrune(source, propsToRemove, optionalProp = '', urlToMatch) {

urlToMatch = toRegExp(urlToMatch);

const checkIfXML = (text) => {
const isXML = (text) => {
// Check if "text" starts with "<" (can be preceded by any whitespace character)
// and check if it ends with ">" (can be followed by any whitespace character)
// If so, then it might be an XML file and should be pruned or logged
Expand All @@ -70,7 +70,7 @@ export function xmlPrune(source, propsToRemove, optionalProp = '', urlToMatch) {
};

const pruneXML = (text) => {
if (!checkIfXML(text)) {
if (!isXML(text)) {
return text;
}
try {
Expand Down Expand Up @@ -105,7 +105,7 @@ export function xmlPrune(source, propsToRemove, optionalProp = '', urlToMatch) {
const { response } = thisArg;
thisArg.removeEventListener('readystatechange', pruneResponse);
if (shouldLog) {
if (checkIfXML(response)) {
if (isXML(response)) {
log(`URL: ${xhrURL}\n${response}`);
hit(source);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ export function xmlPrune(source, propsToRemove, optionalProp = '', urlToMatch) {
return realFetch.apply(this, args).then((response) => {
return response.text().then((text) => {
if (shouldLog) {
if (checkIfXML(text)) {
if (isXML(text)) {
hit(source);
log(`URL: ${fetchURL}\n${text}`);
}
Expand Down

0 comments on commit f358b8a

Please sign in to comment.