data-restructor 3.3.4 → 3.4.1

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 (49) hide show
  1. package/.auto-changelog +9 -0
  2. package/.auto-changelog-template.hbs +36 -0
  3. package/.github/workflows/codeql-analysis.yml +4 -4
  4. package/.github/workflows/continuous-integration.yaml +84 -0
  5. package/CHANGELOG.md +199 -94
  6. package/CONTRIBUTING.md +51 -43
  7. package/Commands.md +16 -15
  8. package/README.md +193 -137
  9. package/SECURITY.md +2 -2
  10. package/coverage/coverage-summary.json +3 -3
  11. package/coverage/datarestructor.js.html +133 -133
  12. package/coverage/describedfield.js.html +45 -45
  13. package/coverage/index.html +1 -1
  14. package/coverage/templateResolver.js.html +26 -26
  15. package/devdist/datarestructor-ie.js +1487 -1678
  16. package/devdist/datarestructor.js +1438 -1614
  17. package/devdist/describedfield-ie.js +260 -282
  18. package/devdist/describedfield.js +257 -279
  19. package/devdist/templateResolver-ie.js +221 -257
  20. package/devdist/templateResolver.js +192 -228
  21. package/dist/datarestructor-ie.js +1 -1
  22. package/dist/datarestructor-ie.js.map +1 -1
  23. package/dist/datarestructor.js +1 -1
  24. package/dist/datarestructor.js.map +1 -1
  25. package/dist/describedfield-ie.js +1 -1
  26. package/dist/describedfield-ie.js.map +1 -1
  27. package/dist/describedfield.js +1 -1
  28. package/dist/describedfield.js.map +1 -1
  29. package/dist/templateResolver-ie.js +1 -1
  30. package/dist/templateResolver-ie.js.map +1 -1
  31. package/dist/templateResolver.js +1 -1
  32. package/dist/templateResolver.js.map +1 -1
  33. package/docs/datarestructor.js.html +1 -1
  34. package/docs/describedfield.js.html +1 -1
  35. package/docs/index.html +54 -44
  36. package/docs/module-datarestructor.DescribedEntryCreator.html +94 -94
  37. package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
  38. package/docs/module-datarestructor.Restructor.html +1 -1
  39. package/docs/module-datarestructor.Transform.html +605 -605
  40. package/docs/module-datarestructor.html +959 -995
  41. package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
  42. package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
  43. package/docs/module-described_field.html +1 -37
  44. package/docs/module-template_resolver.Resolver.html +167 -167
  45. package/docs/module-template_resolver.html +1 -37
  46. package/docs/templateResolver.js.html +1 -1
  47. package/package.json +20 -14
  48. package/renovate.json +14 -0
  49. package/.github/workflows/action.yaml +0 -44
@@ -6,7 +6,7 @@
6
6
  // anything defined in a previous bundle is accessed via the
7
7
  // orig method which is the require for previous bundles
8
8
 
