data-restructor 3.4.3 → 3.4.5
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/.auto-changelog-template.hbs +1 -1
- package/.github/workflows/codeql-analysis.yml +6 -6
- package/.github/workflows/continuous-integration.yaml +11 -11
- package/.nvmrc +1 -0
- package/CHANGELOG.md +71 -1
- package/CONTRIBUTING.md +3 -3
- package/README.md +25 -25
- package/coverage/datarestructor.js.html +133 -133
- package/coverage/describedfield.js.html +45 -45
- package/coverage/index.html +1 -1
- package/coverage/templateResolver.js.html +26 -26
- package/devdist/datarestructor-ie.js +86 -21
- package/devdist/datarestructor.js +77 -12
- package/devdist/describedfield-ie.js +75 -10
- package/devdist/describedfield.js +74 -9
- package/devdist/templateResolver-ie.js +79 -14
- package/devdist/templateResolver.js +75 -10
- 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 +26 -26
- 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/merger-config.json +2 -2
- package/package.json +12 -12
|
@@ -6,7 +6,16 @@
|
|
|
6
6
|
// anything defined in a previous bundle is accessed via the
|
|
7
7
|
// orig method which is the require for previous bundles
|
|
8
8
|
|
|
9
|
-
(function (
|
|
9
|
+
(function (
|
|
10
|
+
modules,
|
|
11
|
+
entry,
|
|
12
|
+
mainEntry,
|
|
13
|
+
parcelRequireName,
|
|
14
|
+
externals,
|
|
15
|
+
distDir,
|
|
16
|
+
publicUrl,
|
|
17
|
+
devServer
|
|
18
|
+
) {
|
|
10
19
|
/* eslint-disable no-undef */
|
|
11
20
|
var globalObject =
|
|
12
21
|
typeof globalThis !== 'undefined'
|
|
@@ -25,6 +34,7 @@
|
|
|
25
34
|
typeof globalObject[parcelRequireName] === 'function' &&
|
|
26
35
|
globalObject[parcelRequireName];
|
|
27
36
|
|
|
37
|
+
var importMap = previousRequire.i || {};
|
|
28
38
|
var cache = previousRequire.cache || {};
|
|
29
39
|
// Do not use `require` to prevent Webpack from trying to bundle this call
|
|
30
40
|
var nodeRequire =
|
|
@@ -35,6 +45,9 @@
|
|
|
35
45
|
function newRequire(name, jumped) {
|
|
36
46
|
if (!cache[name]) {
|
|
37
47
|
if (!modules[name]) {
|
|
48
|
+
if (externals[name]) {
|
|
49
|
+
return externals[name];
|
|
50
|
+
}
|
|
38
51
|
// if we cannot find the module within our internal map or
|
|
39
52
|
// cache jump to the current global require ie. the last bundle
|
|
40
53
|
// that was added to the page.
|
|
@@ -73,7 +86,7 @@
|
|
|
73
86
|
localRequire,
|
|
74
87
|
module,
|
|
75
88
|
module.exports,
|
|
76
|
-
|
|
89
|
+
globalObject
|
|
77
90
|
);
|
|
78
91
|
}
|
|
79
92
|
|
|
@@ -81,7 +94,54 @@
|
|
|
81
94
|
|
|
82
95
|
function localRequire(x) {
|
|
83
96
|
var res = localRequire.resolve(x);
|
|
84
|
-
|
|
97
|
+
if (res === false) {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
// Synthesize a module to follow re-exports.
|
|
101
|
+
if (Array.isArray(res)) {
|
|
102
|
+
var m = {__esModule: true};
|
|
103
|
+
res.forEach(function (v) {
|
|
104
|
+
var key = v[0];
|
|
105
|
+
var id = v[1];
|
|
106
|
+
var exp = v[2] || v[0];
|
|
107
|
+
var x = newRequire(id);
|
|
108
|
+
if (key === '*') {
|
|
109
|
+
Object.keys(x).forEach(function (key) {
|
|
110
|
+
if (
|
|
111
|
+
key === 'default' ||
|
|
112
|
+
key === '__esModule' ||
|
|
113
|
+
Object.prototype.hasOwnProperty.call(m, key)
|
|
114
|
+
) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Object.defineProperty(m, key, {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () {
|
|
121
|
+
return x[key];
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
} else if (exp === '*') {
|
|
126
|
+
Object.defineProperty(m, key, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
value: x,
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
Object.defineProperty(m, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
if (exp === 'default') {
|
|
135
|
+
return x.__esModule ? x.default : x;
|
|
136
|
+
}
|
|
137
|
+
return x[exp];
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return m;
|
|
143
|
+
}
|
|
144
|
+
return newRequire(res);
|
|
85
145
|
}
|
|
86
146
|
|
|
87
147
|
function resolve(x) {
|
|
@@ -93,6 +153,7 @@
|
|
|
93
153
|
function Module(moduleName) {
|
|
94
154
|
this.id = moduleName;
|
|
95
155
|
this.bundle = newRequire;
|
|
156
|
+
this.require = nodeRequire;
|
|
96
157
|
this.exports = {};
|
|
97
158
|
}
|
|
98
159
|
|
|
@@ -101,6 +162,10 @@
|
|
|
101
162
|
newRequire.modules = modules;
|
|
102
163
|
newRequire.cache = cache;
|
|
103
164
|
newRequire.parent = previousRequire;
|
|
165
|
+
newRequire.distDir = distDir;
|
|
166
|
+
newRequire.publicUrl = publicUrl;
|
|
167
|
+
newRequire.devServer = devServer;
|
|
168
|
+
newRequire.i = importMap;
|
|
104
169
|
newRequire.register = function (id, exports) {
|
|
105
170
|
modules[id] = [
|
|
106
171
|
function (require, module) {
|
|
@@ -110,6 +175,10 @@
|
|
|
110
175
|
];
|
|
111
176
|
};
|
|
112
177
|
|
|
178
|
+
// Only insert newRequire.load when it is actually used.
|
|
179
|
+
// The code in this file is linted against ES5, so dynamic import is not allowed.
|
|
180
|
+
// INSERT_LOAD_HERE
|
|
181
|
+
|
|
113
182
|
Object.defineProperty(newRequire, 'root', {
|
|
114
183
|
get: function () {
|
|
115
184
|
return globalObject[parcelRequireName];
|
|
@@ -136,13 +205,9 @@
|
|
|
136
205
|
define(function () {
|
|
137
206
|
return mainExports;
|
|
138
207
|
});
|
|
139
|
-
|
|
140
|
-
// <script>
|
|
141
|
-
} else if (globalName) {
|
|
142
|
-
this[globalName] = mainExports;
|
|
143
208
|
}
|
|
144
209
|
}
|
|
145
|
-
})({"bUhQb":[function(require,module,exports) {
|
|
210
|
+
})({"bUhQb":[function(require,module,exports,__globalThis) {
|
|
146
211
|
/**
|
|
147
212
|
* @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
|
|
148
213
|
* @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
|
|
@@ -287,7 +352,7 @@ template_resolver.Resolver = function() {
|
|
|
287
352
|
return Resolver;
|
|
288
353
|
}();
|
|
289
354
|
|
|
290
|
-
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports) {
|
|
355
|
+
},{"cbde56e74c44f93f":"4biBi"}],"4biBi":[function(require,module,exports,__globalThis) {
|
|
291
356
|
"use strict";
|
|
292
357
|
/**
|
|
293
358
|
* @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss
|
|
@@ -343,5 +408,5 @@ template_resolver.Resolver = function() {
|
|
|
343
408
|
return result;
|
|
344
409
|
};
|
|
345
410
|
|
|
346
|
-
},{}]},["bUhQb"], "bUhQb", "parcelRequirec1f2")
|
|
411
|
+
},{}]},["bUhQb"], "bUhQb", "parcelRequirec1f2", {})
|
|
347
412
|
|
|
@@ -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 $parcel$global=globalThis,$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequirec1f2;null==parcelRequire&&((parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var r={id:e,exports:{}};return $parcel$modules[e]=r,t.call(r.exports,r,r.exports),r.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequirec1f2=parcelRequire);"use strict";var parcelRegister=parcelRequire.register;parcelRegister("dED0n",function(e,t){var r,i,n;Array.prototype.indexOf||(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}))}),parcelRegister("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})}),parcelRegister("keJ9m",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb"),s=s||parcelRequire("ds403"),u=u||parcelRequire("aJuQy");o.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}}}(),r=RegExp("\\[\\d+\\]","gi"),o.DescribedEntryCreator=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 s.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)}},o.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,s,l,c,p,d,h,f,g=a.flattenToArray(t);n=g,s=RegExp("\\[\\d+\\]$","gi"),l=[],c="",p="",n.filter(function(e){if(!e.name.match(s)){""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),l.push(e);return}var t=e.name.replace(s,"");c===t?p+=", "+e.value:(""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),c=t,p=e.value),l.push(e)}),g=l,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 a=new o.DescribedEntryCreator(e,t);a._isMatchingIndex&&i.push(a)}}),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 u.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 u.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)}}}(),o.Restructor={},o.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new o.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)}}),parcelRegister("ccQZb",function(e,t){"use strict";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}}),parcelRegister("ds403",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb");r=RegExp("\\[\\d+\\]","gi"),o.Resolver=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)}(a.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}}}),parcelRegister("aJuQy",function(e,t){"use strict";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,r;return this.describedField.index=(r=[],null==(t=e)?r:t),this},this.groupNames=function(e){var t,r;return this.describedField.groupNames=(r=[],null==(t=e)?r:t),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){"use strict";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}),parcelRequire("dED0n"),parcelRequire("b1M0n");var $keJ9m=parcelRequire("keJ9m");module.exports={datarestructor:$keJ9m};
|
|
2
2
|
//# sourceMappingURL=datarestructor-ie.js.map
|