data-restructor 3.4.2 → 3.4.3

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.
Files changed (43) hide show
  1. package/.github/workflows/codeql-analysis.yml +4 -4
  2. package/.github/workflows/continuous-integration.yaml +15 -11
  3. package/CHANGELOG.md +3 -1
  4. package/coverage/coverage-summary.json +4 -4
  5. package/coverage/datarestructor.js.html +137 -137
  6. package/coverage/describedfield.js.html +45 -45
  7. package/coverage/index.html +6 -6
  8. package/coverage/templateResolver.js.html +26 -26
  9. package/devdist/datarestructor-ie.js +10 -10
  10. package/devdist/datarestructor.js +5 -5
  11. package/devdist/describedfield-ie.js +3 -3
  12. package/devdist/describedfield.js +2 -2
  13. package/devdist/templateResolver-ie.js +6 -6
  14. package/devdist/templateResolver.js +3 -3
  15. package/dist/datarestructor-ie.js +1 -693
  16. package/dist/datarestructor-ie.js.map +1 -1
  17. package/dist/datarestructor.js +1 -687
  18. package/dist/datarestructor.js.map +1 -1
  19. package/dist/describedfield-ie.js +1 -142
  20. package/dist/describedfield-ie.js.map +1 -1
  21. package/dist/describedfield.js +1 -142
  22. package/dist/describedfield.js.map +1 -1
  23. package/dist/templateResolver-ie.js +1 -82
  24. package/dist/templateResolver-ie.js.map +1 -1
  25. package/dist/templateResolver.js +1 -76
  26. package/dist/templateResolver.js.map +1 -1
  27. package/docs/datarestructor.js.html +1 -1
  28. package/docs/describedfield.js.html +1 -1
  29. package/docs/index.html +1 -1
  30. package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
  31. package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
  32. package/docs/module-datarestructor.Restructor.html +1 -1
  33. package/docs/module-datarestructor.Transform.html +1 -1
  34. package/docs/module-datarestructor.html +1 -1
  35. package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
  36. package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
  37. package/docs/module-described_field.html +1 -1
  38. package/docs/module-template_resolver.Resolver.html +1 -1
  39. package/docs/module-template_resolver.html +1 -1
  40. package/docs/templateResolver.js.html +1 -1
  41. package/eslint.config.js +15 -0
  42. package/package.json +11 -10
  43. package/.eslintrc.json +0 -13