9
- (function(modules, entry, mainEntry, parcelRequireName, globalName) {
9
+ (function (modules, entry, mainEntry, parcelRequireName, globalName) {
10
10
  /* eslint-disable no-undef */
11
11
  var globalObject =
12
12
  typeof globalThis !== 'undefined'
@@ -80,11 +80,13 @@
80
80
  return cache[name].exports;
81
81
 
82
82
  function localRequire(x) {
83
- return newRequire(localRequire.resolve(x));
83
+ var res = localRequire.resolve(x);
84
+ return res === false ? {} : newRequire(res);
84
85
  }
85
86
 
86
87
  function resolve(x) {
87
- return modules[name][1][x] || x;
88
+ var id = modules[name][1][x];
89
+ return id != null ? id : x;
88
90
  }
89
91
  }
90
92
 
@@ -99,9 +101,9 @@
99
101
  newRequire.modules = modules;
100
102
  newRequire.cache = cache;
101
103
  newRequire.parent = previousRequire;
102
- newRequire.register = function(id, exports) {
104
+ newRequire.register = function (id, exports) {
103
105
  modules[id] = [
104
- function(require, module) {
106
+ function (require, module) {
105
107
  module.exports = exports;
106
108
  },
107
109
  {},
@@ -109,7 +111,7 @@
109
111
  };
110
112
 
111
113
  Object.defineProperty(newRequire, 'root', {
112
- get: function() {
114
+ get: function () {
113
115
  return globalObject[parcelRequireName];
114
116
  },
115
117
  });
@@ -131,7 +133,7 @@
131
133
 
132
134
  // RequireJS
133
135
  } else if (typeof define === 'function' && define.amd) {
134
- define(function() {
136
+ define(function () {
135
137
  return mainExports;
136
138
  });
137
139
 
@@ -140,280 +142,242 @@
140
142
  this[globalName] = mainExports;
141
143
  }
142
144
  }
143
- })({"aHN8C":[function(require,module,exports) {
145
+ })({"4dShw":[function(require,module,exports) {
144
146
  "use strict";
145
- require("../../lib/js/polyfills/indexOfPolyfill.js");
146
- require("../../lib/js/polyfills/objectKeysPolyfill.js");
147
- var template_resolver = require("../../src/js/templateResolver.js");
147
+ require("f9cbbac04b01709d");
148
+ require("df655861a744c42f");
149
+ var template_resolver = require("5944841c0ea18f02");
148
150
  module.exports = {
149
- template_resolver: template_resolver
151
+ template_resolver: template_resolver
150
152
  };
151
153
 
152
- },{"../../lib/js/polyfills/indexOfPolyfill.js":"3Kjed","../../lib/js/polyfills/objectKeysPolyfill.js":"7lzVt","../../src/js/templateResolver.js":"7hyUl"}],"3Kjed":[function(require,module,exports) {
153
- // https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
154
- if (!Array.prototype.indexOf) Array.prototype.indexOf = (function (Object, max, min) {
155
- "use strict";
156
- return function indexOf(member, fromIndex) {
157
- if (this === null || this === undefined) throw TypeError("Array.prototype.indexOf called on null or undefined");
158
- var that = Object(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);
159
- if (i < 0) i = max(0, Len + i); else if (i >= Len) return -1;
160
- if (member === void 0) {
161
- for (; i !== Len; ++i) if (that[i] === void 0 && (i in that)) return i;
162
- } else if (member !== member) {
163
- for (; i !== Len; ++i) if (that[i] !== that[i]) return i;
164
- } else for (; i !== Len; ++i) if (that[i] === member) return i;
165
- // all else
166
- return -1;
167
- };
168
- })(Object, Math.max, Math.min);
154
+ },{"f9cbbac04b01709d":"dCgG6","df655861a744c42f":"8vHia","5944841c0ea18f02":"5qyN0"}],"dCgG6":[function(require,module,exports) {
155
+ //https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
156
+ if (!Array.prototype.indexOf) Array.prototype.indexOf = function(Object1, max, min) {
157
+ "use strict";
158
+ return function indexOf(member, fromIndex) {
159
+ if (this === null || this === undefined) throw TypeError("Array.prototype.indexOf called on null or undefined");
160
+ var that = Object1(this), Len = that.length >>> 0, i = min(fromIndex | 0, Len);
161
+ if (i < 0) i = max(0, Len + i);
162
+ else if (i >= Len) return -1;
163
+ if (member === void 0) {
164
+ for(; i !== Len; ++i)if (that[i] === void 0 && i in that) return i; // undefined
165
+ } else if (member !== member) {
166
+ for(; i !== Len; ++i)if (that[i] !== that[i]) return i; // NaN
167
+ } else for(; i !== Len; ++i)if (that[i] === member) return i; // all else
168
+ return -1; // if the value was not found, then return -1
169
+ };
170
+ }(Object, Math.max, Math.min);
169
171
 
170
- },{}],"7lzVt":[function(require,module,exports) {
171
- // http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html
172
- if (!Object.keys) Object.keys = function (o) {
173
- if (o !== Object(o)) throw new TypeError('Object.keys called on a non-object');
174
- var k = [], p;
175
- for (p in o) if (Object.prototype.hasOwnProperty.call(o, p)) k.push(p);
176
- return k;
172
+ },{}],"8vHia":[function(require,module,exports) {
173
+ //http://tokenposts.blogspot.com/2012/04/javascript-objectkeys-browser.html
174
+ if (!Object.keys) Object.keys = function(o) {
175
+ if (o !== Object(o)) throw new TypeError("Object.keys called on a non-object");
176
+ var k = [], p;
177
+ for(p in o)if (Object.prototype.hasOwnProperty.call(o, p)) k.push(p);
178
+ return k;
177
179
  };
178
180
 
179
- },{}],"7hyUl":[function(require,module,exports) {
181
+ },{}],"5qyN0":[function(require,module,exports) {
180
182
  /**
181
- * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
182
- * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
183
- * @author JohT
184
- * @version ${project.version}
185
- */
186
- "use strict";
187
- var module = templateResolverInternalCreateIfNotExists(module);
188
- // Fallback for vanilla js without modules
183
+ * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
184
+ * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
185
+ * @author JohT
186
+ * @version ${project.version}
187
+ */ "use strict";
188
+ var module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules
189
189
  function templateResolverInternalCreateIfNotExists(objectToCheck) {
190
- return objectToCheck || ({});
190
+ return objectToCheck || {};
191
191
  }
192
192
  /**
193
- * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
194
- * @module template_resolver
195
- */
196
- var template_resolver = module.exports = {};
197
- // Export module for npm...
193
+ * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.
194
+ * @module template_resolver
195
+ */ var template_resolver = module.exports = {}; // Export module for npm...
198
196
  template_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;
199
- var internal_object_tools = internal_object_tools || require("../../lib/js/flattenToArray");
200
- // supports vanilla js & npm
201
- template_resolver.Resolver = (function () {
202
- var removeArrayBracketsRegEx = new RegExp("\\[\\d+\\]", "gi");
203
- /**
204
- * Resolver. Is used inside this repository. It could also be used outside.
205
- * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.
206
- * @constructs Resolver
207
- * @alias module:template_resolver.Resolver
208
- */
209
- function Resolver(sourceDataObject) {
210
- /**
211
- * The properties of this source data object will be used to replace the placeholders in the template.
212
- */
213
- this.sourceDataObject = sourceDataObject;
214
- /**
215
- * Resolves the given template.
216
- *
217
- * The template may contain variables in double curly brackets.
218
- * Supported variables are all properties of this object, e.g. "{{fieldName}}", "{{displayName}}", "{{value}}".
219
- * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. "{{summaries[0].value}}"
220
- * Parts of the index can be inserted by using e.g. "{{index[1]}}".
221
- *
222
- * @param {string} template
223
- * @returns {string} resolved template
224
- */
225
- this.resolveTemplate = function (template) {
226
- return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));
227
- };
228
- /**
229
- * Returns a map like object, that contains all resolvable fields and their values as properties.
230
- * This function takes a variable count of input parameters,
231
- * each containing an object that contains resolvable fields to extract from.
232
- *
233
- * The recursion depth is limited to 3, so that an object,
234
- * that contains an object can contain another object (but not further).
235
- *
236
- * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.
237
- *
238
- * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.
239
- * @returns {object} object with resolvable field names and their values.
240
- * @public
241
- */
242
- this.resolvableFieldsOfAll = function () {
243
- var map = {};
244
- var ignoreInternalFields = function (propertyName) {
245
- return propertyName.indexOf("_") !== 0 && propertyName.indexOf("._") < 0;
246
- };
247
- var index;
248
- for (index = 0; index < arguments.length; index += 1) {
249
- addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);
250
- }
251
- return map;
252
- };
197
+ var internal_object_tools = internal_object_tools || require("2bc8fdaaf35dfa57"); // supports vanilla js & npm
198
+ template_resolver.Resolver = function() {
199
+ var removeArrayBracketsRegEx = new RegExp("\\[\\d+\\]", "gi");
253
200
  /**
254
- * Replaces all variables in double curly brackets, e.g. {{property}},
255
- * with the value of that property from the resolvableProperties.
256
- *
257
- * Supported property types: string, number, boolean
258
- * @param {string} stringContainingVariables
259
- * @param {object[]} resolvableFields (name=value)
260
- */
261
- this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {
262
- var replaced = stringContainingVariables;
263
- var propertyNames = Object.keys(resolvableFields);
264
- var propertyIndex = 0;
265
- var propertyName = "";
266
- var propertyValue = "";
267
- for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {
268
- propertyName = propertyNames[propertyIndex];
269
- propertyValue = resolvableFields[propertyName];
270
- replaced = replaced.replace("{{" + propertyName + "}}", propertyValue);
271
- }
272
- return replaced;
273
- };
274
- }
275
- /**
276
- * Adds the value of the "fieldName" property (including its group prefix) and its associated "value" property content.
277
- * For example: detail[2].fieldName="name", detail[2].value="Smith" lead to the additional property detail.name="Smith".
278
- * @param {object} object with resolvable field names and their values.
279
- * @returns {object} object with resolvable field names and their values.
280
- * @protected
281
- * @memberof module:template_resolver.Resolver
282
- */
283
- function addFieldsPerGroup(map) {
284
- var propertyNames = Object.keys(map);
285
- var i, fullPropertyName, propertyInfo, propertyValue;
286
- for (i = 0; i < propertyNames.length; i += 1) {
287
- fullPropertyName = propertyNames[i];
288
- propertyValue = map[fullPropertyName];
289
- propertyInfo = getPropertyNameInfos(fullPropertyName);
290
- // Supports fields that are defined by a property named "fieldName" (containing the name)
291
- // and a property named "value" inside the same sub object (containing its value).
292
- // Ignore custom fields that are named "fieldName"(propertyValue), since this would lead to an unpredictable behavior.
293
- // TODO could make "fieldName" and "value" configurable
294
- if (propertyInfo.name === "fieldName" && propertyValue !== "fieldName") {
295
- map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + "value"];
296
- }
201
+ * Resolver. Is used inside this repository. It could also be used outside.
202
+ * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.
203
+ * @constructs Resolver
204
+ * @alias module:template_resolver.Resolver
205
+ */ function Resolver(sourceDataObject) {
206
+ /**
207
+ * The properties of this source data object will be used to replace the placeholders in the template.
208
+ */ this.sourceDataObject = sourceDataObject;
209
+ /**
210
+ * Resolves the given template.
211
+ *
212
+ * The template may contain variables in double curly brackets.
213
+ * Supported variables are all properties of this object, e.g. "{{fieldName}}", "{{displayName}}", "{{value}}".
214
+ * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. "{{summaries[0].value}}"
215
+ * Parts of the index can be inserted by using e.g. "{{index[1]}}".
216
+ *
217
+ * @param {string} template
218
+ * @returns {string} resolved template
219
+ */ this.resolveTemplate = function(template) {
220
+ return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));
221
+ };
222
+ /**
223
+ * Returns a map like object, that contains all resolvable fields and their values as properties.
224
+ * This function takes a variable count of input parameters,
225
+ * each containing an object that contains resolvable fields to extract from.
226
+ *
227
+ * The recursion depth is limited to 3, so that an object,
228
+ * that contains an object can contain another object (but not further).
229
+ *
230
+ * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.
231
+ *
232
+ * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.
233
+ * @returns {object} object with resolvable field names and their values.
234
+ * @public
235
+ */ this.resolvableFieldsOfAll = function() {
236
+ var map = {};
237
+ var ignoreInternalFields = function(propertyName) {
238
+ return propertyName.indexOf("_") !== 0 && propertyName.indexOf("._") < 0;
239
+ };
240
+ var index;
241
+ for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);
242
+ return map;
243
+ };
244
+ /**
245
+ * Replaces all variables in double curly brackets, e.g. {{property}},
246
+ * with the value of that property from the resolvableProperties.
247
+ *
248
+ * Supported property types: string, number, boolean
249
+ * @param {string} stringContainingVariables
250
+ * @param {object[]} resolvableFields (name=value)
251
+ */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {
252
+ var replaced = stringContainingVariables;
253
+ var propertyNames = Object.keys(resolvableFields);
254
+ var propertyIndex = 0;
255
+ var propertyName = "";
256
+ var propertyValue = "";
257
+ for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){
258
+ propertyName = propertyNames[propertyIndex];
259
+ propertyValue = resolvableFields[propertyName];
260
+ replaced = replaced.replace("{{" + propertyName + "}}", propertyValue);
261
+ }
262
+ return replaced;
263
+ };
297
264
  }
298
- return map;
299
- }
300
- /**
301
- * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.
302
- * @param {String} fullPropertyName
303
- * @returns {Object} Contains "group" (empty or group name including trailing separator "."), "groupWithoutArrayIndices" and "name" (property name).
304
- * @protected
305
- * @memberof module:template_resolver.Resolver
306
- */
307
- function getPropertyNameInfos(fullPropertyName) {
308
- var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(".");
309
- var propertyName = fullPropertyName;
310
- if (positionOfRightMostSeparator > 0) {
311
- propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);
265
+ /**
266
+ * Adds the value of the "fieldName" property (including its group prefix) and its associated "value" property content.
267
+ * For example: detail[2].fieldName="name", detail[2].value="Smith" lead to the additional property detail.name="Smith".
268
+ * @param {object} object with resolvable field names and their values.
269
+ * @returns {object} object with resolvable field names and their values.
270
+ * @protected
271
+ * @memberof module:template_resolver.Resolver
272
+ */ function addFieldsPerGroup(map) {
273
+ var propertyNames = Object.keys(map);
274
+ var i, fullPropertyName, propertyInfo, propertyValue;
275
+ for(i = 0; i < propertyNames.length; i += 1){
276
+ fullPropertyName = propertyNames[i];
277
+ propertyValue = map[fullPropertyName];
278
+ propertyInfo = getPropertyNameInfos(fullPropertyName);
279
+ // Supports fields that are defined by a property named "fieldName" (containing the name)
280
+ // and a property named "value" inside the same sub object (containing its value).
281
+ // Ignore custom fields that are named "fieldName"(propertyValue), since this would lead to an unpredictable behavior.
282
+ // TODO could make "fieldName" and "value" configurable
283
+ if (propertyInfo.name === "fieldName" && propertyValue !== "fieldName") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + "value"];
284
+ }
285
+ return map;
312
286
  }
313
- var propertyGroup = "";
314
- if (positionOfRightMostSeparator > 0) {
315
- propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1);
287
+ /**
288
+ * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.
289
+ * @param {String} fullPropertyName
290
+ * @returns {Object} Contains "group" (empty or group name including trailing separator "."), "groupWithoutArrayIndices" and "name" (property name).
291
+ * @protected
292
+ * @memberof module:template_resolver.Resolver
293
+ */ function getPropertyNameInfos(fullPropertyName) {
294
+ var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(".");
295
+ var propertyName = fullPropertyName;
296
+ if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);
297
+ var propertyGroup = "";
298
+ if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing ".".
299
+ var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, "");
300
+ return {
301
+ group: propertyGroup,
302
+ groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,
303
+ name: propertyName
304
+ };
316
305
  }
317
- var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, "");
318
- return {
319
- group: propertyGroup,
320
- groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,
321
- name: propertyName
322
- };
323
- }
324
- /**
325
- * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).
326
- * Example: `{name: "accountNumber", value: "12345"}` becomes `mapObject["accountNumber"]="12345"`.
327
- *
328
- * @param {NameValuePair[]} elements flattened array of name-value-pairs
329
- * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.
330
- * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).
331
- * @protected
332
- * @memberof module:template_resolver.Resolver
333
- */
334
- function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {
335
- var index, element;
336
- for (index = 0; index < elements.length; index += 1) {
337
- element = elements[index];
338
- if (typeof filterMatchesFunction === "function" && filterMatchesFunction(element.name)) {
339
- mapObject[element.name] = element.value;
340
- }
306
+ /**
307
+ * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).
308
+ * Example: `{name: "accountNumber", value: "12345"}` becomes `mapObject["accountNumber"]="12345"`.
309
+ *
310
+ * @param {NameValuePair[]} elements flattened array of name-value-pairs
311
+ * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.
312
+ * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).
313
+ * @protected
314
+ * @memberof module:template_resolver.Resolver
315
+ */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {
316
+ var index, element;
317
+ for(index = 0; index < elements.length; index += 1){
318
+ element = elements[index];
319
+ if (typeof filterMatchesFunction === "function" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;
320
+ }
321
+ return mapObject;
341
322
  }
342
- return mapObject;
343
- }
344
- return Resolver;
345
- })();
323
+ return Resolver;
324
+ }();
346
325
 
347
- },{"../../lib/js/flattenToArray":"3Qsn4"}],"3Qsn4":[function(require,module,exports) {
326
+ },{"2bc8fdaaf35dfa57":"i4dBQ"}],"i4dBQ":[function(require,module,exports) {
348
327
  "use strict";
349
328
  /**
350
- * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss
351
- * @version ${project.version}
352
- * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}
353
- */
354
- var module = module || ({});
355
- // Fallback for vanilla js without modules
356
- /**
357
- * internal_object_tools. Not meant to be used outside this repository.
358
- * @default {}
359
- */
360
- var internal_object_tools = module.exports = {};
361
- // Export module for npm...
329
+ * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss
330
+ * @version ${project.version}
331
+ * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}
332
+ */ var module = module || {}; // Fallback for vanilla js without modules
362
333
  /**
363
- * @typedef {Object} NameValuePair
364
- * @property {string} name - point separated names of the flattened main and sub properties, e.g. "responses[2].hits.hits[4]._source.name".
365
- * @property {string} value - value of the property
366
- */
334
+ * internal_object_tools. Not meant to be used outside this repository.
335
+ * @default {}
336
+ */ var internal_object_tools = module.exports = {}; // Export module for npm...
367
337
  /**
368
- * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.
369
- * @param {number} maxRecursionDepth
370
- * @returns {NameValuePair[]} array of property name and value pairs
371
- */
372
- internal_object_tools.flattenToArray = function (data, maxRecursionDepth) {
373
- var result = [];
374
- if (typeof maxRecursionDepth !== "number" || maxRecursionDepth < 1) {
375
- maxRecursionDepth = 20;
376
- }
377
- function recurse(cur, prop, depth) {
378
- if (depth > maxRecursionDepth || typeof cur === "function") {
379
- return;
380
- }
381
- if (Object(cur) !== cur) {
382
- result.push({
383
- name: prop,
384
- value: cur
385
- });
386
- } else if (Array.isArray(cur)) {
387
- var i;
388
- var l = cur.length;
389
- for (i = 0; i < l; i += 1) {
390
- recurse(cur[i], prop + "[" + i + "]", depth + 1);
391
- }
392
- if (l === 0) {
393
- result[prop] = [];
394
- result.push({
395
- name: prop,
396
- value: ""
397
- });
398
- }
399
- } else {
400
- var isEmpty = true;
401
- var p;
402
- for (p in cur) {
403
- isEmpty = false;
404
- recurse(cur[p], prop ? prop + "." + p : p, depth + 1);
405
- }
406
- if (isEmpty && prop) {
407
- result.push({
408
- name: prop,
409
- value: ""
338
+ * @typedef {Object} NameValuePair
339
+ * @property {string} name - point separated names of the flattened main and sub properties, e.g. "responses[2].hits.hits[4]._source.name".
340
+ * @property {string} value - value of the property
341
+ */ /**
342
+ * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.
343
+ * @param {number} maxRecursionDepth
344
+ * @returns {NameValuePair[]} array of property name and value pairs
345
+ */ internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {
346
+ var result = [];
347
+ if (typeof maxRecursionDepth !== "number" || maxRecursionDepth < 1) maxRecursionDepth = 20;
348
+ function recurse(cur, prop, depth) {
349
+ if (depth > maxRecursionDepth || typeof cur === "function") return;
350
+ if (Object(cur) !== cur) result.push({
351
+ name: prop,
352
+ value: cur
410
353
  });
411
- }
354
+ else if (Array.isArray(cur)) {
355
+ var i;
356
+ var l = cur.length;
357
+ for(i = 0; i < l; i += 1)recurse(cur[i], prop + "[" + i + "]", depth + 1);
358
+ if (l === 0) {
359
+ result[prop] = [];
360
+ result.push({
361
+ name: prop,
362
+ value: ""
363
+ });
364
+ }
365
+ } else {
366
+ var isEmpty = true;
367
+ var p;
368
+ for(p in cur){
369
+ isEmpty = false;
370
+ recurse(cur[p], prop ? prop + "." + p : p, depth + 1);
371
+ }
372
+ if (isEmpty && prop) result.push({
373
+ name: prop,
374
+ value: ""
375
+ });
376
+ }
412
377
  }
413
- }
414
- recurse(data, "", 0);
415
- return result;
378
+ recurse(data, "", 0);
379
+ return result;
416
380
  };
417
381
 
418
- },{}]},["aHN8C"], "aHN8C", "parcelRequire9661")
382
+ },{}]},["4dShw"], "4dShw", "parcelRequirec1f2")
419
383