Last active
October 6, 2020 14:36
-
-
Save talesmgodois/6774b357b5d19aab9709d09c80ccb1ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Parser } from "xml2js"; | |
const parseName = (name: string) => (name.indexOf(':') !== -1 ? name.split(':')[1] : name); | |
const camelize = (name: string) => name[0].toLowerCase() + name.substring(1, name.length); | |
const envelope = import { Parser } from "xml2js"; | |
await new Parser({ | |
explicitArray: false, | |
explicitRoot : false, | |
trim: true, | |
emptyTag: true, | |
ignoreAttrs: true, | |
tagNameProcessors: [parseName, camelize], | |
}).parseStringPromise(xml); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment