Merge pull request #288 from Cibico99/feature/xml-format-option-fix

Fix for XML Formatting Options
This commit is contained in:
Anoop M D 2023-10-02 20:34:10 +05:30 committed by GitHub
commit 55315b5b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,12 +51,12 @@ export const safeStringifyJSON = (obj, indent = false) => {
}
};
export const safeParseXML = (str) => {
export const safeParseXML = (str, options) => {
if (!str || !str.length || typeof str !== 'string') {
return str;
}
try {
return xmlFormat(str);
return xmlFormat(str, options);
} catch (e) {
return str;
}