data-restructor 3.4.3 → 3.4.4
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/.github/workflows/codeql-analysis.yml +1 -1
- package/.github/workflows/continuous-integration.yaml +1 -1
- package/CHANGELOG.md +36 -1
- package/coverage/datarestructor.js.html +23 -23
- package/coverage/describedfield.js.html +45 -45
- package/coverage/index.html +1 -1
- package/coverage/templateResolver.js.html +1 -1
- package/devdist/datarestructor-ie.js +15 -15
- package/devdist/datarestructor.js +6 -6
- package/devdist/describedfield-ie.js +4 -4
- package/devdist/describedfield.js +3 -3
- package/devdist/templateResolver-ie.js +8 -8
- package/devdist/templateResolver.js +4 -4
- package/dist/datarestructor-ie.js +1 -1
- package/dist/datarestructor-ie.js.map +1 -1
- package/dist/datarestructor.js +1 -1
- package/dist/datarestructor.js.map +1 -1
- package/dist/describedfield-ie.js +1 -1
- package/dist/describedfield-ie.js.map +1 -1
- package/dist/describedfield.js +1 -1
- package/dist/describedfield.js.map +1 -1
- package/dist/templateResolver-ie.js +1 -1
- package/dist/templateResolver-ie.js.map +1 -1
- package/dist/templateResolver.js +1 -1
- package/dist/templateResolver.js.map +1 -1
- package/docs/datarestructor.js.html +1 -1
- package/docs/describedfield.js.html +1 -1
- package/docs/index.html +1 -1
- package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
- package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
- package/docs/module-datarestructor.Restructor.html +1 -1
- package/docs/module-datarestructor.Transform.html +1 -1
- package/docs/module-datarestructor.html +1 -1
- package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
- package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
- package/docs/module-described_field.html +1 -1
- package/docs/module-template_resolver.Resolver.html +1 -1
- package/docs/module-template_resolver.html +1 -1
- package/docs/templateResolver.js.html +1 -1
- package/package.json +11 -11
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
localRequire,
|
|
74
74
|
module,
|
|
75
75
|
module.exports,
|
|
76
|
-
|
|
76
|
+
globalObject
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
this[globalName] = mainExports;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
})({"btK3Z":[function(require,module,exports) {
|
|
145
|
+
})({"btK3Z":[function(require,module,exports,__globalThis) {
|
|
146
146
|
"use strict";
|
|
147
147
|
require("b3504c6476ecf38d");
|
|
148
148
|
require("89ce2effd221e06f");
|
|
@@ -151,7 +151,7 @@ module.exports = {
|
|
|
151
151
|
template_resolver: template_resolver
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
},{"b3504c6476ecf38d":"eZRd3","89ce2effd221e06f":"7uZBC","875b6c9f7bedeb5":"bUhQb"}],"eZRd3":[function(require,module,exports) {
|
|
154
|
+
},{"b3504c6476ecf38d":"eZRd3","89ce2effd221e06f":"7uZBC","875b6c9f7bedeb5":"bUhQb"}],"eZRd3":[function(require,module,exports,__globalThis) {
|
|
155
155
|
//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
|
|
156
156
|
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(Object1, max, min) {
|
|
157
157
|
"use strict";
|
|
@@ -169,16 +169,16 @@ if (!Array.prototype.indexOf) Array.prototype.indexOf = function(Object1, max, m
|
|
|
169
169
|
};
|
|
170
170
|
}(Object, Math.max, Math.min);
|
|
171
171
|
|
|
172
|
-
},{}],"7uZBC":[function(require,module,exports) {
|
|
172
|
+
},{}],"7uZBC":[function(require,module,exports,__globalThis) {
|
|
173
173
|
//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html
|
|
174
174
|
if (!Object.keys) Object.keys = function(o) {
|
|
175
|
-
if (o !== Object(o)) throw new TypeError(
|
|
175
|
+
if (o !== Object(o)) throw new TypeError('Object.keys called on a non-object');
|
|
176
176
|
var k = [], p;
|
|
177
177
|
for(p in o)if (Object.prototype.hasOwnProperty.call(o, p)) k.push(p);
|
|
178
178
|
return k;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
},{}],"bUhQb":[function(require,module,exports) {
|
|
181
|
+
},{}],"bUhQb":[function(require,module,exports,__globalThis) {
|
|
182
182
|
/**
|
|
183
183
|
* @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
|
|
184
184
|
* @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
|
|
@@ -323,7 +323,7 @@ template_resolver.Resolver = function() {
|
|
|
323
323
|
return Resolver;
|
|
324
324
|
}();
|
|
325
325
|
|
|
326
|
-
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports) {
|
|
326
|
+
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports,__globalThis) {
|
|
327
327
|
"use strict";
|
|
328
328
|
/**
|
|
329
329
|
* @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss
|
|
@@ -379,5 +379,5 @@ template_resolver.Resolver = function() {
|
|
|
379
379
|
return result;
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
},{}]},["btK3Z"], "btK3Z", "
|
|
382
|
+
},{}]},["btK3Z"], "btK3Z", "parcelRequire94c2")
|
|
383
383
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
localRequire,
|
|
74
74
|
module,
|
|
75
75
|
module.exports,
|
|
76
|
-
|
|
76
|
+
globalObject
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
this[globalName] = mainExports;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
})({"bUhQb":[function(require,module,exports) {
|
|
145
|
+
})({"bUhQb":[function(require,module,exports,__globalThis) {
|
|
146
146
|
/**
|
|
147
147
|
* @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
|
|
148
148
|
* @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
|
|
@@ -287,7 +287,7 @@ template_resolver.Resolver = function() {
|
|
|
287
287
|
return Resolver;
|
|
288
288
|
}();
|
|
289
289
|
|
|
290
|
-
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports) {
|
|
290
|
+
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports,__globalThis) {
|
|
291
291
|
"use strict";
|
|
292
292
|
/**
|
|
293
293
|
* @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss
|
|
@@ -343,5 +343,5 @@ template_resolver.Resolver = function() {
|
|
|
343
343
|
return result;
|
|
344
344
|
};
|
|
345
345
|
|
|
346
|
-
},{}]},["bUhQb"], "bUhQb", "
|
|
346
|
+
},{}]},["bUhQb"], "bUhQb", "parcelRequire94c2")
|
|
347
347
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=globalThis,t={},r={},i=e.parcelRequirec1f2;null==i&&((i=function(e){if(e in t)return t[e].exports;if(e in r){var i=r[e];delete r[e];var n={id:e,exports:{}};return t[e]=n,i.call(n.exports,n,n.exports),n.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){r[e]=t},e.parcelRequirec1f2=i);var n=i.register;n("dED0n",function(e,t){if(!Array.prototype.indexOf){var r,i,n;Array.prototype.indexOf=(r=Object,i=Math.max,n=Math.min,function(e,t){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=r(this),a=o.length>>>0,s=n(0|t,a);if(s<0)s=i(0,a+s);else if(s>=a)return -1;if(void 0===e){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(e!=e){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===e)return s;return -1})}}),n("b1M0n",function(e,t){Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r})}),n("keJ9m",function(e,t){var r,n=o(n);function o(e){return e||{}}var a=n.exports={};a.internalCreateIfNotExists=o;var s=s||i("ccQZb"),u=u||i("ds403"),l=l||i("aJuQy");a.PropertyStructureDescriptionBuilder=function(){function e(e,i){var n;return o(e)?function(){return e}:i.propertyPatternTemplateMode?(n=i.propertyPattern,function(e){var i=r(n,"{{fieldName}}").exec(e);return i&&""!=i[1]?i[1]:t(e)}):function(e){return t(e)}}function t(e){var t=RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),RegExp(r="^"+(r=r.replace(t,"([-\\w]+)")),"i")}function i(e){var t=RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){var r,i;return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)||(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=(i=this.description.getDisplayNameForPropertyName,function(e){var t;return(t=i(e)).length>1?t.charAt(0).toUpperCase()+t.slice(1):t})),this},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){var e,t;return this.description.matchesPropertyName=o(t=(e=this.description).propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=r(t,RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi")).exec(e)}:function(e){return e===t}:function(){return!1},null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description}}}(),a.DescribedEntryCreator=(r=RegExp("\\[\\d+\\]","gi"),function(e,t){var i=function(e,t){var r,i="",n=[];do(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])));while(r)return{pointDelimited:i,numberArray:n}}(e.name,RegExp("\\[(\\d+)\\]","gi")),n=e.name.replace(r,""),o=new u.Resolver(this);this.category=t.category,this.type=t.type,this.abbreviation=t.abbreviation,this.image=t.image,this.index=i.numberArray,this.displayName=t.getDisplayNameForPropertyName(n),this.fieldName=t.getFieldNameForPropertyName(n),this.value=e.value,this.groupNames=[],this._isMatchingIndex=0==i.pointDelimited.indexOf(t.indexStartsWith),this._description=t,this._identifier={index:i.pointDelimited,propertyNameWithArrayIndices:e.name,propertyNameWithoutArrayIndices:n,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=o.replaceResolvableFields(t.groupPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=o.replaceResolvableFields(t.groupDestinationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=o.replaceResolvableFields(t.deduplicationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}}),a.Transform=function(){function e(e,r){return t(e.category,"")===t(r.category,"")&&t(e.type,"")===t(r.type,"")&&e.fieldName===r.fieldName&&e.value===r.value}function t(e,t){return void 0!==e&&e?e:t}return function(t){this.descriptions=t,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(t){return function(t,r,i){var n,o,u,c,p,d,h,f,g=s.flattenToArray(t);n=g,o=RegExp("\\[\\d+\\]$","gi"),u=[],c="",p="",n.filter(function(e){if(!e.name.match(o)){""!==c&&(u.push({name:c+"_comma_separated_values",value:p}),c=""),u.push(e);return}var t=e.name.replace(o,"");c===t?p+=", "+e.value:(""!==c&&(u.push({name:c+"_comma_separated_values",value:p}),c=""),c=t,p=e.value),u.push(e)}),g=u,i.debugMode&&(console.log("flattened data with array values:"),console.log(g));var m=[];for(f=0;f<r.length;f+=1)d=m,h=function(e,t){var r=RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var o=new a.DescribedEntryCreator(e,t);o._isMatchingIndex&&i.push(o)}}),i}(g,r[f]),m=null==d||0==d.length?h:function(e,t,r){var i,n,o,a=function(e,t){for(var r={},i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)(null==(o=r(n=e[i]))||""===o||null==a[o])&&s.push(n);for(i=0;i<t.length;i+=1)s.push(n=t[i]);return s}(d,h,function(e){return e._identifier.deduplicationId});return g=m,i.debugMode&&(console.log("describedData data:"),console.log(g)),g=function(e,t,r){for(var i={},n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(g,function(e){return e._identifier.groupId},function(e){return e._description.groupName}),i.debugMode&&(console.log("grouped describedData data:"),console.log(g)),g=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(g),i.debugMode&&(console.log("moved grouped describedData data:"),console.log(g)),g=function(t,r){var i,n=[];for(i=0;i<t.length;i+=1)n.push(function t(r,i){var n=new l.DescribedDataFieldBuilder().category(r.category).type(r.type).abbreviation(r.abbreviation).image(r.image).index(r.index).displayName(r.displayName).fieldName(r.fieldName).value(r.value).build();if(i.recursionDepth>i.config.maxRecursionDepth)return n;var o=null,a="",s=new l.DescribedDataFieldGroup(n);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(i=0,n=e.groupNames[r];i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(r,function(r,n,u){if(i.groupToSkip===r){i.config.debugMode&&console.log("Removed duplicate group "+r+" at recursion depth "+i.recursionDepth);return}a="",i.recursionDepth>=i.config.removeDuplicationAboveRecursionDepth&&(a=!function(e,t,r){if(e===t)return!0;if(null==e||null==t||e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(n[r],u,e)?"":r),o={recursionDepth:i.recursionDepth+1,config:i.config,groupToSkip:a},s.addGroupEntry(r,t(n,o))}),n}(t[i],{recursionDepth:0,config:r,groupToSkip:""}));return n}(g=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=e[r[i]];t.push(n)}return t}(g),i),i.debugMode&&(console.log("transformed result:"),console.log(g)),g}(t,this.descriptions,this.config)}}}(),a.Restructor={},a.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new a.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)}}),n("ccQZb",function(e,t){(($8e2fb4eb18d4597b$var$module||{}).exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),function e(i,n,o){if(!(o>t)&&"function"!=typeof i){if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}}(e,"",0),r}}),n("ds403",function(e,t){var r,n=o(n);function o(e){return e||{}}var a=n.exports={};a.internalCreateIfNotExists=o;var s=s||i("ccQZb");a.Resolver=(r=RegExp("\\[\\d+\\]","gi"),function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var t,i,n,o,a=Object.keys(e);for(t=0;t<a.length;t+=1)o=e[i=a[t]],"fieldName"===(n=function(e){var t=e.lastIndexOf("."),i=e;t>0&&(i=e.substr(t+1));var n="";t>0&&(n=e.substr(0,t+1));var o=n.replace(r,"");return{group:n,groupWithoutArrayIndices:o,name:i}}(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},r=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)(function(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value)})(s.flattenToArray(arguments[e],3),t,r);return t},this.replaceResolvableFields=function(e,t){var r=e,i=Object.keys(t),n=0,o="",a="";for(n=0;n<i.length;n+=1)a=t[o=i[n]],r=r.replace("{{"+o+"}}",a);return r}})}),n("aJuQy",function(e,t){var r=i(r);function i(e){return e||{}}var n=r.exports={};n.internalCreateIfNotExists=i,n.DescribedDataFieldBuilder=function(){function e(e,t){return"string"==typeof e&&null!==e&&""!==e?e:t}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){var t;return this.describedField.index=(t=[],null==e?t:e),this},this.groupNames=function(e){var t;return this.describedField.groupNames=(t=[],null==e?t:e),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),n.copyWithoutGroups=function(e){return new n.DescribedDataFieldBuilder().fromDescribedDataField(e).groupNames([]).build()},n.DescribedDataFieldGroup=function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){var r,i;if(!e||0===e.length||!t||0===t.length)return this;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.filter||(Array.prototype.filter=function(e,t){if(!(("Function"==typeof e||"function"==typeof e)&&this))throw TypeError();var r,i=this.length>>>0,n=Array(i),o=0,a=-1;if(void 0===t)for(;++a!==i;)a in this&&(r=this[a],e(this[a],a,this)&&(n[o++]=r));else for(;++a!==i;)a in this&&(r=this[a],e.call(t,this[a],a,this)&&(n[o++]=r));return n.length=o,n}),i("dED0n"),i("b1M0n");var o=i("keJ9m");module.exports={datarestructor:o};
|
|
1
|
+
var e=globalThis,t={},r={},i=e.parcelRequire94c2;null==i&&((i=function(e){if(e in t)return t[e].exports;if(e in r){var i=r[e];delete r[e];var n={id:e,exports:{}};return t[e]=n,i.call(n.exports,n,n.exports),n.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){r[e]=t},e.parcelRequire94c2=i);var n=i.register;n("dED0n",function(e,t){if(!Array.prototype.indexOf){var r,i,n;Array.prototype.indexOf=(r=Object,i=Math.max,n=Math.min,function(e,t){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=r(this),a=o.length>>>0,s=n(0|t,a);if(s<0)s=i(0,a+s);else if(s>=a)return -1;if(void 0===e){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(e!=e){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===e)return s;return -1})}}),n("b1M0n",function(e,t){Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r})}),n("keJ9m",function(e,t){var r,n=o(n);function o(e){return e||{}}var a=n.exports={};a.internalCreateIfNotExists=o;var s=s||i("ccQZb"),u=u||i("ds403"),l=l||i("aJuQy");a.PropertyStructureDescriptionBuilder=function(){function e(e,i){var n;return o(e)?function(){return e}:i.propertyPatternTemplateMode?(n=i.propertyPattern,function(e){var i=r(n,"{{fieldName}}").exec(e);return i&&""!=i[1]?i[1]:t(e)}):function(e){return t(e)}}function t(e){var t=RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),RegExp(r="^"+(r=r.replace(t,"([-\\w]+)")),"i")}function i(e){var t=RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){var r,i;return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)||(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=(i=this.description.getDisplayNameForPropertyName,function(e){var t;return(t=i(e)).length>1?t.charAt(0).toUpperCase()+t.slice(1):t})),this},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){var e,t;return this.description.matchesPropertyName=o(t=(e=this.description).propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=r(t,RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi")).exec(e)}:function(e){return e===t}:function(){return!1},null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description}}}(),a.DescribedEntryCreator=(r=RegExp("\\[\\d+\\]","gi"),function(e,t){var i=function(e,t){var r,i="",n=[];do(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])));while(r)return{pointDelimited:i,numberArray:n}}(e.name,RegExp("\\[(\\d+)\\]","gi")),n=e.name.replace(r,""),o=new u.Resolver(this);this.category=t.category,this.type=t.type,this.abbreviation=t.abbreviation,this.image=t.image,this.index=i.numberArray,this.displayName=t.getDisplayNameForPropertyName(n),this.fieldName=t.getFieldNameForPropertyName(n),this.value=e.value,this.groupNames=[],this._isMatchingIndex=0==i.pointDelimited.indexOf(t.indexStartsWith),this._description=t,this._identifier={index:i.pointDelimited,propertyNameWithArrayIndices:e.name,propertyNameWithoutArrayIndices:n,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=o.replaceResolvableFields(t.groupPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=o.replaceResolvableFields(t.groupDestinationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=o.replaceResolvableFields(t.deduplicationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}}),a.Transform=function(){function e(e,r){return t(e.category,"")===t(r.category,"")&&t(e.type,"")===t(r.type,"")&&e.fieldName===r.fieldName&&e.value===r.value}function t(e,t){return void 0!==e&&e?e:t}return function(t){this.descriptions=t,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(t){return function(t,r,i){var n,o,u,c,p,d,h,f,g=s.flattenToArray(t);n=g,o=RegExp("\\[\\d+\\]$","gi"),u=[],c="",p="",n.filter(function(e){if(!e.name.match(o)){""!==c&&(u.push({name:c+"_comma_separated_values",value:p}),c=""),u.push(e);return}var t=e.name.replace(o,"");c===t?p+=", "+e.value:(""!==c&&(u.push({name:c+"_comma_separated_values",value:p}),c=""),c=t,p=e.value),u.push(e)}),g=u,i.debugMode&&(console.log("flattened data with array values:"),console.log(g));var m=[];for(f=0;f<r.length;f+=1)d=m,h=function(e,t){var r=RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var o=new a.DescribedEntryCreator(e,t);o._isMatchingIndex&&i.push(o)}}),i}(g,r[f]),m=null==d||0==d.length?h:function(e,t,r){var i,n,o,a=function(e,t){for(var r={},i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)(null==(o=r(n=e[i]))||""===o||null==a[o])&&s.push(n);for(i=0;i<t.length;i+=1)s.push(n=t[i]);return s}(d,h,function(e){return e._identifier.deduplicationId});return g=m,i.debugMode&&(console.log("describedData data:"),console.log(g)),g=function(e,t,r){for(var i={},n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(g,function(e){return e._identifier.groupId},function(e){return e._description.groupName}),i.debugMode&&(console.log("grouped describedData data:"),console.log(g)),g=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(g),i.debugMode&&(console.log("moved grouped describedData data:"),console.log(g)),g=function(t,r){var i,n=[];for(i=0;i<t.length;i+=1)n.push(function t(r,i){var n=new l.DescribedDataFieldBuilder().category(r.category).type(r.type).abbreviation(r.abbreviation).image(r.image).index(r.index).displayName(r.displayName).fieldName(r.fieldName).value(r.value).build();if(i.recursionDepth>i.config.maxRecursionDepth)return n;var o=null,a="",s=new l.DescribedDataFieldGroup(n);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(i=0,n=e.groupNames[r];i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(r,function(r,n,u){if(i.groupToSkip===r){i.config.debugMode&&console.log("Removed duplicate group "+r+" at recursion depth "+i.recursionDepth);return}a="",i.recursionDepth>=i.config.removeDuplicationAboveRecursionDepth&&(a=!function(e,t,r){if(e===t)return!0;if(null==e||null==t||e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(n[r],u,e)?"":r),o={recursionDepth:i.recursionDepth+1,config:i.config,groupToSkip:a},s.addGroupEntry(r,t(n,o))}),n}(t[i],{recursionDepth:0,config:r,groupToSkip:""}));return n}(g=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=e[r[i]];t.push(n)}return t}(g),i),i.debugMode&&(console.log("transformed result:"),console.log(g)),g}(t,this.descriptions,this.config)}}}(),a.Restructor={},a.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new a.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)}}),n("ccQZb",function(e,t){var r=r||{};(r.exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),function e(i,n,o){if(!(o>t)&&"function"!=typeof i){if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}}(e,"",0),r}}),n("ds403",function(e,t){var r,n=o(n);function o(e){return e||{}}var a=n.exports={};a.internalCreateIfNotExists=o;var s=s||i("ccQZb");a.Resolver=(r=RegExp("\\[\\d+\\]","gi"),function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var t,i,n,o,a=Object.keys(e);for(t=0;t<a.length;t+=1)o=e[i=a[t]],"fieldName"===(n=function(e){var t=e.lastIndexOf("."),i=e;t>0&&(i=e.substr(t+1));var n="";t>0&&(n=e.substr(0,t+1));var o=n.replace(r,"");return{group:n,groupWithoutArrayIndices:o,name:i}}(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},r=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)(function(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value)})(s.flattenToArray(arguments[e],3),t,r);return t},this.replaceResolvableFields=function(e,t){var r=e,i=Object.keys(t),n=0,o="",a="";for(n=0;n<i.length;n+=1)a=t[o=i[n]],r=r.replace("{{"+o+"}}",a);return r}})}),n("aJuQy",function(e,t){var r=i(r);function i(e){return e||{}}var n=r.exports={};n.internalCreateIfNotExists=i,n.DescribedDataFieldBuilder=function(){function e(e,t){return"string"==typeof e&&null!==e&&""!==e?e:t}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){var t;return this.describedField.index=(t=[],null==e?t:e),this},this.groupNames=function(e){var t;return this.describedField.groupNames=(t=[],null==e?t:e),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),n.copyWithoutGroups=function(e){return new n.DescribedDataFieldBuilder().fromDescribedDataField(e).groupNames([]).build()},n.DescribedDataFieldGroup=function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){var r,i;if(!e||0===e.length||!t||0===t.length)return this;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.filter||(Array.prototype.filter=function(e,t){if(!(("Function"==typeof e||"function"==typeof e)&&this))throw TypeError();var r,i=this.length>>>0,n=Array(i),o=0,a=-1;if(void 0===t)for(;++a!==i;)a in this&&(r=this[a],e(this[a],a,this)&&(n[o++]=r));else for(;++a!==i;)a in this&&(r=this[a],e.call(t,this[a],a,this)&&(n[o++]=r));return n.length=o,n}),i("dED0n"),i("b1M0n");var o=i("keJ9m");module.exports={datarestructor:o};
|
|
2
2
|
//# sourceMappingURL=datarestructor-ie.js.map
|