@@ -1,83 +1,2 @@
1
- var e=globalThis,r={},t={},n=e.parcelRequirec1f2;null==n&&((n=function(e){if(e in r)return r[e].exports;if(e in t){var n=t[e];delete t[e];var o={id:e,exports:{}};return r[e]=o,n.call(o.exports,o,o.exports),o.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,r){t[e]=r},e.parcelRequirec1f2=n);var o=n.register;o("3kxfc",function(e,r){//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
2
- if(!Array.prototype.indexOf){var t,n,o;Array.prototype.indexOf=(t=Object,n=Math.max,o=Math.min,function(e,r){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var i=t(this),a=i.length>>>0,f=o(0|r,a);if(f<0)f=n(0,a+f);else if(f>=a)return -1;if(void 0===e){for(;f!==a;++f)if(void 0===i[f]&&f in i)return f;// undefined
3
- }else if(e!=e){for(;f!==a;++f)if(i[f]!=i[f])return f;// NaN
4
- }else for(;f!==a;++f)if(i[f]===e)return f;// all else
5
- return -1;// if the value was not found, then return -1
6
- })}}),o("26y7f",function(e,r){//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html
7
- Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var r,t=[];for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t})}),o("8ZIyB",function(e,r){var t,o=i(o);// Fallback for vanilla js without modules
8
- function i(e){return e||{}}/**
9
- * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
10
- * @module template_resolver
11
- */var a=o.exports={};// Export module for npm...
12
- a.internalCreateIfNotExists=i;var f=f||n("7HmuL");// supports vanilla js & npm
13
- a.Resolver=(t=RegExp("\\[\\d+\\]","gi"),/**
14
- * Resolver. Is used inside this repository. It could also be used outside.
15
- * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.
16
- * @constructs Resolver
17
- * @alias module:template_resolver.Resolver
18
- */function(e){/**
19
- * The properties of this source data object will be used to replace the placeholders in the template.
20
- */this.sourceDataObject=e,/**
21
- * Resolves the given template.
22
- *
23
- * The template may contain variables in double curly brackets.
24
- * Supported variables are all properties of this object, e.g. "{{fieldName}}", "{{displayName}}", "{{value}}".
25
- * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. "{{summaries[0].value}}"
26
- * Parts of the index can be inserted by using e.g. "{{index[1]}}".
27
- *
28
- * @param {string} template
29
- * @returns {string} resolved template
30
- */this.resolveTemplate=function(e){return this.replaceResolvableFields(e,/**
31
- * Adds the value of the "fieldName" property (including its group prefix) and its associated "value" property content.
32
- * For example: detail[2].fieldName="name", detail[2].value="Smith" lead to the additional property detail.name="Smith".
33
- * @param {object} object with resolvable field names and their values.
34
- * @returns {object} object with resolvable field names and their values.
35
- * @protected
36
- * @memberof module:template_resolver.Resolver
37
- */function(e){var r,n,o,i,a=Object.keys(e);for(r=0;r<a.length;r+=1)i=e[n=a[r]],"fieldName"===(o=/**
38
- * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.
39
- * @param {String} fullPropertyName
40
- * @returns {Object} Contains "group" (empty or group name including trailing separator "."), "groupWithoutArrayIndices" and "name" (property name).
41
- * @protected
42
- * @memberof module:template_resolver.Resolver
43
- */function(e){var r=e.lastIndexOf("."),n=e;r>0&&(n=e.substr(r+1));var o="";r>0&&(o=e.substr(0,r+1));//includes the trailing ".".
44
- var i=o.replace(t,"");return{group:o,groupWithoutArrayIndices:i,name:n}}(n)).name&&"fieldName"!==i&&(e[o.groupWithoutArrayIndices+i]=e[o.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},/**
45
- * Returns a map like object, that contains all resolvable fields and their values as properties.
46
- * This function takes a variable count of input parameters,
47
- * each containing an object that contains resolvable fields to extract from.
48
- *
49
- * The recursion depth is limited to 3, so that an object,
50
- * that contains an object can contain another object (but not further).
51
- *
52
- * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.
53
- *
54
- * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.
55
- * @returns {object} object with resolvable field names and their values.
56
- * @public
57
- */this.resolvableFieldsOfAll=function(){var e,r={},t=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)/**
58
- * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).
59
- * Example: `{name: "accountNumber", value: "12345"}` becomes `mapObject["accountNumber"]="12345"`.
60
- *
61
- * @param {NameValuePair[]} elements flattened array of name-value-pairs
62
- * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.
63
- * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).
64
- * @protected
65
- * @memberof module:template_resolver.Resolver
66
- */(function(e,r,t){var n,o;for(n=0;n<e.length;n+=1)o=e[n],"function"==typeof t&&t(o.name)&&(r[o.name]=o.value)})(f.flattenToArray(arguments[e],3),r,t);return r},/**
67
- * Replaces all variables in double curly brackets, e.g. {{property}},
68
- * with the value of that property from the resolvableProperties.
69
- *
70
- * Supported property types: string, number, boolean
71
- * @param {string} stringContainingVariables
72
- * @param {object[]} resolvableFields (name=value)
73
- */this.replaceResolvableFields=function(e,r){var t=e,n=Object.keys(r),o=0,i="",a="";for(o=0;o<n.length;o+=1)a=r[i=n[o]],t=t.replace("{{"+i+"}}",a);return t}})}),o("7HmuL",function(e,r){/**
74
- * @typedef {Object} NameValuePair
75
- * @property {string} name - point separated names of the flattened main and sub properties, e.g. "responses[2].hits.hits[4]._source.name".
76
- * @property {string} value - value of the property
77
- *//**
78
- * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.
79
- * @param {number} maxRecursionDepth
80
- * @returns {NameValuePair[]} array of property name and value pairs
81
- */(($59adffa3db62607f$var$module||{}).exports={}).flattenToArray=function(e,r){var t=[];return("number"!=typeof r||r<1)&&(r=20),function e(n,o,i){if(!(i>r)&&"function"!=typeof n){if(Object(n)!==n)t.push({name:o,value:n});else if(Array.isArray(n)){var a,f=n.length;for(a=0;a<f;a+=1)e(n[a],o+"["+a+"]",i+1);0===f&&(t[o]=[],t.push({name:o,value:""}))}else{var l,u=!0;for(l in n)u=!1,e(n[l],o?o+"."+l:l,i+1);u&&o&&t.push({name:o,value:""})}}}(e,"",0),t}}),n("3kxfc"),n("26y7f");var i=n("8ZIyB");module.exports={template_resolver:i};//# sourceMappingURL=templateResolver-ie.js.map
82
-
1
+ var e=globalThis,r={},t={},n=e.parcelRequirec1f2;null==n&&((n=function(e){if(e in r)return r[e].exports;if(e in t){var n=t[e];delete t[e];var o={id:e,exports:{}};return r[e]=o,n.call(o.exports,o,o.exports),o.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,r){t[e]=r},e.parcelRequirec1f2=n);var o=n.register;o("dED0n",function(e,r){if(!Array.prototype.indexOf){var t,n,o;Array.prototype.indexOf=(t=Object,n=Math.max,o=Math.min,function(e,r){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var i=t(this),a=i.length>>>0,l=o(0|r,a);if(l<0)l=n(0,a+l);else if(l>=a)return -1;if(void 0===e){for(;l!==a;++l)if(void 0===i[l]&&l in i)return l}else if(e!=e){for(;l!==a;++l)if(i[l]!=i[l])return l}else for(;l!==a;++l)if(i[l]===e)return l;return -1})}}),o("b1M0n",function(e,r){Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var r,t=[];for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t})}),o("ds403",function(e,r){var t,o=i(o);function i(e){return e||{}}var a=o.exports={};a.internalCreateIfNotExists=i;var l=l||n("ccQZb");a.Resolver=(t=RegExp("\\[\\d+\\]","gi"),function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var r,n,o,i,a=Object.keys(e);for(r=0;r<a.length;r+=1)i=e[n=a[r]],"fieldName"===(o=function(e){var r=e.lastIndexOf("."),n=e;r>0&&(n=e.substr(r+1));var o="";r>0&&(o=e.substr(0,r+1));var i=o.replace(t,"");return{group:o,groupWithoutArrayIndices:i,name:n}}(n)).name&&"fieldName"!==i&&(e[o.groupWithoutArrayIndices+i]=e[o.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,r={},t=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)(function(e,r,t){var n,o;for(n=0;n<e.length;n+=1)o=e[n],"function"==typeof t&&t(o.name)&&(r[o.name]=o.value)})(l.flattenToArray(arguments[e],3),r,t);return r},this.replaceResolvableFields=function(e,r){var t=e,n=Object.keys(r),o=0,i="",a="";for(o=0;o<n.length;o+=1)a=r[i=n[o]],t=t.replace("{{"+i+"}}",a);return t}})}),o("ccQZb",function(e,r){(($8e2fb4eb18d4597b$var$module||{}).exports={}).flattenToArray=function(e,r){var t=[];return("number"!=typeof r||r<1)&&(r=20),function e(n,o,i){if(!(i>r)&&"function"!=typeof n){if(Object(n)!==n)t.push({name:o,value:n});else if(Array.isArray(n)){var a,l=n.length;for(a=0;a<l;a+=1)e(n[a],o+"["+a+"]",i+1);0===l&&(t[o]=[],t.push({name:o,value:""}))}else{var f,u=!0;for(f in n)u=!1,e(n[f],o?o+"."+f:f,i+1);u&&o&&t.push({name:o,value:""})}}}(e,"",0),t}}),n("dED0n"),n("b1M0n");var i=n("ds403");module.exports={template_resolver:i};
83
2
  //# sourceMappingURL=templateResolver-ie.js.map
@@ -1 +1 @@
1
- {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I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templateResolver-ie.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"3kxfc\", function(module, exports) {\n//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill\nif (!Array.prototype.indexOf) Array.prototype.indexOf = function(Object1, max, min) {\n \"use strict\";\n return function indexOf(member, fromIndex) {\n if (this === null || this === undefined) throw TypeError(\"Array.prototype.indexOf called on null or undefined\");\n var that = Object1(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);\n if (i < 0) i = max(0, Len + i);\n else if (i >= Len) return -1;\n if (member === void 0) {\n for(; i !== Len; ++i)if (that[i] === void 0 && i in that) return i; // undefined\n } else if (member !== member) {\n for(; i !== Len; ++i)if (that[i] !== that[i]) return i; // NaN\n } else for(; i !== Len; ++i)if (that[i] === member) return i; // all else\n return -1; // if the value was not found, then return -1\n };\n}(Object, Math.max, Math.min);\n\n});\n\nparcelRegister(\"26y7f\", function(module, exports) {\n//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html\nif (!Object.keys) Object.keys = function(o) {\n if (o !== Object(o)) throw new TypeError(\"Object.keys called on a non-object\");\n var k = [], p;\n for(p in o)if (Object.prototype.hasOwnProperty.call(o, p)) k.push(p);\n return k;\n};\n\n});\n\nparcelRegister(\"8ZIyB\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $68c6955ebe469375$var$module = $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists($68c6955ebe469375$var$module); // Fallback for vanilla js without modules\nfunction $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $68c6955ebe469375$var$template_resolver = $68c6955ebe469375$var$module.exports = {}; // Export module for npm...\n$68c6955ebe469375$var$template_resolver.internalCreateIfNotExists = $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists;\n\nvar $68c6955ebe469375$var$internal_object_tools = $68c6955ebe469375$var$internal_object_tools || (parcelRequire(\"7HmuL\")); // supports vanilla js & npm\n$68c6955ebe469375$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($68c6955ebe469375$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"7HmuL\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $59adffa3db62607f$var$module = $59adffa3db62607f$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $59adffa3db62607f$var$internal_object_tools = $59adffa3db62607f$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $59adffa3db62607f$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\"use strict\";\nparcelRequire(\"3kxfc\");\nparcelRequire(\"26y7f\");\n\nvar $8ZIyB = parcelRequire(\"8ZIyB\");\nmodule.exports = {\n template_resolver: $8ZIyB\n};\n\n\n//# sourceMappingURL=templateResolver-ie.js.map\n","//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill\nif (!Array.prototype.indexOf) Array.prototype.indexOf = (function(Object, max, min){\n \"use strict\";\n return function indexOf(member, fromIndex) {\n if(this===null||this===undefined)throw TypeError(\"Array.prototype.indexOf called on null or undefined\");\n \n var that = Object(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);\n if (i < 0) i = max(0, Len+i); else if (i >= Len) return -1;\n \n if(member===void 0){ for(; i !== Len; ++i) if(that[i]===void 0 && i in that) return i; // undefined\n }else if(member !== member){ for(; i !== Len; ++i) if(that[i] !== that[i]) return i; // NaN\n }else for(; i !== Len; ++i) if(that[i] === member) return i; // all else\n \n return -1; // if the value was not found, then return -1\n };\n })(Object, Math.max, Math.min);","//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html\nif (!Object.keys) Object.keys = function(o) {\n if (o !== Object(o))\n throw new TypeError('Object.keys called on a non-object');\n var k=[],p;\n for (p in o) if (Object.prototype.hasOwnProperty.call(o,p)) k.push(p);\n return k;\n }","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n","\"use strict\";\nrequire(\"../../lib/js/polyfills/indexOfPolyfill.js\");\nrequire(\"../../lib/js/polyfills/objectKeysPolyfill.js\");\nvar template_resolver = require(\"../../src/js/templateResolver.js\");\nmodule.exports = {template_resolver : template_resolver};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","Array","prototype","indexOf","Object1","max","min","Object","Math","member","fromIndex","undefined","TypeError","that","Len","length","i","keys","o","p","k","hasOwnProperty","push","removeArrayBracketsRegEx","$68c6955ebe469375$var$module","$68c6955ebe469375$var$templateResolverInternalCreateIfNotExists","objectToCheck","$68c6955ebe469375$var$template_resolver","internalCreateIfNotExists","$68c6955ebe469375$var$internal_object_tools","Resolver","RegExp","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","fullPropertyName","propertyInfo","propertyValue","propertyNames","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$59adffa3db62607f$var$internal_object_tools","$59adffa3db62607f$var$module","data","maxRecursionDepth","result","recurse","cur","prop","depth","isArray","l","isEmpty","$8ZIyB","template_resolver"],"version":3,"file":"templateResolver-ie.js.map","sourceRoot":"../"}
1
+ {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,I,E,E,Q,C,E,Q,S,C,C,C,ECCA,GAAI,CAAC,MAAM,SAAS,CAAC,OAAO,CAAG,KAAoC,EAAQ,EAAK,CAAjD,CAAA,MAAM,SAAS,CAAC,OAAO,EAAa,EAc9D,OAdsE,EAc9D,KAAK,GAAG,CAd2D,EAczD,KAAK,GAAG,CAZpB,SAAiB,CAAM,CAAE,CAAS,EACvC,GAAG,IAAI,GAAG,MAAM,AAAO,KAAA,IAAP,IAAI,CAAa,MAAM,UAAU,uDAEjD,IAAI,EAAO,EAAO,IAAI,EAAG,EAAM,EAAK,MAAM,GAAK,EAAG,EAAI,EAAI,AAAY,EAAZ,EAAe,GACzE,GAAI,EAAI,EAAG,EAAI,EAAI,EAAG,EAAI,QAAS,GAAI,GAAK,EAAK,OAAO,GAExD,GAAG,AAAS,KAAK,IAAd,EAAkB,CAAA,KAAM,IAAM,EAAK,EAAE,EAAG,GAAG,AAAU,KAAK,IAAf,CAAI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T,C,G,E,S,E,S,I,E,E,QCxDA,CAAA,OAAA,OAAA,CAAiB,CAAC,kBAAoB,CAAiB","sources":["<anon>","lib/js/polyfills/indexOfPolyfill.js","lib/js/polyfills/objectKeysPolyfill.js","src/js/templateResolver.js","lib/js/flattenToArray.js","src/js/templateResolver-ie.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"dED0n\", function(module, exports) {\n//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill\nif (!Array.prototype.indexOf) Array.prototype.indexOf = function(Object1, max, min) {\n \"use strict\";\n return function indexOf(member, fromIndex) {\n if (this === null || this === undefined) throw TypeError(\"Array.prototype.indexOf called on null or undefined\");\n var that = Object1(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);\n if (i < 0) i = max(0, Len + i);\n else if (i >= Len) return -1;\n if (member === void 0) {\n for(; i !== Len; ++i)if (that[i] === void 0 && i in that) return i; // undefined\n } else if (member !== member) {\n for(; i !== Len; ++i)if (that[i] !== that[i]) return i; // NaN\n } else for(; i !== Len; ++i)if (that[i] === member) return i; // all else\n return -1; // if the value was not found, then return -1\n };\n}(Object, Math.max, Math.min);\n\n});\n\nparcelRegister(\"b1M0n\", function(module, exports) {\n//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html\nif (!Object.keys) Object.keys = function(o) {\n if (o !== Object(o)) throw new TypeError(\"Object.keys called on a non-object\");\n var k = [], p;\n for(p in o)if (Object.prototype.hasOwnProperty.call(o, p)) k.push(p);\n return k;\n};\n\n});\n\nparcelRegister(\"ds403\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $9cb0fe3475961b60$var$module = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists($9cb0fe3475961b60$var$module); // Fallback for vanilla js without modules\nfunction $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $9cb0fe3475961b60$var$template_resolver = $9cb0fe3475961b60$var$module.exports = {}; // Export module for npm...\n$9cb0fe3475961b60$var$template_resolver.internalCreateIfNotExists = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists;\n\nvar $9cb0fe3475961b60$var$internal_object_tools = $9cb0fe3475961b60$var$internal_object_tools || (parcelRequire(\"ccQZb\")); // supports vanilla js & npm\n$9cb0fe3475961b60$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($9cb0fe3475961b60$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"ccQZb\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $8e2fb4eb18d4597b$var$module = $8e2fb4eb18d4597b$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $8e2fb4eb18d4597b$var$internal_object_tools = $8e2fb4eb18d4597b$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $8e2fb4eb18d4597b$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\"use strict\";\nparcelRequire(\"dED0n\");\nparcelRequire(\"b1M0n\");\n\nvar $ds403 = parcelRequire(\"ds403\");\nmodule.exports = {\n template_resolver: $ds403\n};\n\n\n//# sourceMappingURL=templateResolver-ie.js.map\n","//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill\nif (!Array.prototype.indexOf) Array.prototype.indexOf = (function(Object, max, min){\n \"use strict\";\n return function indexOf(member, fromIndex) {\n if(this===null||this===undefined)throw TypeError(\"Array.prototype.indexOf called on null or undefined\");\n \n var that = Object(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);\n if (i < 0) i = max(0, Len+i); else if (i >= Len) return -1;\n \n if(member===void 0){ for(; i !== Len; ++i) if(that[i]===void 0 && i in that) return i; // undefined\n }else if(member !== member){ for(; i !== Len; ++i) if(that[i] !== that[i]) return i; // NaN\n }else for(; i !== Len; ++i) if(that[i] === member) return i; // all else\n \n return -1; // if the value was not found, then return -1\n };\n })(Object, Math.max, Math.min);","//http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html\nif (!Object.keys) Object.keys = function(o) {\n if (o !== Object(o))\n throw new TypeError('Object.keys called on a non-object');\n var k=[],p;\n for (p in o) if (Object.prototype.hasOwnProperty.call(o,p)) k.push(p);\n return k;\n }","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n","\"use strict\";\nrequire(\"../../lib/js/polyfills/indexOfPolyfill.js\");\nrequire(\"../../lib/js/polyfills/objectKeysPolyfill.js\");\nvar template_resolver = require(\"../../src/js/templateResolver.js\");\nmodule.exports = {template_resolver : template_resolver};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","Array","prototype","indexOf","Object1","max","min","Object","Math","member","fromIndex","undefined","TypeError","that","Len","length","i","keys","o","p","k","hasOwnProperty","push","removeArrayBracketsRegEx","$9cb0fe3475961b60$var$module","$9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists","objectToCheck","$9cb0fe3475961b60$var$template_resolver","internalCreateIfNotExists","$9cb0fe3475961b60$var$internal_object_tools","Resolver","RegExp","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","fullPropertyName","propertyInfo","propertyValue","propertyNames","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$8e2fb4eb18d4597b$var$internal_object_tools","$8e2fb4eb18d4597b$var$module","data","maxRecursionDepth","result","recurse","cur","prop","depth","isArray","l","isEmpty","$ds403","template_resolver"],"version":3,"file":"templateResolver-ie.js.map","sourceRoot":"../"}
@@ -1,77 +1,2 @@
1
- var e=globalThis,r={},t={},n=e.parcelRequirec1f2;null==n&&((n=function(e){if(e in r)return r[e].exports;if(e in t){var n=t[e];delete t[e];var a={id:e,exports:{}};return r[e]=a,n.call(a.exports,a,a.exports),a.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,r){t[e]=r},e.parcelRequirec1f2=n);var a=n.register;a("8ZIyB",function(e,r){var t,a=o(a);// Fallback for vanilla js without modules
2
- function o(e){return e||{}}/**
3
- * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
4
- * @module template_resolver
5
- */var i=a.exports={};// Export module for npm...
6
- i.internalCreateIfNotExists=o;var u=u||n("7HmuL");// supports vanilla js & npm
7
- i.Resolver=(t=RegExp("\\[\\d+\\]","gi"),/**
8
- * Resolver. Is used inside this repository. It could also be used outside.
9
- * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.
10
- * @constructs Resolver
11
- * @alias module:template_resolver.Resolver
12
- */function(e){/**
13
- * The properties of this source data object will be used to replace the placeholders in the template.
14
- */this.sourceDataObject=e,/**
15
- * Resolves the given template.
16
- *
17
- * The template may contain variables in double curly brackets.
18
- * Supported variables are all properties of this object, e.g. "{{fieldName}}", "{{displayName}}", "{{value}}".
19
- * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. "{{summaries[0].value}}"
20
- * Parts of the index can be inserted by using e.g. "{{index[1]}}".
21
- *
22
- * @param {string} template
23
- * @returns {string} resolved template
24
- */this.resolveTemplate=function(e){return this.replaceResolvableFields(e,/**
25
- * Adds the value of the "fieldName" property (including its group prefix) and its associated "value" property content.
26
- * For example: detail[2].fieldName="name", detail[2].value="Smith" lead to the additional property detail.name="Smith".
27
- * @param {object} object with resolvable field names and their values.
28
- * @returns {object} object with resolvable field names and their values.
29
- * @protected
30
- * @memberof module:template_resolver.Resolver
31
- */function(e){var r,n,a,o,i=Object.keys(e);for(r=0;r<i.length;r+=1)o=e[n=i[r]],"fieldName"===(a=/**
32
- * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.
33
- * @param {String} fullPropertyName
34
- * @returns {Object} Contains "group" (empty or group name including trailing separator "."), "groupWithoutArrayIndices" and "name" (property name).
35
- * @protected
36
- * @memberof module:template_resolver.Resolver
37
- */function(e){var r=e.lastIndexOf("."),n=e;r>0&&(n=e.substr(r+1));var a="";r>0&&(a=e.substr(0,r+1));//includes the trailing ".".
38
- var o=a.replace(t,"");return{group:a,groupWithoutArrayIndices:o,name:n}}(n)).name&&"fieldName"!==o&&(e[a.groupWithoutArrayIndices+o]=e[a.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},/**
39
- * Returns a map like object, that contains all resolvable fields and their values as properties.
40
- * This function takes a variable count of input parameters,
41
- * each containing an object that contains resolvable fields to extract from.
42
- *
43
- * The recursion depth is limited to 3, so that an object,
44
- * that contains an object can contain another object (but not further).
45
- *
46
- * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.
47
- *
48
- * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.
49
- * @returns {object} object with resolvable field names and their values.
50
- * @public
51
- */this.resolvableFieldsOfAll=function(){var e,r={},t=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)/**
52
- * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).
53
- * Example: `{name: "accountNumber", value: "12345"}` becomes `mapObject["accountNumber"]="12345"`.
54
- *
55
- * @param {NameValuePair[]} elements flattened array of name-value-pairs
56
- * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.
57
- * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).
58
- * @protected
59
- * @memberof module:template_resolver.Resolver
60
- */(function(e,r,t){var n,a;for(n=0;n<e.length;n+=1)a=e[n],"function"==typeof t&&t(a.name)&&(r[a.name]=a.value)})(u.flattenToArray(arguments[e],3),r,t);return r},/**
61
- * Replaces all variables in double curly brackets, e.g. {{property}},
62
- * with the value of that property from the resolvableProperties.
63
- *
64
- * Supported property types: string, number, boolean
65
- * @param {string} stringContainingVariables
66
- * @param {object[]} resolvableFields (name=value)
67
- */this.replaceResolvableFields=function(e,r){var t=e,n=Object.keys(r),a=0,o="",i="";for(a=0;a<n.length;a+=1)i=r[o=n[a]],t=t.replace("{{"+o+"}}",i);return t}})}),a("7HmuL",function(e,r){/**
68
- * @typedef {Object} NameValuePair
69
- * @property {string} name - point separated names of the flattened main and sub properties, e.g. "responses[2].hits.hits[4]._source.name".
70
- * @property {string} value - value of the property
71
- *//**
72
- * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.
73
- * @param {number} maxRecursionDepth
74
- * @returns {NameValuePair[]} array of property name and value pairs
75
- */(($59adffa3db62607f$var$module||{}).exports={}).flattenToArray=function(e,r){var t=[];return("number"!=typeof r||r<1)&&(r=20),function e(n,a,o){if(!(o>r)&&"function"!=typeof n){if(Object(n)!==n)t.push({name:a,value:n});else if(Array.isArray(n)){var i,u=n.length;for(i=0;i<u;i+=1)e(n[i],a+"["+i+"]",o+1);0===u&&(t[a]=[],t.push({name:a,value:""}))}else{var l,s=!0;for(l in n)s=!1,e(n[l],a?a+"."+l:l,o+1);s&&a&&t.push({name:a,value:""})}}}(e,"",0),t}}),n("8ZIyB");//# sourceMappingURL=templateResolver.js.map
76
-
1
+ var e=globalThis,r={},t={},n=e.parcelRequirec1f2;null==n&&((n=function(e){if(e in r)return r[e].exports;if(e in t){var n=t[e];delete t[e];var a={id:e,exports:{}};return r[e]=a,n.call(a.exports,a,a.exports),a.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,r){t[e]=r},e.parcelRequirec1f2=n);var a=n.register;a("ds403",function(e,r){var t,a=o(a);function o(e){return e||{}}var i=a.exports={};i.internalCreateIfNotExists=o;var l=l||n("ccQZb");i.Resolver=(t=RegExp("\\[\\d+\\]","gi"),function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var r,n,a,o,i=Object.keys(e);for(r=0;r<i.length;r+=1)o=e[n=i[r]],"fieldName"===(a=function(e){var r=e.lastIndexOf("."),n=e;r>0&&(n=e.substr(r+1));var a="";r>0&&(a=e.substr(0,r+1));var o=a.replace(t,"");return{group:a,groupWithoutArrayIndices:o,name:n}}(n)).name&&"fieldName"!==o&&(e[a.groupWithoutArrayIndices+o]=e[a.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,r={},t=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)(function(e,r,t){var n,a;for(n=0;n<e.length;n+=1)a=e[n],"function"==typeof t&&t(a.name)&&(r[a.name]=a.value)})(l.flattenToArray(arguments[e],3),r,t);return r},this.replaceResolvableFields=function(e,r){var t=e,n=Object.keys(r),a=0,o="",i="";for(a=0;a<n.length;a+=1)i=r[o=n[a]],t=t.replace("{{"+o+"}}",i);return t}})}),a("ccQZb",function(e,r){(($8e2fb4eb18d4597b$var$module||{}).exports={}).flattenToArray=function(e,r){var t=[];return("number"!=typeof r||r<1)&&(r=20),function e(n,a,o){if(!(o>r)&&"function"!=typeof n){if(Object(n)!==n)t.push({name:a,value:n});else if(Array.isArray(n)){var i,l=n.length;for(i=0;i<l;i+=1)e(n[i],a+"["+i+"]",o+1);0===l&&(t[a]=[],t.push({name:a,value:""}))}else{var u,s=!0;for(u in n)s=!1,e(n[u],a?a+"."+u:u,o+1);s&&a&&t.push({name:a,value:""})}}}(e,"",0),t}}),n("ds403");
77
2
  //# sourceMappingURL=templateResolver.js.map
@@ -1 +1 @@
1
- {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,I,E,E,Q,C,E,Q,S,C,C,C,ECOA,IAgBM,EAhBF,EAAS,EAA0C,EAAS,2CAA0C;AAE1G,SAAS,EAA0C,CAAa,EAC9D,OAAO,GAAiB,CAAC,CAC3B,CAEA;;;CAGC,EACD,IAAI,EAAqB,EAAO,OAAO,CAAG,CAAC,CAAI,4BAA2B;AAC1E,EAAkB,yBAAyB,CAAG,EAE9C,IAAI,EAAwB,GAAyB,EAAA,QAAwC,6BAA4B;AAEzH,EAAkB,QAAQ,EACpB,EAA2B,AAAI,OAAO,aAAc,MAExD;;;;;GAKC,EACD,SAAkB,CAAgB,EAChC;;KAEC,EACD,IAAI,CAAC,gBAAgB,CAAG,EACxB;;;;;;;;;;KAUC,EACD,IAAI,CAAC,eAAe,CAAG,SAAU,CAAQ,EACvC,OAAO,IAAI,CAAC,uBAAuB,CAAC,EAAU,AAkDl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O,IAAM,EAAI,IAAK,EAAQ,EAEtC,CAAA,IAAN,IACF,CAAM,CAAC,EAAK,CAAG,EAAE,CACjB,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,GAExC,KAAO,CACL,IACI,EADA,EAAU,CAAA,EAEd,IAAK,KAAK,EACR,EAAU,CAAA,EACV,EAAQ,CAAG,CAAC,EAAE,CAAE,EAAO,EAAO,IAAM,EAAI,EAAG,EAAQ,GAEjD,GAAW,GACb,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,EAExC,EACF,EACQ,EAAM,GAAI,GACX,CACT,C,G,E,Q,6C","sources":["<anon>","src/js/templateResolver.js","lib/js/flattenToArray.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"8ZIyB\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $68c6955ebe469375$var$module = $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists($68c6955ebe469375$var$module); // Fallback for vanilla js without modules\nfunction $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $68c6955ebe469375$var$template_resolver = $68c6955ebe469375$var$module.exports = {}; // Export module for npm...\n$68c6955ebe469375$var$template_resolver.internalCreateIfNotExists = $68c6955ebe469375$var$templateResolverInternalCreateIfNotExists;\n\nvar $68c6955ebe469375$var$internal_object_tools = $68c6955ebe469375$var$internal_object_tools || (parcelRequire(\"7HmuL\")); // supports vanilla js & npm\n$68c6955ebe469375$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($68c6955ebe469375$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"7HmuL\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $59adffa3db62607f$var$module = $59adffa3db62607f$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $59adffa3db62607f$var$internal_object_tools = $59adffa3db62607f$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $59adffa3db62607f$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\nparcelRequire(\"8ZIyB\");\n\n//# sourceMappingURL=templateResolver.js.map\n","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","removeArrayBracketsRegEx","$68c6955ebe469375$var$module","$68c6955ebe469375$var$templateResolverInternalCreateIfNotExists","objectToCheck","$68c6955ebe469375$var$template_resolver","internalCreateIfNotExists","$68c6955ebe469375$var$internal_object_tools","Resolver","RegExp","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","i","fullPropertyName","propertyInfo","propertyValue","propertyNames","Object","keys","length","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","indexOf","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$59adffa3db62607f$var$internal_object_tools","$59adffa3db62607f$var$module","data","maxRecursionDepth","result","recurse","cur","prop","depth","push","Array","isArray","l","p","isEmpty"],"version":3,"file":"templateResolver.js.map","sourceRoot":"../"}
1
+ {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,I,E,E,Q,C,E,Q,S,C,C,C,ECOA,IAgBM,EAhBF,EAAS,EAA0C,GAEvD,SAAS,EAA0C,CAAa,EAC9D,OAAO,GAAiB,CAAC,CAC3B,CAMA,IAAI,EAAqB,EAAO,OAAO,CAAG,CAAC,CAC3C,CAAA,EAAkB,yBAAyB,CAAG,EAE9C,IAAI,EAAwB,GAAyB,EAAA,QAErD,CAAA,EAAkB,QAAQ,EACpB,EAA2B,AAAI,OAAO,aAAc,MAQxD,SAAkB,CAAgB,EAIhC,IAAI,CAAC,gBAAgB,CAAG,EAYxB,IAAI,CAAC,eAAe,CAAG,SAAU,CAAQ,EACvC,OAAO,IAAI,CAAC,uBAAuB,CAAC,EAAU,AA0DlD,SAA2B,CAAG,EAC5B,IACI,EAAG,EAAkB,EAAc,EADnC,EAAgB,OAAO,IAAI,CAAC,GAEhC,IAAK,EAAI,EAAG,EAAI,EAAc,MAAM,CAAE,GAAK,EAEzC,EAAgB,CAAG,CADnB,EAAmB,CAAa,CAAC,EAAE,CACE,CAMX,cAAtB,AALJ,CAAA,EAAe,A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EACQ,EAAM,GAAI,GACX,CACT,C,G,E","sources":["<anon>","src/js/templateResolver.js","lib/js/flattenToArray.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"ds403\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $9cb0fe3475961b60$var$module = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists($9cb0fe3475961b60$var$module); // Fallback for vanilla js without modules\nfunction $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $9cb0fe3475961b60$var$template_resolver = $9cb0fe3475961b60$var$module.exports = {}; // Export module for npm...\n$9cb0fe3475961b60$var$template_resolver.internalCreateIfNotExists = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists;\n\nvar $9cb0fe3475961b60$var$internal_object_tools = $9cb0fe3475961b60$var$internal_object_tools || (parcelRequire(\"ccQZb\")); // supports vanilla js & npm\n$9cb0fe3475961b60$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($9cb0fe3475961b60$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"ccQZb\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $8e2fb4eb18d4597b$var$module = $8e2fb4eb18d4597b$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $8e2fb4eb18d4597b$var$internal_object_tools = $8e2fb4eb18d4597b$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $8e2fb4eb18d4597b$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\nparcelRequire(\"ds403\");\n\n//# sourceMappingURL=templateResolver.js.map\n","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","removeArrayBracketsRegEx","$9cb0fe3475961b60$var$module","$9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists","objectToCheck","$9cb0fe3475961b60$var$template_resolver","internalCreateIfNotExists","$9cb0fe3475961b60$var$internal_object_tools","Resolver","RegExp","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","i","fullPropertyName","propertyInfo","propertyValue","propertyNames","Object","keys","length","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","indexOf","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$8e2fb4eb18d4597b$var$internal_object_tools","$8e2fb4eb18d4597b$var$module","data","maxRecursionDepth","result","recurse","cur","prop","depth","push","Array","isArray","l","p","isEmpty"],"version":3,"file":"templateResolver.js.map","sourceRoot":"../"}
@@ -1280,7 +1280,7 @@ datarestructor.Restructor.processJsonUsingDescriptions = function(jsonData, desc
1280
1280
  <br class="clear">
1281
1281
 
1282
1282
  <footer>
1283
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
1283
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
1284
1284
  </footer>
1285
1285
 
1286
1286
  <script> prettyPrint(); </script>
@@ -334,7 +334,7 @@ described_field.DescribedDataFieldGroup = (function () {
334
334
  <br class="clear">
335
335
 
336
336
  <footer>
337
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
337
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
338
338
  </footer>
339
339
 
340
340
  <script> prettyPrint(); </script>
package/docs/index.html CHANGED
@@ -817,7 +817,7 @@ That leads to recursion and duplication, that need to be limited. This can be co
817
817
  <br class="clear">
818
818
 
819
819
  <footer>
820
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
820
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
821
821
  </footer>
822
822
 
823
823
  <script> prettyPrint(); </script>
@@ -905,7 +905,7 @@ This is the public version of the internal variable _identifier.index, which con
905
905
  <br class="clear">
906
906
 
907
907
  <footer>
908
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
908
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
909
909
  </footer>
910
910
 
911
911
  <script> prettyPrint(); </script>
@@ -2948,7 +2948,7 @@ starts with the &quot;propertyPattern&quot;.</p>
2948
2948
  <br class="clear">
2949
2949
 
2950
2950
  <footer>
2951
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
2951
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
2952
2952
  </footer>
2953
2953
 
2954
2954
  <script> prettyPrint(); </script>
@@ -339,7 +339,7 @@ var result = datarestructor.Restructor.processJsonUsingDescriptions(jsonData, al
339
339
  <br class="clear">
340
340
 
341
341
  <footer>
342
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
342
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
343
343
  </footer>
344
344
 
345
345
  <script> prettyPrint(); </script>
@@ -3094,7 +3094,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
3094
3094
  <br class="clear">
3095
3095
 
3096
3096
  <footer>
3097
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
3097
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
3098
3098
  </footer>
3099
3099
 
3100
3100
  <script> prettyPrint(); </script>
@@ -2734,7 +2734,7 @@ how the data should be transformed.</p>
2734
2734
  <br class="clear">
2735
2735
 
2736
2736
  <footer>
2737
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
2737
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
2738
2738
  </footer>
2739
2739
 
2740
2740
  <script> prettyPrint(); </script>
@@ -2123,7 +2123,7 @@ Example: &quot;responses[2].hits.hits[4]._source.name&quot; will have an index o
2123
2123
  <br class="clear">
2124
2124
 
2125
2125
  <footer>
2126
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
2126
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
2127
2127
  </footer>
2128
2128
 
2129
2129
  <script> prettyPrint(); </script>
@@ -577,7 +577,7 @@ that contain an array of sub fields of the same type <a href="module-described_f
577
577
  <br class="clear">
578
578
 
579
579
  <footer>
580
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Fri Oct 20 2023 21:28:55 GMT+0200 (Central European Summer Time)
580
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Sat Jun 15 2024 08:36:34 GMT+0000 (Coordinated Universal Time)
581
581
  </footer>
582
582
 
583
583
  <script> prettyPrint(); </script>