isomorphic-xml2js
Advanced tools
Comparing version
@@ -75,3 +75,2 @@ "use strict"; | ||
this.parseString = parseString; | ||
console.log(opts); | ||
} | ||
@@ -78,0 +77,0 @@ } |
{ | ||
"name": "isomorphic-xml2js", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "XML parsing for browser and node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -1,2 +0,2 @@ | ||
var xml2js=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=document.implementation.createDocument(null,null,null),o=new XMLSerializer;function s(e){const t=[];for(const r of Object.keys(e)){const o=n.createAttribute(r);o.value=e[r].toString(),t.push(o)}return t}t.Builder=class{constructor(e){this.opts=e}buildObject(e){const t=function e(t,r){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t){const e=n.createElement(r.elementName);return e.textContent=t.toString(),[e]}if(Array.isArray(t)){const n=[];for(const o of t)for(const t of e(o,r))n.push(t);return n}if("object"==typeof t){const o=n.createElement(r.elementName);for(const r of Object.keys(t))if("$"===r)for(const e of s(t[r]))o.attributes.setNamedItem(e);else for(const n of e(t[r],{elementName:r}))o.appendChild(n);return[o]}throw new Error(`Illegal value passed to buildObject: ${t}`)}(e,{elementName:this.opts.rootName})[0];return o.serializeToString(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=(new DOMParser).parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;function o(e,t,r){if("function"==typeof t&&(r=t,t=void 0),"function"!=typeof r)throw new TypeError("callback must be a function, but got "+r);const o=new DOMParser;try{const t=o.parseFromString(e,"application/xml"),i=function(e){const t=e.getElementsByTagNameNS(n,"parsererror");return t.length?t.item(0).innerHTML:void 0}(t);if(i)throw new Error(i);r(null,function e(t){if(!(0!==t.childNodes.length||s(t)&&t.hasAttributes()))return"";if(1===t.childNodes.length&&t.childNodes[0].nodeType===Node.TEXT_NODE)return t.childNodes[0].nodeValue;const r={};for(let n=0;n<t.childNodes.length;n++){const o=t.childNodes[n];o.nodeType!==Node.TEXT_NODE&&(r[o.nodeName]?Array.isArray(r[o.nodeName])?r[o.nodeName].push(e(o)):r[o.nodeName]=[r[o.nodeName],e(o)]:r[o.nodeName]=e(o))}if(s(t)&&t.hasAttributes()){r.$={};for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e];r.$[n.nodeName]=n.nodeValue}}return r}(t.childNodes[0]))}catch(e){r(e)}}function s(e){return!!e.attributes}t.parseString=o;t.Parser=class{constructor(e){this.parseString=o,console.log(e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1);t.Parser=n.Parser,t.parseString=n.parseString;const o=r(0);t.Builder=o.Builder}]); | ||
var xml2js=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=document.implementation.createDocument(null,null,null),o=new XMLSerializer;function s(e){const t=[];for(const r of Object.keys(e)){const o=n.createAttribute(r);o.value=e[r].toString(),t.push(o)}return t}t.Builder=class{constructor(e){this.opts=e}buildObject(e){const t=function e(t,r){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t){const e=n.createElement(r.elementName);return e.textContent=t.toString(),[e]}if(Array.isArray(t)){const n=[];for(const o of t)for(const t of e(o,r))n.push(t);return n}if("object"==typeof t){const o=n.createElement(r.elementName);for(const r of Object.keys(t))if("$"===r)for(const e of s(t[r]))o.attributes.setNamedItem(e);else for(const n of e(t[r],{elementName:r}))o.appendChild(n);return[o]}throw new Error(`Illegal value passed to buildObject: ${t}`)}(e,{elementName:this.opts.rootName})[0];return o.serializeToString(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=(new DOMParser).parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;function o(e,t,r){if("function"==typeof t&&(r=t,t=void 0),"function"!=typeof r)throw new TypeError("callback must be a function, but got "+r);const o=new DOMParser;try{const t=o.parseFromString(e,"application/xml"),i=function(e){const t=e.getElementsByTagNameNS(n,"parsererror");return t.length?t.item(0).innerHTML:void 0}(t);if(i)throw new Error(i);r(null,function e(t){if(!(0!==t.childNodes.length||s(t)&&t.hasAttributes()))return"";if(1===t.childNodes.length&&t.childNodes[0].nodeType===Node.TEXT_NODE)return t.childNodes[0].nodeValue;const r={};for(let n=0;n<t.childNodes.length;n++){const o=t.childNodes[n];o.nodeType!==Node.TEXT_NODE&&(r[o.nodeName]?Array.isArray(r[o.nodeName])?r[o.nodeName].push(e(o)):r[o.nodeName]=[r[o.nodeName],e(o)]:r[o.nodeName]=e(o))}if(s(t)&&t.hasAttributes()){r.$={};for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e];r.$[n.nodeName]=n.nodeValue}}return r}(t.childNodes[0]))}catch(e){r(e)}}function s(e){return!!e.attributes}t.parseString=o;t.Parser=class{constructor(e){this.parseString=o}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1);t.Parser=n.Parser,t.parseString=n.parseString;const o=r(0);t.Builder=o.Builder}]); | ||
//# sourceMappingURL=xml2jsBundle.js.map |
12003
-0.35%179
-1.1%