data-restructor 3.3.4 → 3.4.0

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