@jjrawlins/cdk-diff-pr-github-action 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +4 -4
- package/cdkdiffprgithubaction/go.mod +1 -1
- package/cdkdiffprgithubaction/jsii/jsii.go +2 -2
- package/cdkdiffprgithubaction/version +1 -1
- package/lib/CdkDiffIamTemplate.js +2 -2
- package/lib/CdkDiffIamTemplateStackSet.js +2 -2
- package/lib/CdkDiffStackWorkflow.js +1 -1
- package/lib/CdkDriftDetectionWorkflow.js +1 -1
- package/lib/CdkDriftIamTemplate.js +2 -2
- package/node_modules/@aws-sdk/client-cloudformation/package.json +13 -13
- package/node_modules/@aws-sdk/core/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/package.json +12 -12
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +36 -19
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getSanitizedTypeScriptVersion.js +9 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptPackageJsonPaths.js +17 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js +17 -12
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/getSanitizedTypeScriptVersion.d.ts +8 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/getTypeScriptPackageJsonPaths.d.ts +10 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getSanitizedTypeScriptVersion.d.ts +3 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getTypeScriptPackageJsonPaths.d.ts +3 -0
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +1 -0
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +1 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/CHANGELOG.md +23 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.d.cts +15 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/package.json +3 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.d.ts +16 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/util.js +1 -26
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +87 -87
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +10 -10
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +23 -23
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +29 -29
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +39 -39
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +17 -17
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/XMLParser.js +22 -22
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +85 -85
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/validator.js +34 -34
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -284
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +2 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +27 -5
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +21 -21
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/node2json.js +38 -34
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +10 -10
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +2 -8
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -8
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +18 -4
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +18 -4
- package/node_modules/@smithy/fetch-http-handler/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +21 -8
- package/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +16 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -4
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +3 -4
- package/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +9 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +9 -0
- package/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-builder/README.md +23 -0
- package/node_modules/fast-xml-builder/lib/builder.cjs +1 -0
- package/node_modules/fast-xml-builder/lib/builder.min.js +2 -0
- package/node_modules/fast-xml-builder/lib/builder.min.js.map +1 -0
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +167 -0
- package/node_modules/fast-xml-builder/package.json +78 -0
- package/node_modules/fast-xml-builder/src/fxb.d.ts +156 -0
- package/node_modules/fast-xml-builder/src/fxb.js +285 -0
- package/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlbuilder → fast-xml-builder/src}/orderedJs2Xml.js +14 -3
- package/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
- package/package.json +2 -2
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptPackageJsonPath.js +0 -14
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/getTypeScriptPackageJsonPath.d.ts +0 -9
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getTypeScriptPackageJsonPath.d.ts +0 -1
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlbuilder/prettifyJs2Xml.js → fast-xml-builder/CHANGELOG.md} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Natural Intelligence
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# fast-xml-builder
|
|
2
|
+
Build XML from JSON
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
XML Builder was the part of [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) for years. But considering that any bug in parser may false-alarm the users who are only using builder, we have decided to split it into a separate package.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install fast-xml-builder
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { XMLBuilder } from 'fast-xml-builder';
|
|
17
|
+
|
|
18
|
+
const builder = new XMLBuilder();
|
|
19
|
+
const xml = builder.build({ name: 'value' });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
fast-xml-builder fully support the response generated by fast-xml-parser. So you can use the maximum options as you are using for fast-xml-parser like `preserveOrder`, `ignoreAttributes`, `attributeNamePrefix`, `textNodeName`, `cdataTagName`, `cdataPositionChar`, `format`, `indentBy`, `suppressEmptyNode` and many more. Any change in parser will reflect here time to time.
|
|
23
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function i(t,e){let i="";return e.format&&e.indentBy.length>0&&(i="\n"),s(t,e,"",i)}function s(t,e,i,p){let u="",h=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=a(i,e),i}return""}for(let l=0;l<t.length;l++){const d=t[l],c=n(d);if(void 0===c)continue;let f="";if(f=0===i.length?c:`${i}.${c}`,c===e.textNodeName){let t=d[c];r(f,e)||(t=e.tagValueProcessor(c,t),t=a(t,e)),h&&(u+=p),u+=t,h=!1;continue}if(c===e.cdataPropName){h&&(u+=p),u+=`<![CDATA[${d[c][0][e.textNodeName]}]]>`,h=!1;continue}if(c===e.commentPropName){u+=p+`\x3c!--${d[c][0][e.textNodeName]}--\x3e`,h=!0;continue}if("?"===c[0]){const t=o(d[":@"],e),i="?xml"===c?"":p;let s=d[c][0][e.textNodeName];s=0!==s.length?" "+s:"",u+=i+`<${c}${s}${t}?>`,h=!0;continue}let g=p;""!==g&&(g+=e.indentBy);const N=p+`<${c}${o(d[":@"],e)}`,b=s(d[c],e,f,g);-1!==e.unpairedTags.indexOf(c)?e.suppressUnpairedNode?u+=N+">":u+=N+"/>":b&&0!==b.length||!e.suppressEmptyNode?b&&b.endsWith(">")?u+=N+`>${b}${p}</${c}>`:(u+=N+">",b&&""!==p&&(b.includes("/>")||b.includes("</"))?u+=p+e.indentBy+b+p:u+=b,u+=`</${c}>`):u+=N+"/>",h=!0}return u}function n(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(Object.prototype.hasOwnProperty.call(t,s)&&":@"!==s)return s}}function o(t,e){let i="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e.attributeValueProcessor(s,t[s]);n=a(n,e),!0===n&&e.suppressBooleanAttributes?i+=` ${s.substr(e.attributeNamePrefix.length)}`:i+=` ${s.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function r(t,e){let i=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===t||e.stopNodes[s]==="*."+i)return!0;return!1}function a(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const s=e.entities[i];t=t.replace(s.regex,s.val)}return t}t.r(e),t.d(e,{default:()=>u});const p={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function u(t){var e;this.options=Object.assign({},p,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=d),this.processTextOrObjNode=h,this.options.format?(this.indentate=l,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function h(t,e,i,s){const n=this.j2x(t,i+1,s.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,i):this.buildObjectNode(n.val,e,n.attrStr,i)}function l(t){return this.options.indentBy.repeat(t)}function d(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}u.prototype.build=function(t){return this.options.preserveOrder?i(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)},u.prototype.j2x=function(t,e,i){let s="",n="";const o=i.join(".");for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))if(void 0===t[r])this.isAttribute(r)&&(n+="");else if(null===t[r])this.isAttribute(r)||r===this.options.cdataPropName?n+="":"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar;else if(t[r]instanceof Date)n+=this.buildTextValNode(t[r],r,"",e);else if("object"!=typeof t[r]){const i=this.isAttribute(r);if(i&&!this.ignoreAttributesFn(i,o))s+=this.buildAttrPairStr(i,""+t[r]);else if(!i)if(r===this.options.textNodeName){let e=this.options.tagValueProcessor(r,""+t[r]);n+=this.replaceEntitiesValue(e)}else n+=this.buildTextValNode(t[r],r,"",e)}else if(Array.isArray(t[r])){const s=t[r].length;let o="",a="";for(let p=0;p<s;p++){const s=t[r][p];if(void 0===s);else if(null===s)"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar;else if("object"==typeof s)if(this.options.oneListGroup){const t=this.j2x(s,e+1,i.concat(r));o+=t.val,this.options.attributesGroupName&&s.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(s,r,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(r,s);t=this.replaceEntitiesValue(t),o+=t}else o+=this.buildTextValNode(s,r,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,r,a,e)),n+=o}else if(this.options.attributesGroupName&&r===this.options.attributesGroupName){const e=Object.keys(t[r]),i=e.length;for(let n=0;n<i;n++)s+=this.buildAttrPairStr(e[n],""+t[r][e[n]])}else n+=this.processTextOrObjNode(t[r],r,e,i);return{attrStr:s,val:n}},u.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},u.prototype.buildObjectNode=function(t,e,i,s){if(""===t)return"?"===e[0]?this.indentate(s)+"<"+e+i+"?"+this.tagEndChar:this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",n=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(s)+"<"+e+i+o+this.tagEndChar+t+this.indentate(s)+n:this.indentate(s)+"<"+e+i+o+">"+t+n}},u.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},u.prototype.buildTextValNode=function(t,e,i,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},u.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t},module.exports=e})();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxpBuilder=e():t.fxpBuilder=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){var r="";return e.format&&e.indentBy.length>0&&(r="\n"),i(t,e,"",r)}function i(t,e,r,u){var p="",h=!1;if(!Array.isArray(t)){if(null!=t){var l=t.toString();return a(l,e)}return""}for(var d=0;d<t.length;d++){var f=t[d],c=n(f);if(void 0!==c){var g;if(g=0===r.length?c:r+"."+c,c!==e.textNodeName)if(c!==e.cdataPropName)if(c!==e.commentPropName)if("?"!==c[0]){var b=u;""!==b&&(b+=e.indentBy);var m=u+"<"+c+o(f[":@"],e),v=i(f[c],e,g,b);-1!==e.unpairedTags.indexOf(c)?e.suppressUnpairedNode?p+=m+">":p+=m+"/>":v&&0!==v.length||!e.suppressEmptyNode?v&&v.endsWith(">")?p+=m+">"+v+u+"</"+c+">":(p+=m+">",v&&""!==u&&(v.includes("/>")||v.includes("</"))?p+=u+e.indentBy+v+u:p+=v,p+="</"+c+">"):p+=m+"/>",h=!0}else{var N=o(f[":@"],e),y="?xml"===c?"":u,x=f[c][0][e.textNodeName];p+=y+"<"+c+(x=0!==x.length?" "+x:"")+N+"?>",h=!0}else p+=u+"\x3c!--"+f[c][0][e.textNodeName]+"--\x3e",h=!0;else h&&(p+=u),p+="<![CDATA["+f[c][0][e.textNodeName]+"]]>",h=!1;else{var P=f[c];s(g,e)||(P=a(P=e.tagValueProcessor(c,P),e)),h&&(p+=u),p+=P,h=!1}}}return p}function n(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function o(t,e){var r="";if(t&&!e.ignoreAttributes)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=e.attributeValueProcessor(i,t[i]);!0===(n=a(n,e))&&e.suppressBooleanAttributes?r+=" "+i.substr(e.attributeNamePrefix.length):r+=" "+i.substr(e.attributeNamePrefix.length)+'="'+n+'"'}return r}function s(t,e){var r=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(var i in e.stopNodes)if(e.stopNodes[i]===t||e.stopNodes[i]==="*."+r)return!0;return!1}function a(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var i=e.entities[r];t=t.replace(i.regex,i.val)}return t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}t.r(e),t.d(e,{default:()=>h});var p={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function h(t){var e;this.options=Object.assign({},p,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?function(t){for(var r,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=i()).done;){var n=r.value;if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:function(){return!1},this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=f),this.processTextOrObjNode=l,this.options.format?(this.indentate=d,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function l(t,e,r,i){var n=this.j2x(t,r+1,i.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}function d(t){return this.options.indentBy.repeat(t)}function f(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}return h.prototype.build=function(t){return this.options.preserveOrder?r(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&((e={})[this.options.arrayNodeName]=t,t=e),this.j2x(t,0,[]).val);var e},h.prototype.j2x=function(t,e,r){var i="",n="",o=r.join(".");for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))if(void 0===t[s])this.isAttribute(s)&&(n+="");else if(null===t[s])this.isAttribute(s)||s===this.options.cdataPropName?n+="":"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(t[s]instanceof Date)n+=this.buildTextValNode(t[s],s,"",e);else if("object"!=typeof t[s]){var a=this.isAttribute(s);if(a&&!this.ignoreAttributesFn(a,o))i+=this.buildAttrPairStr(a,""+t[s]);else if(!a)if(s===this.options.textNodeName){var u=this.options.tagValueProcessor(s,""+t[s]);n+=this.replaceEntitiesValue(u)}else n+=this.buildTextValNode(t[s],s,"",e)}else if(Array.isArray(t[s])){for(var p=t[s].length,h="",l="",d=0;d<p;d++){var f=t[s][d];if(void 0===f);else if(null===f)"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof f)if(this.options.oneListGroup){var c=this.j2x(f,e+1,r.concat(s));h+=c.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(l+=c.attrStr)}else h+=this.processTextOrObjNode(f,s,e,r);else if(this.options.oneListGroup){var g=this.options.tagValueProcessor(s,f);h+=g=this.replaceEntitiesValue(g)}else h+=this.buildTextValNode(f,s,"",e)}this.options.oneListGroup&&(h=this.buildObjectNode(h,s,l,e)),n+=h}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName)for(var b=Object.keys(t[s]),m=b.length,v=0;v<m;v++)i+=this.buildAttrPairStr(b[v],""+t[s][b[v]]);else n+=this.processTextOrObjNode(t[s],s,e,r);return{attrStr:i,val:n}},h.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},h.prototype.buildObjectNode=function(t,e,r,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;var n="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",n=""),!r&&""!==r||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(i)+"\x3c!--"+t+"--\x3e"+this.newLine:this.indentate(i)+"<"+e+r+o+this.tagEndChar+t+this.indentate(i)+n:this.indentate(i)+"<"+e+r+o+">"+t+n},h.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":"></"+t,e},h.prototype.buildTextValNode=function(t,e,r,i){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(i)+"<![CDATA["+t+"]]>"+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+"\x3c!--"+t+"--\x3e"+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var n=this.options.tagValueProcessor(e,t);return""===(n=this.replaceEntitiesValue(n))?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"</"+e+this.tagEndChar},h.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t},e})());
|
|
2
|
+
//# sourceMappingURL=builder.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"./lib/builder.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,GACtB,CATD,CASGK,KAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,M,KCGxC,SAASC,EAAMC,EAAQC,GAClC,IAAIC,EAAc,GAIlB,OAHID,EAAQE,QAAUF,EAAQG,SAASC,OAAS,IAC5CH,EAXI,MAaDI,EAASN,EAAQC,E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D,KAAKgI,SAAS7H,GAAOH,KAAKmG,WAExEnG,KAAKkG,UAAUI,GAAS,IAAMnG,EAAM0D,EAAU,IACnDW,EACA,KAAOrE,EAAMH,KAAKmG,UAG1B,EAEAb,EAAQ3E,UAAUsB,qBAAuB,SAAUuC,GACjD,GAAIA,GAAaA,EAAUjD,OAAS,GAAKvB,KAAKmB,QAAQsD,gBACpD,IAAK,IAAIvC,EAAI,EAAGA,EAAIlC,KAAKmB,QAAQuD,SAASnD,OAAQW,IAAK,CACrD,IAAMyC,EAAS3E,KAAKmB,QAAQuD,SAASxC,GACrCsC,EAAYA,EAAUI,QAAQD,EAAOE,MAAOF,EAAOG,IACrD,CAEF,OAAON,CACT,E","sources":["webpack://fxpBuilder/webpack/universalModuleDefinition","webpack://fxpBuilder/webpack/bootstrap","webpack://fxpBuilder/webpack/runtime/define property getters","webpack://fxpBuilder/webpack/runtime/hasOwnProperty shorthand","webpack://fxpBuilder/webpack/runtime/make namespace object","webpack://fxpBuilder/./src/orderedJs2Xml.js","webpack://fxpBuilder/./src/builder.js","webpack://fxpBuilder/./src/ignoreAttributes.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"fxpBuilder\"] = factory();\n\telse\n\t\troot[\"fxpBuilder\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const EOL = \"\\n\";\n\n/**\n * \n * @param {array} jArray \n * @param {any} options \n * @returns \n */\nexport default function toXml(jArray, options) {\n let indentation = \"\";\n if (options.format && options.indentBy.length > 0) {\n indentation = EOL;\n }\n return arrToStr(jArray, options, \"\", indentation);\n}\n\nfunction arrToStr(arr, options, jPath, indentation) {\n let xmlStr = \"\";\n let isPreviousElementTag = false;\n\n\n if (!Array.isArray(arr)) {\n // Non-array values (e.g. string tag values) should be treated as text content\n if (arr !== undefined && arr !== null) {\n let text = arr.toString();\n text = replaceEntitiesValue(text, options);\n return text;\n }\n return \"\";\n }\n\n for (let i = 0; i < arr.length; i++) {\n const tagObj = arr[i];\n const tagName = propName(tagObj);\n if (tagName === undefined) continue;\n\n let newJPath = \"\";\n if (jPath.length === 0) newJPath = tagName\n else newJPath = `${jPath}.${tagName}`;\n\n if (tagName === options.textNodeName) {\n let tagText = tagObj[tagName];\n if (!isStopNode(newJPath, options)) {\n tagText = options.tagValueProcessor(tagName, tagText);\n tagText = replaceEntitiesValue(tagText, options);\n }\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += tagText;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.cdataPropName) {\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.commentPropName) {\n xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;\n isPreviousElementTag = true;\n continue;\n } else if (tagName[0] === \"?\") {\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tempInd = tagName === \"?xml\" ? \"\" : indentation;\n let piTextNodeName = tagObj[tagName][0][options.textNodeName];\n piTextNodeName = piTextNodeName.length !== 0 ? \" \" + piTextNodeName : \"\"; //remove extra spacing\n xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;\n isPreviousElementTag = true;\n continue;\n }\n let newIdentation = indentation;\n if (newIdentation !== \"\") {\n newIdentation += options.indentBy;\n }\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tagStart = indentation + `<${tagName}${attStr}`;\n const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);\n if (options.unpairedTags.indexOf(tagName) !== -1) {\n if (options.suppressUnpairedNode) xmlStr += tagStart + \">\";\n else xmlStr += tagStart + \"/>\";\n } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {\n xmlStr += tagStart + \"/>\";\n } else if (tagValue && tagValue.endsWith(\">\")) {\n xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;\n } else {\n xmlStr += tagStart + \">\";\n if (tagValue && indentation !== \"\" && (tagValue.includes(\"/>\") || tagValue.includes(\"</\"))) {\n xmlStr += indentation + options.indentBy + tagValue + indentation;\n } else {\n xmlStr += tagValue;\n }\n xmlStr += `</${tagName}>`;\n }\n isPreviousElementTag = true;\n }\n\n return xmlStr;\n}\n\nfunction propName(obj) {\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;\n if (key !== \":@\") return key;\n }\n}\n\nfunction attr_to_str(attrMap, options) {\n let attrStr = \"\";\n if (attrMap && !options.ignoreAttributes) {\n for (let attr in attrMap) {\n if (!Object.prototype.hasOwnProperty.call(attrMap, attr)) continue;\n let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);\n attrVal = replaceEntitiesValue(attrVal, options);\n if (attrVal === true && options.suppressBooleanAttributes) {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;\n } else {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}=\"${attrVal}\"`;\n }\n }\n }\n return attrStr;\n}\n\nfunction isStopNode(jPath, options) {\n jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);\n let tagName = jPath.substr(jPath.lastIndexOf(\".\") + 1);\n for (let index in options.stopNodes) {\n if (options.stopNodes[index] === jPath || options.stopNodes[index] === \"*.\" + tagName) return true;\n }\n return false;\n}\n\nfunction replaceEntitiesValue(textValue, options) {\n if (textValue && textValue.length > 0 && options.processEntities) {\n for (let i = 0; i < options.entities.length; i++) {\n const entity = options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n","'use strict';\n//parse Empty Node as self closing node\nimport buildFromOrderedJs from './orderedJs2Xml.js';\nimport getIgnoreAttributesFn from \"./ignoreAttributes.js\";\n\nconst defaultOptions = {\n attributeNamePrefix: '@_',\n attributesGroupName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n cdataPropName: false,\n format: false,\n indentBy: ' ',\n suppressEmptyNode: false,\n suppressUnpairedNode: true,\n suppressBooleanAttributes: true,\n tagValueProcessor: function (key, a) {\n return a;\n },\n attributeValueProcessor: function (attrName, a) {\n return a;\n },\n preserveOrder: false,\n commentPropName: false,\n unpairedTags: [],\n entities: [\n { regex: new RegExp(\"&\", \"g\"), val: \"&\" },//it must be on top\n { regex: new RegExp(\">\", \"g\"), val: \">\" },\n { regex: new RegExp(\"<\", \"g\"), val: \"<\" },\n { regex: new RegExp(\"\\'\", \"g\"), val: \"'\" },\n { regex: new RegExp(\"\\\"\", \"g\"), val: \""\" }\n ],\n processEntities: true,\n stopNodes: [],\n // transformTagName: false,\n // transformAttributeName: false,\n oneListGroup: false\n};\n\nexport default function Builder(options) {\n this.options = Object.assign({}, defaultOptions, options);\n if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {\n this.isAttribute = function (/*a*/) {\n return false;\n };\n } else {\n this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)\n this.attrPrefixLen = this.options.attributeNamePrefix.length;\n this.isAttribute = isAttribute;\n }\n\n this.processTextOrObjNode = processTextOrObjNode\n\n if (this.options.format) {\n this.indentate = indentate;\n this.tagEndChar = '>\\n';\n this.newLine = '\\n';\n } else {\n this.indentate = function () {\n return '';\n };\n this.tagEndChar = '>';\n this.newLine = '';\n }\n}\n\nBuilder.prototype.build = function (jObj) {\n if (this.options.preserveOrder) {\n return buildFromOrderedJs(jObj, this.options);\n } else {\n if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {\n jObj = {\n [this.options.arrayNodeName]: jObj\n }\n }\n return this.j2x(jObj, 0, []).val;\n }\n};\n\nBuilder.prototype.j2x = function (jObj, level, ajPath) {\n let attrStr = '';\n let val = '';\n const jPath = ajPath.join('.')\n for (let key in jObj) {\n if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;\n if (typeof jObj[key] === 'undefined') {\n // supress undefined node only if it is not an attribute\n if (this.isAttribute(key)) {\n val += '';\n }\n } else if (jObj[key] === null) {\n // null attribute should be ignored by the attribute list, but should not cause the tag closing\n if (this.isAttribute(key)) {\n val += '';\n } else if (key === this.options.cdataPropName) {\n val += '';\n } else if (key[0] === '?') {\n val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n } else {\n val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n }\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (jObj[key] instanceof Date) {\n val += this.buildTextValNode(jObj[key], key, '', level);\n } else if (typeof jObj[key] !== 'object') {\n //premitive type\n const attr = this.isAttribute(key);\n if (attr && !this.ignoreAttributesFn(attr, jPath)) {\n attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);\n } else if (!attr) {\n //tag value\n if (key === this.options.textNodeName) {\n let newval = this.options.tagValueProcessor(key, '' + jObj[key]);\n val += this.replaceEntitiesValue(newval);\n } else {\n val += this.buildTextValNode(jObj[key], key, '', level);\n }\n }\n } else if (Array.isArray(jObj[key])) {\n //repeated nodes\n const arrLen = jObj[key].length;\n let listTagVal = \"\";\n let listTagAttr = \"\";\n for (let j = 0; j < arrLen; j++) {\n const item = jObj[key][j];\n if (typeof item === 'undefined') {\n // supress undefined node\n } else if (item === null) {\n if (key[0] === \"?\") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (typeof item === 'object') {\n if (this.options.oneListGroup) {\n const result = this.j2x(item, level + 1, ajPath.concat(key));\n listTagVal += result.val;\n if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {\n listTagAttr += result.attrStr\n }\n } else {\n listTagVal += this.processTextOrObjNode(item, key, level, ajPath)\n }\n } else {\n if (this.options.oneListGroup) {\n let textValue = this.options.tagValueProcessor(key, item);\n textValue = this.replaceEntitiesValue(textValue);\n listTagVal += textValue;\n } else {\n listTagVal += this.buildTextValNode(item, key, '', level);\n }\n }\n }\n if (this.options.oneListGroup) {\n listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);\n }\n val += listTagVal;\n } else {\n //nested node\n if (this.options.attributesGroupName && key === this.options.attributesGroupName) {\n const Ks = Object.keys(jObj[key]);\n const L = Ks.length;\n for (let j = 0; j < L; j++) {\n attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);\n }\n } else {\n val += this.processTextOrObjNode(jObj[key], key, level, ajPath)\n }\n }\n }\n return { attrStr: attrStr, val: val };\n};\n\nBuilder.prototype.buildAttrPairStr = function (attrName, val) {\n val = this.options.attributeValueProcessor(attrName, '' + val);\n val = this.replaceEntitiesValue(val);\n if (this.options.suppressBooleanAttributes && val === \"true\") {\n return ' ' + attrName;\n } else return ' ' + attrName + '=\"' + val + '\"';\n}\n\nfunction processTextOrObjNode(object, key, level, ajPath) {\n const result = this.j2x(object, level + 1, ajPath.concat(key));\n if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {\n return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);\n } else {\n return this.buildObjectNode(result.val, key, result.attrStr, level);\n }\n}\n\nBuilder.prototype.buildObjectNode = function (val, key, attrStr, level) {\n if (val === \"\") {\n if (key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n }\n } else {\n\n let tagEndExp = '</' + key + this.tagEndChar;\n let piClosingChar = \"\";\n\n if (key[0] === \"?\") {\n piClosingChar = \"?\";\n tagEndExp = \"\";\n }\n\n // attrStr is an empty string in case the attribute came as undefined or null\n if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {\n return (this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp);\n } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n } else {\n return (\n this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +\n val +\n this.indentate(level) + tagEndExp);\n }\n }\n}\n\nBuilder.prototype.closeTag = function (key) {\n let closeTag = \"\";\n if (this.options.unpairedTags.indexOf(key) !== -1) { //unpaired\n if (!this.options.suppressUnpairedNode) closeTag = \"/\"\n } else if (this.options.suppressEmptyNode) { //empty\n closeTag = \"/\";\n } else {\n closeTag = `></${key}`\n }\n return closeTag;\n}\n\nfunction buildEmptyObjNode(val, key, attrStr, level) {\n if (val !== '') {\n return this.buildObjectNode(val, key, attrStr, level);\n } else {\n if (key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;\n // return this.buildTagStr(level,key, attrStr);\n }\n }\n}\n\nBuilder.prototype.buildTextValNode = function (val, key, attrStr, level) {\n if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {\n return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;\n } else if (this.options.commentPropName !== false && key === this.options.commentPropName) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n } else if (key[0] === \"?\") {//PI tag\n return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n } else {\n let textValue = this.options.tagValueProcessor(key, val);\n textValue = this.replaceEntitiesValue(textValue);\n\n if (textValue === '') {\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n } else {\n return this.indentate(level) + '<' + key + attrStr + '>' +\n textValue +\n '</' + key + this.tagEndChar;\n }\n }\n}\n\nBuilder.prototype.replaceEntitiesValue = function (textValue) {\n if (textValue && textValue.length > 0 && this.options.processEntities) {\n for (let i = 0; i < this.options.entities.length; i++) {\n const entity = this.options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n\nfunction indentate(level) {\n return this.options.indentBy.repeat(level);\n}\n\nfunction isAttribute(name /*, options*/) {\n if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {\n return name.substr(this.attrPrefixLen);\n } else {\n return false;\n }\n}\n\n","export default function getIgnoreAttributesFn(ignoreAttributes) {\n if (typeof ignoreAttributes === 'function') {\n return ignoreAttributes\n }\n if (Array.isArray(ignoreAttributes)) {\n return (attrName) => {\n for (const pattern of ignoreAttributes) {\n if (typeof pattern === 'string' && attrName === pattern) {\n return true\n }\n if (pattern instanceof RegExp && pattern.test(attrName)) {\n return true\n }\n }\n }\n }\n return () => false\n}"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","toXml","jArray","options","indentation","format","indentBy","length","arrToStr","arr","jPath","xmlStr","isPreviousElementTag","Array","isArray","text","toString","replaceEntitiesValue","i","tagObj","tagName","propName","undefined","newJPath","textNodeName","cdataPropName","commentPropName","newIdentation","tagStart","attr_to_str","tagValue","unpairedTags","indexOf","suppressUnpairedNode","suppressEmptyNode","endsWith","includes","attStr","tempInd","piTextNodeName","tagText","isStopNode","tagValueProcessor","keys","attrMap","attrStr","ignoreAttributes","attr","attrVal","attributeValueProcessor","suppressBooleanAttributes","substr","attributeNamePrefix","lastIndexOf","index","stopNodes","textValue","processEntities","entities","entity","replace","regex","val","defaultOptions","attributesGroupName","a","attrName","preserveOrder","RegExp","oneListGroup","Builder","assign","isAttribute","ignoreAttributesFn","_step","_iterator","_createForOfIteratorHelperLoose","done","pattern","test","attrPrefixLen","processTextOrObjNode","indentate","tagEndChar","newLine","object","level","ajPath","result","j2x","concat","buildTextValNode","buildObjectNode","repeat","name","startsWith","build","jObj","buildFromOrderedJs","arrayNodeName","_jObj","join","Date","buildAttrPairStr","newval","arrLen","listTagVal","listTagAttr","j","item","Ks","L","closeTag","tagEndExp","piClosingChar"],"sourceRoot":""}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
type XmlBuilderOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Give a prefix to the attribute name in the resulting JS object
|
|
6
|
+
*
|
|
7
|
+
* Defaults to '@_'
|
|
8
|
+
*/
|
|
9
|
+
attributeNamePrefix?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A name to group all attributes of a tag under, or `false` to disable
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `false`
|
|
15
|
+
*/
|
|
16
|
+
attributesGroupName?: false | string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The name of the next node in the resulting JS
|
|
20
|
+
*
|
|
21
|
+
* Defaults to `#text`
|
|
22
|
+
*/
|
|
23
|
+
textNodeName?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether to ignore attributes when building
|
|
27
|
+
*
|
|
28
|
+
* When `true` - ignores all the attributes
|
|
29
|
+
*
|
|
30
|
+
* When `false` - builds all the attributes
|
|
31
|
+
*
|
|
32
|
+
* When `Array<string | RegExp>` - filters out attributes that match provided patterns
|
|
33
|
+
*
|
|
34
|
+
* When `Function` - calls the function for each attribute and filters out those for which the function returned `true`
|
|
35
|
+
*
|
|
36
|
+
* Defaults to `true`
|
|
37
|
+
*/
|
|
38
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Give a property name to set CDATA values to instead of merging to tag's text value
|
|
42
|
+
*
|
|
43
|
+
* Defaults to `false`
|
|
44
|
+
*/
|
|
45
|
+
cdataPropName?: false | string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* If set, parse comments and set as this property
|
|
49
|
+
*
|
|
50
|
+
* Defaults to `false`
|
|
51
|
+
*/
|
|
52
|
+
commentPropName?: false | string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Whether to make output pretty instead of single line
|
|
56
|
+
*
|
|
57
|
+
* Defaults to `false`
|
|
58
|
+
*/
|
|
59
|
+
format?: boolean;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* If `format` is set to `true`, sets the indent string
|
|
64
|
+
*
|
|
65
|
+
* Defaults to ` `
|
|
66
|
+
*/
|
|
67
|
+
indentBy?: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Give a name to a top-level array
|
|
71
|
+
*
|
|
72
|
+
* Defaults to `undefined`
|
|
73
|
+
*/
|
|
74
|
+
arrayNodeName?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Create empty tags for tags with no text value
|
|
78
|
+
*
|
|
79
|
+
* Defaults to `false`
|
|
80
|
+
*/
|
|
81
|
+
suppressEmptyNode?: boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Suppress an unpaired tag
|
|
85
|
+
*
|
|
86
|
+
* Defaults to `true`
|
|
87
|
+
*/
|
|
88
|
+
suppressUnpairedNode?: boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Don't put a value for boolean attributes
|
|
92
|
+
*
|
|
93
|
+
* Defaults to `true`
|
|
94
|
+
*/
|
|
95
|
+
suppressBooleanAttributes?: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Preserve the order of tags in resulting JS object
|
|
99
|
+
*
|
|
100
|
+
* Defaults to `false`
|
|
101
|
+
*/
|
|
102
|
+
preserveOrder?: boolean;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* List of tags without closing tags
|
|
106
|
+
*
|
|
107
|
+
* Defaults to `[]`
|
|
108
|
+
*/
|
|
109
|
+
unpairedTags?: string[];
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Nodes to stop parsing at
|
|
113
|
+
*
|
|
114
|
+
* Defaults to `[]`
|
|
115
|
+
*/
|
|
116
|
+
stopNodes?: string[];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
120
|
+
*
|
|
121
|
+
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
122
|
+
* @returns {unknown}
|
|
123
|
+
*
|
|
124
|
+
* 1. Different value or value with different data type to set new value.
|
|
125
|
+
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
126
|
+
*
|
|
127
|
+
* Defaults to `(tagName, val, jPath, hasAttributes, isLeafNode) => val`
|
|
128
|
+
*/
|
|
129
|
+
tagValueProcessor?: (name: string, value: unknown) => unknown;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Control how attribute value should be parsed
|
|
133
|
+
*
|
|
134
|
+
* @param attrName
|
|
135
|
+
* @param attrValue
|
|
136
|
+
* @param jPath
|
|
137
|
+
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
138
|
+
* @returns {unknown}
|
|
139
|
+
*
|
|
140
|
+
* Defaults to `(attrName, val, jPath) => val`
|
|
141
|
+
*/
|
|
142
|
+
attributeValueProcessor?: (name: string, value: unknown) => unknown;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether to process default and DOCTYPE entities
|
|
146
|
+
*
|
|
147
|
+
* Defaults to `true`
|
|
148
|
+
*/
|
|
149
|
+
processEntities?: boolean;
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
oneListGroup?: boolean;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
declare class XMLBuilder {
|
|
156
|
+
constructor(options?: XmlBuilderOptions);
|
|
157
|
+
build(jObj: any): string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare namespace fxpBuilder {
|
|
161
|
+
export {
|
|
162
|
+
XMLBuilder,
|
|
163
|
+
XmlBuilderOptions,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export = fxpBuilder;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fast-xml-builder",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Build XML from JSON without C/C++ based libraries",
|
|
5
|
+
"main": "./lib/fxb.cjs",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"module": "./src/fxb.js",
|
|
9
|
+
"types": "./src/fxb.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./src/fxb.d.ts",
|
|
14
|
+
"default": "./src/fxb.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./lib/fxb.d.cts",
|
|
18
|
+
"default": "./lib/fxb.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "c8 --reporter=lcov --reporter=text jasmine spec/*spec.js",
|
|
24
|
+
"test-types": "tsc --noEmit spec/typings/typings-test.ts",
|
|
25
|
+
"unit": "jasmine",
|
|
26
|
+
"lint": "eslint src/**/*.js spec/**/*.js benchmark/**/*.js",
|
|
27
|
+
"bundle": "webpack --config webpack.cjs.config.js",
|
|
28
|
+
"prettier": "prettier --write src/**/*.js",
|
|
29
|
+
"checkReadiness": "publish-please --dry-run",
|
|
30
|
+
"publish-please": "publish-please",
|
|
31
|
+
"prepublishOnly": "publish-please guard"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"lib",
|
|
35
|
+
"src",
|
|
36
|
+
"CHANGELOG.md"
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/NaturalIntelligence/fast-xml-builder.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"xml",
|
|
44
|
+
"json",
|
|
45
|
+
"fast",
|
|
46
|
+
"builder",
|
|
47
|
+
"parser",
|
|
48
|
+
"js2xml",
|
|
49
|
+
"json2xml"
|
|
50
|
+
],
|
|
51
|
+
"author": "Amit Gupta (https://solothought.com)",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/core": "^7.13.10",
|
|
55
|
+
"@babel/plugin-transform-runtime": "^7.13.10",
|
|
56
|
+
"@babel/preset-env": "^7.13.10",
|
|
57
|
+
"@babel/register": "^7.13.8",
|
|
58
|
+
"@types/node": "20",
|
|
59
|
+
"babel-loader": "^8.2.2",
|
|
60
|
+
"c8": "^10.1.3",
|
|
61
|
+
"eslint": "^8.3.0",
|
|
62
|
+
"jasmine": "^5.6.0",
|
|
63
|
+
"prettier": "^3.5.1",
|
|
64
|
+
"publish-please": "^5.5.2",
|
|
65
|
+
"typescript": "5",
|
|
66
|
+
"webpack": "^5.64.4",
|
|
67
|
+
"webpack-cli": "^4.9.1",
|
|
68
|
+
"fast-xml-parser": "^5.3.9",
|
|
69
|
+
"he": "^1.2.0"
|
|
70
|
+
},
|
|
71
|
+
"funding": [
|
|
72
|
+
{
|
|
73
|
+
"type": "github",
|
|
74
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"dependencies": {}
|
|
78
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export type XmlBuilderOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Give a prefix to the attribute name in the resulting JS object
|
|
4
|
+
*
|
|
5
|
+
* Defaults to '@_'
|
|
6
|
+
*/
|
|
7
|
+
attributeNamePrefix?: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A name to group all attributes of a tag under, or `false` to disable
|
|
11
|
+
*
|
|
12
|
+
* Defaults to `false`
|
|
13
|
+
*/
|
|
14
|
+
attributesGroupName?: false | string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The name of the next node in the resulting JS
|
|
18
|
+
*
|
|
19
|
+
* Defaults to `#text`
|
|
20
|
+
*/
|
|
21
|
+
textNodeName?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether to ignore attributes when building
|
|
25
|
+
*
|
|
26
|
+
* When `true` - ignores all the attributes
|
|
27
|
+
*
|
|
28
|
+
* When `false` - builds all the attributes
|
|
29
|
+
*
|
|
30
|
+
* When `Array<string | RegExp>` - filters out attributes that match provided patterns
|
|
31
|
+
*
|
|
32
|
+
* When `Function` - calls the function for each attribute and filters out those for which the function returned `true`
|
|
33
|
+
*
|
|
34
|
+
* Defaults to `true`
|
|
35
|
+
*/
|
|
36
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Give a property name to set CDATA values to instead of merging to tag's text value
|
|
40
|
+
*
|
|
41
|
+
* Defaults to `false`
|
|
42
|
+
*/
|
|
43
|
+
cdataPropName?: false | string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* If set, parse comments and set as this property
|
|
47
|
+
*
|
|
48
|
+
* Defaults to `false`
|
|
49
|
+
*/
|
|
50
|
+
commentPropName?: false | string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Whether to make output pretty instead of single line
|
|
54
|
+
*
|
|
55
|
+
* Defaults to `false`
|
|
56
|
+
*/
|
|
57
|
+
format?: boolean;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* If `format` is set to `true`, sets the indent string
|
|
62
|
+
*
|
|
63
|
+
* Defaults to ` `
|
|
64
|
+
*/
|
|
65
|
+
indentBy?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Give a name to a top-level array
|
|
69
|
+
*
|
|
70
|
+
* Defaults to `undefined`
|
|
71
|
+
*/
|
|
72
|
+
arrayNodeName?: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Create empty tags for tags with no text value
|
|
76
|
+
*
|
|
77
|
+
* Defaults to `false`
|
|
78
|
+
*/
|
|
79
|
+
suppressEmptyNode?: boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Suppress an unpaired tag
|
|
83
|
+
*
|
|
84
|
+
* Defaults to `true`
|
|
85
|
+
*/
|
|
86
|
+
suppressUnpairedNode?: boolean;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Don't put a value for boolean attributes
|
|
90
|
+
*
|
|
91
|
+
* Defaults to `true`
|
|
92
|
+
*/
|
|
93
|
+
suppressBooleanAttributes?: boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Preserve the order of tags in resulting JS object
|
|
97
|
+
*
|
|
98
|
+
* Defaults to `false`
|
|
99
|
+
*/
|
|
100
|
+
preserveOrder?: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List of tags without closing tags
|
|
104
|
+
*
|
|
105
|
+
* Defaults to `[]`
|
|
106
|
+
*/
|
|
107
|
+
unpairedTags?: string[];
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Nodes to stop parsing at
|
|
111
|
+
*
|
|
112
|
+
* Defaults to `[]`
|
|
113
|
+
*/
|
|
114
|
+
stopNodes?: string[];
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
118
|
+
*
|
|
119
|
+
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
120
|
+
* @returns {unknown}
|
|
121
|
+
*
|
|
122
|
+
* 1. Different value or value with different data type to set new value.
|
|
123
|
+
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
124
|
+
*
|
|
125
|
+
* Defaults to `(tagName, val, jPath, hasAttributes, isLeafNode) => val`
|
|
126
|
+
*/
|
|
127
|
+
tagValueProcessor?: (name: string, value: unknown) => unknown;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Control how attribute value should be parsed
|
|
131
|
+
*
|
|
132
|
+
* @param attrName
|
|
133
|
+
* @param attrValue
|
|
134
|
+
* @param jPath
|
|
135
|
+
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
136
|
+
* @returns {unknown}
|
|
137
|
+
*
|
|
138
|
+
* Defaults to `(attrName, val, jPath) => val`
|
|
139
|
+
*/
|
|
140
|
+
attributeValueProcessor?: (name: string, value: unknown) => unknown;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Whether to process default and DOCTYPE entities
|
|
144
|
+
*
|
|
145
|
+
* Defaults to `true`
|
|
146
|
+
*/
|
|
147
|
+
processEntities?: boolean;
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
oneListGroup?: boolean;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export class XMLBuilder {
|
|
154
|
+
constructor(options?: XmlBuilderOptions);
|
|
155
|
+
build(jObj: any): string;
|
|
156
|
+
}
|