A tiny unit to convert xml to javascript object.
Typescript
support.ESM
andUMD
friendly.- Tiny size.
$ npm install xtj
import XmlToJs from 'xtj'
const str = `<MyRoot><test>Success</test><test2><item>val1</item><item>val2</item></test2></MyRoot>`
XmlToJs(str)
/* =>
{
"HTML": [
{
"HEAD": "",
},
{
"BODY": [
{
"MYROOT": [
{
"TEST": "Success",
},
{
"TEST2": [
{
"ITEM": "val1",
},
{
"ITEM": "val2",
},
],
},
],
},
],
},
],
}
*/