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,294 +142,270 @@
140
142
  this[globalName] = mainExports;
141
143
  }
142
144
  }
143
- })({"7smRW":[function(require,module,exports) {
145
+ })({"eeb0L":[function(require,module,exports) {
144
146
  "use strict";
145
- var described_field = require("../../src/js/describedfield.js");
147
+ var described_field = require("49c22594fe0218d9");
146
148
  module.exports = {
147
- described_field: described_field
149
+ described_field: described_field
148
150
  };
149
151
 
150
- },{"../../src/js/describedfield.js":"4X3T9"}],"4X3T9":[function(require,module,exports) {
152
+ },{"49c22594fe0218d9":"g0GVY"}],"g0GVY":[function(require,module,exports) {
151
153
  /**
152
- * @file Describes a data field of the restructured data.
153
- * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
154
- * @author JohT
155
- * @version ${project.version}
156
- */
157
- "use strict";
158
- var module = describedFieldInternalCreateIfNotExists(module);
159
- // Fallback for vanilla js without modules
154
+ * @file Describes a data field of the restructured data.
155
+ * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}
156
+ * @author JohT
157
+ * @version ${project.version}
158
+ */ "use strict";
159
+ var module = describedFieldInternalCreateIfNotExists(module); // Fallback for vanilla js without modules
160
160
  function describedFieldInternalCreateIfNotExists(objectToCheck) {
161
- return objectToCheck || ({});
161
+ return objectToCheck || {};
162
162
  }
163
163
  /**
164
- * Describes a data field of the restructured data.
165
- * @module described_field
166
- */
167
- var described_field = module.exports = {};
168
- // Export module for npm...
164
+ * Describes a data field of the restructured data.
165
+ * @module described_field
166
+ */ var described_field = module.exports = {}; // Export module for npm...
169
167
  described_field.internalCreateIfNotExists = describedFieldInternalCreateIfNotExists;
170
168
  /**
171
- * Describes a field of the restructured data.
172
- * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.
173
- *
174
- * @typedef {Object} module:described_field.DescribedDataField
175
- * @property {string} [category=""] - name of the category. Could contain a short domain name like "product" or "vendor".
176
- * @property {string} [type=""] - type of the data element. Examples: "summary" for e.g. a list overview. "detail" e.g. when a summary is selected. "filter" e.g. for field/value pair results that can be selected as data filters.
177
- * @property {string} [abbreviation=""] - one optional character, a symbol character or a short abbreviation of the category
178
- * @property {string} [image=""] - one optional path to an image resource
179
- * @property {string} index - array of numbers containing the splitted index. Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4]
180
- * @property {string[]} groupNames - array of names of all dynamically added properties representing groups
181
- * @property {string} displayName - display name of the field
182
- * @property {string} fieldName - field name
183
- * @property {{*}} value - content of the field
184
- * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields
185
- */
186
- described_field.DescribedDataFieldBuilder = (function () {
187
- /**
188
- * Builds a {@link module:described_field.DescribedDataField}.
189
- * DescribedDataField is the main element of the restructured data and therefore considered "public".
190
- * @constructs DescribedDataFieldBuilder
191
- * @alias module:described_field.DescribedDataFieldBuilder
192
- */
193
- function DescribedDataFieldBuilder() {
194
- /**
195
- * @type {module:described_field.DescribedDataField}
196
- */
197
- this.describedField = {
198
- category: "",
199
- type: "",
200
- abbreviation: "",
201
- image: "",
202
- index: [],
203
- groupNames: [],
204
- displayName: "",
205
- fieldName: "",
206
- value: ""
207
- };
208
- /**
209
- * Takes over all values of the template {@link module:described_field.DescribedDataField}.
210
- * @function
211
- * @param {module:described_field.DescribedDataField} template
212
- * @returns {DescribedDataFieldBuilder}
213
- * @example fromDescribedDataField(sourceField)
214
- */
215
- this.fromDescribedDataField = function (template) {
216
- this.category(template.category);
217
- this.type(template.type);
218
- this.abbreviation(template.abbreviation);
219
- this.image(template.image);
220
- this.index(template.index);
221
- this.groupNames(template.groupNames);
222
- this.displayName(template.displayName);
223
- this.fieldName(template.fieldName);
224
- this.value(template.value);
225
- return this;
226
- };
227
- /**
228
- * Sets the category.
229
- *
230
- * Contains a short domain nam, for example:
231
- * - "product" for products
232
- * - "vendor" for vendors
233
- *
234
- * @function
235
- * @param {String} [value=""]
236
- * @returns {DescribedDataFieldBuilder}
237
- * @example category("Product")
238
- */
239
- this.category = function (value) {
240
- this.describedField.category = withDefaultString(value, "");
241
- return this;
242
- };
243
- /**
244
- * Sets the type.
245
- *
246
- * Contains the type of the entry, for example:
247
- * - "summary" for e.g. a list overview.
248
- * - "detail" e.g. when a summary is selected.
249
- * - "filter" e.g. for field/value pair results that can be selected as search parameters.
250
- *
251
- * @function
252
- * @param {String} [value=""]
253
- * @returns {DescribedDataFieldBuilder}
254
- * @example type("summary")
255
- */
256
- this.type = function (value) {
257
- this.describedField.type = withDefaultString(value, "");
258
- return this;
259
- };
260
- /**
261
- * Sets the optional abbreviation.
262
- *
263
- * Contains a symbol character or a very short abbreviation of the category.
264
- * - "P" for products
265
- * - "V" for vendors
266
- *
267
- * @function
268
- * @param {String} [value=""]
269
- * @returns {DescribedDataFieldBuilder}
270
- * @example abbreviation("P")
271
- */
272
- this.abbreviation = function (value) {
273
- this.describedField.abbreviation = withDefaultString(value, "");
274
- return this;
275
- };
276
- /**
277
- * Sets the optional path to an image resource.
278
- *
279
- * @function
280
- * @param {String} [value=""]
281
- * @returns {DescribedDataFieldBuilder}
282
- * @example image("img/product.png")
283
- */
284
- this.image = function (value) {
285
- this.describedField.image = withDefaultString(value, "");
286
- return this;
287
- };
169
+ * Describes a field of the restructured data.
170
+ * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.
171
+ *
172
+ * @typedef {Object} module:described_field.DescribedDataField
173
+ * @property {string} [category=""] - name of the category. Could contain a short domain name like "product" or "vendor".
174
+ * @property {string} [type=""] - type of the data element. Examples: "summary" for e.g. a list overview. "detail" e.g. when a summary is selected. "filter" e.g. for field/value pair results that can be selected as data filters.
175
+ * @property {string} [abbreviation=""] - one optional character, a symbol character or a short abbreviation of the category
176
+ * @property {string} [image=""] - one optional path to an image resource
177
+ * @property {string} index - array of numbers containing the splitted index. Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4]
178
+ * @property {string[]} groupNames - array of names of all dynamically added properties representing groups
179
+ * @property {string} displayName - display name of the field
180
+ * @property {string} fieldName - field name
181
+ * @property {{*}} value - content of the field
182
+ * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields
183
+ */ described_field.DescribedDataFieldBuilder = function() {
288
184
  /**
289
- * Sets the index as an array of numbers containing the splitted array indexes of the source field.
290
- * Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4].
291
- *
292
- * @function
293
- * @param {number[]} [value=[]]
294
- * @returns {DescribedDataFieldBuilder}
295
- * @example index([2,4])
296
- */
297
- this.index = function (value) {
298
- this.describedField.index = withDefaultArray(value, []);
299
- return this;
300
- };
301
- /**
302
- * Sets the group names as an array of strings containing the names of the dynamically added properties,
303
- * that contain an array of {@link module:described_field.DescribedDataField}-Objects.
304
- *
305
- * @function
306
- * @param {string[]} [value=[]]
307
- * @returns {DescribedDataFieldBuilder}
308
- * @example groupNames(["summaries","details","options"])
309
- */
310
- this.groupNames = function (value) {
311
- this.describedField.groupNames = withDefaultArray(value, []);
312
- return this;
313
- };
314
- /**
315
- * Sets the display name.
316
- *
317
- * @function
318
- * @param {String} [value=""]
319
- * @returns {DescribedDataFieldBuilder}
320
- * @example displayName("Color")
321
- */
322
- this.displayName = function (value) {
323
- this.describedField.displayName = withDefaultString(value, "");
324
- return this;
325
- };
326
- /**
327
- * Sets the (technical) field name.
328
- *
329
- * @function
330
- * @param {String} [value=""]
331
- * @returns {DescribedDataFieldBuilder}
332
- * @example fieldName("color")
333
- */
334
- this.fieldName = function (value) {
335
- this.describedField.fieldName = withDefaultString(value, "");
336
- return this;
337
- };
338
- /**
339
- * Sets the value/content of the field.
340
- *
341
- * @function
342
- * @param {*} value
343
- * @returns {DescribedDataFieldBuilder}
344
- * @example value("darkblue")
345
- */
346
- this.value = function (value) {
347
- this.describedField.value = value;
348
- return this;
349
- };
350
- /**
351
- * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.
352
- * @function
353
- * @returns {module:described_field.DescribedDataField}
354
- */
355
- this.build = function () {
356
- return this.describedField;
357
- };
358
- }
359
- function isSpecifiedString(value) {
360
- return typeof value === "string" && value !== null && value !== "";
361
- }
362
- function withDefaultString(value, defaultValue) {
363
- return isSpecifiedString(value) ? value : defaultValue;
364
- }
365
- function withDefaultArray(value, defaultValue) {
366
- return value === undefined || value === null ? defaultValue : value;
367
- }
368
- return DescribedDataFieldBuilder;
369
- })();
185
+ * Builds a {@link module:described_field.DescribedDataField}.
186
+ * DescribedDataField is the main element of the restructured data and therefore considered "public".
187
+ * @constructs DescribedDataFieldBuilder
188
+ * @alias module:described_field.DescribedDataFieldBuilder
189
+ */ function DescribedDataFieldBuilder() {
190
+ /**
191
+ * @type {module:described_field.DescribedDataField}
192
+ */ this.describedField = {
193
+ category: "",
194
+ type: "",
195
+ abbreviation: "",
196
+ image: "",
197
+ index: [],
198
+ groupNames: [],
199
+ displayName: "",
200
+ fieldName: "",
201
+ value: ""
202
+ };
203
+ /**
204
+ * Takes over all values of the template {@link module:described_field.DescribedDataField}.
205
+ * @function
206
+ * @param {module:described_field.DescribedDataField} template
207
+ * @returns {DescribedDataFieldBuilder}
208
+ * @example fromDescribedDataField(sourceField)
209
+ */ this.fromDescribedDataField = function(template) {
210
+ this.category(template.category);
211
+ this.type(template.type);
212
+ this.abbreviation(template.abbreviation);
213
+ this.image(template.image);
214
+ this.index(template.index);
215
+ this.groupNames(template.groupNames);
216
+ this.displayName(template.displayName);
217
+ this.fieldName(template.fieldName);
218
+ this.value(template.value);
219
+ return this;
220
+ };
221
+ /**
222
+ * Sets the category.
223
+ *
224
+ * Contains a short domain nam, for example:
225
+ * - "product" for products
226
+ * - "vendor" for vendors
227
+ *
228
+ * @function
229
+ * @param {String} [value=""]
230
+ * @returns {DescribedDataFieldBuilder}
231
+ * @example category("Product")
232
+ */ this.category = function(value) {
233
+ this.describedField.category = withDefaultString(value, "");
234
+ return this;
235
+ };
236
+ /**
237
+ * Sets the type.
238
+ *
239
+ * Contains the type of the entry, for example:
240
+ * - "summary" for e.g. a list overview.
241
+ * - "detail" e.g. when a summary is selected.
242
+ * - "filter" e.g. for field/value pair results that can be selected as search parameters.
243
+ *
244
+ * @function
245
+ * @param {String} [value=""]
246
+ * @returns {DescribedDataFieldBuilder}
247
+ * @example type("summary")
248
+ */ this.type = function(value) {
249
+ this.describedField.type = withDefaultString(value, "");
250
+ return this;
251
+ };
252
+ /**
253
+ * Sets the optional abbreviation.
254
+ *
255
+ * Contains a symbol character or a very short abbreviation of the category.
256
+ * - "P" for products
257
+ * - "V" for vendors
258
+ *
259
+ * @function
260
+ * @param {String} [value=""]
261
+ * @returns {DescribedDataFieldBuilder}
262
+ * @example abbreviation("P")
263
+ */ this.abbreviation = function(value) {
264
+ this.describedField.abbreviation = withDefaultString(value, "");
265
+ return this;
266
+ };
267
+ /**
268
+ * Sets the optional path to an image resource.
269
+ *
270
+ * @function
271
+ * @param {String} [value=""]
272
+ * @returns {DescribedDataFieldBuilder}
273
+ * @example image("img/product.png")
274
+ */ this.image = function(value) {
275
+ this.describedField.image = withDefaultString(value, "");
276
+ return this;
277
+ };
278
+ /**
279
+ * Sets the index as an array of numbers containing the splitted array indexes of the source field.
280
+ * Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4].
281
+ *
282
+ * @function
283
+ * @param {number[]} [value=[]]
284
+ * @returns {DescribedDataFieldBuilder}
285
+ * @example index([2,4])
286
+ */ this.index = function(value) {
287
+ this.describedField.index = withDefaultArray(value, []);
288
+ return this;
289
+ };
290
+ /**
291
+ * Sets the group names as an array of strings containing the names of the dynamically added properties,
292
+ * that contain an array of {@link module:described_field.DescribedDataField}-Objects.
293
+ *
294
+ * @function
295
+ * @param {string[]} [value=[]]
296
+ * @returns {DescribedDataFieldBuilder}
297
+ * @example groupNames(["summaries","details","options"])
298
+ */ this.groupNames = function(value) {
299
+ this.describedField.groupNames = withDefaultArray(value, []);
300
+ return this;
301
+ };
302
+ /**
303
+ * Sets the display name.
304
+ *
305
+ * @function
306
+ * @param {String} [value=""]
307
+ * @returns {DescribedDataFieldBuilder}
308
+ * @example displayName("Color")
309
+ */ this.displayName = function(value) {
310
+ this.describedField.displayName = withDefaultString(value, "");
311
+ return this;
312
+ };
313
+ /**
314
+ * Sets the (technical) field name.
315
+ *
316
+ * @function
317
+ * @param {String} [value=""]
318
+ * @returns {DescribedDataFieldBuilder}
319
+ * @example fieldName("color")
320
+ */ this.fieldName = function(value) {
321
+ this.describedField.fieldName = withDefaultString(value, "");
322
+ return this;
323
+ };
324
+ /**
325
+ * Sets the value/content of the field.
326
+ *
327
+ * @function
328
+ * @param {*} value
329
+ * @returns {DescribedDataFieldBuilder}
330
+ * @example value("darkblue")
331
+ */ this.value = function(value) {
332
+ this.describedField.value = value;
333
+ return this;
334
+ };
335
+ /**
336
+ * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.
337
+ * @function
338
+ * @returns {module:described_field.DescribedDataField}
339
+ */ this.build = function() {
340
+ return this.describedField;
341
+ };
342
+ }
343
+ function isSpecifiedString(value) {
344
+ return typeof value === "string" && value !== null && value !== "";
345
+ }
346
+ function withDefaultString(value, defaultValue) {
347
+ return isSpecifiedString(value) ? value : defaultValue;
348
+ }
349
+ function withDefaultArray(value, defaultValue) {
350
+ return value === undefined || value === null ? defaultValue : value;
351
+ }
352
+ return DescribedDataFieldBuilder;
353
+ }();
370
354
  /**
371
- * Creates a new described data field with all properties of the original one except for dynamically added groups.
372
- * @param {module:described_field.DescribedDataField} describedDataField
373
- * @returns {module:described_field.DescribedDataField}
374
- * @memberof module:described_field
375
- */
376
- described_field.copyWithoutGroups = function (describedDataField) {
377
- return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();
355
+ * Creates a new described data field with all properties of the original one except for dynamically added groups.
356
+ * @param {module:described_field.DescribedDataField} describedDataField
357
+ * @returns {module:described_field.DescribedDataField}
358
+ * @memberof module:described_field
359
+ */ described_field.copyWithoutGroups = function(describedDataField) {
360
+ return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();
378
361
  };
379
- described_field.DescribedDataFieldGroup = (function () {
380
- /**
381
- * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties
382
- * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.
383
- *
384
- * @param {module:described_field.DescribedDataField} dataField
385
- * @constructs DescribedDataFieldGroup
386
- * @alias module:described_field.DescribedDataFieldGroup
387
- * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry("details", detailField);
388
- */
389
- function DescribedDataFieldGroup(dataField) {
390
- this.dataField = dataField;
391
- /**
392
- * Adds an entry to the given group. If the group does not exist, it will be created.
393
- * @function
394
- * @param {String} groupName name of the group to which the entry will be added
395
- * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group
396
- * @returns {DescribedDataFieldGroup}
397
- */
398
- this.addGroupEntry = function (groupName, describedField) {
399
- this.addGroupEntries(groupName, [describedField]);
400
- return this;
401
- };
362
+ described_field.DescribedDataFieldGroup = function() {
402
363
  /**
403
- * Adds entries to the given group. If the group does not exist, it will be created.
404
- * @function
405
- * @param {String} groupName name of the group to which the entries will be added
406
- * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group
407
- * @returns {DescribedDataFieldGroup}
408
- */
409
- this.addGroupEntries = function (groupName, describedFields) {
410
- if (!groupName || groupName.length === 0) {
411
- return this;
412
- }
413
- if (!describedFields || describedFields.length === 0) {
414
- return this;
415
- }
416
- if (this.dataField[groupName] === undefined) {
417
- this.dataField.groupNames.push(groupName);
418
- this.dataField[groupName] = [];
419
- }
420
- var index;
421
- var describedField;
422
- for (index = 0; index < describedFields.length; index += 1) {
423
- describedField = describedFields[index];
424
- this.dataField[groupName].push(describedField);
425
- }
426
- return this;
427
- };
428
- }
429
- return DescribedDataFieldGroup;
430
- })();
364
+ * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties
365
+ * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.
366
+ *
367
+ * @param {module:described_field.DescribedDataField} dataField
368
+ * @constructs DescribedDataFieldGroup
369
+ * @alias module:described_field.DescribedDataFieldGroup
370
+ * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry("details", detailField);
371
+ */ function DescribedDataFieldGroup(dataField) {
372
+ this.dataField = dataField;
373
+ /**
374
+ * Adds an entry to the given group. If the group does not exist, it will be created.
375
+ * @function
376
+ * @param {String} groupName name of the group to which the entry will be added
377
+ * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group
378
+ * @returns {DescribedDataFieldGroup}
379
+ */ this.addGroupEntry = function(groupName, describedField) {
380
+ this.addGroupEntries(groupName, [
381
+ describedField
382
+ ]);
383
+ return this;
384
+ };
385
+ /**
386
+ * Adds entries to the given group. If the group does not exist, it will be created.
387
+ * @function
388
+ * @param {String} groupName name of the group to which the entries will be added
389
+ * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group
390
+ * @returns {DescribedDataFieldGroup}
391
+ */ this.addGroupEntries = function(groupName, describedFields) {
392
+ if (!groupName || groupName.length === 0) return this;
393
+ if (!describedFields || describedFields.length === 0) return this;
394
+ if (this.dataField[groupName] === undefined) {
395
+ this.dataField.groupNames.push(groupName);
396
+ this.dataField[groupName] = [];
397
+ }
398
+ var index;
399
+ var describedField;
400
+ for(index = 0; index < describedFields.length; index += 1){
401
+ describedField = describedFields[index];
402
+ this.dataField[groupName].push(describedField);
403
+ }
404
+ return this;
405
+ };
406
+ }
407
+ return DescribedDataFieldGroup;
408
+ }();
431
409
 
432
- },{}]},["7smRW"], "7smRW", "parcelRequire9661")
410
+ },{}]},["eeb0L"], "eeb0L", "parcelRequirec1f2")
433
411