data-restructor 3.4.0 → 3.4.2

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 (46) hide show
  1. package/.auto-changelog +9 -0
  2. package/.auto-changelog-template.hbs +36 -0
  3. package/.github/workflows/codeql-analysis.yml +1 -1
  4. package/.github/workflows/continuous-integration.yaml +10 -1
  5. package/CHANGELOG.md +136 -31
  6. package/Commands.md +1 -0
  7. package/README.md +5 -0
  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 +53 -58
  14. package/devdist/datarestructor.js +35 -42
  15. package/devdist/describedfield-ie.js +10 -12
  16. package/devdist/describedfield.js +8 -10
  17. package/devdist/templateResolver-ie.js +22 -26
  18. package/devdist/templateResolver.js +11 -16
  19. package/dist/datarestructor-ie.js +693 -1
  20. package/dist/datarestructor-ie.js.map +1 -1
  21. package/dist/datarestructor.js +687 -1
  22. package/dist/datarestructor.js.map +1 -1
  23. package/dist/describedfield-ie.js +142 -1
  24. package/dist/describedfield-ie.js.map +1 -1
  25. package/dist/describedfield.js +142 -1
  26. package/dist/describedfield.js.map +1 -1
  27. package/dist/templateResolver-ie.js +82 -1
  28. package/dist/templateResolver-ie.js.map +1 -1
  29. package/dist/templateResolver.js +76 -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 +6 -1
  34. package/docs/module-datarestructor.DescribedEntryCreator.html +94 -94
  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 +605 -605
  38. package/docs/module-datarestructor.html +959 -995
  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 -37
  42. package/docs/module-template_resolver.Resolver.html +167 -167
  43. package/docs/module-template_resolver.html +1 -37
  44. package/docs/templateResolver.js.html +1 -1
  45. package/package.json +13 -9
  46. package/renovate.json +0 -6
@@ -347,7 +347,7 @@
347
347
 
348
348
 
349
349
 
350
- <h4 class="name" id=".applyGroupDestinationPattern"><span class="type-signature">(protected, static) </span>applyGroupDestinationPattern<span class="signature">(groupedObject)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
350
+ <h4 class="name" id="enableDebugMode"><span class="type-signature"></span>enableDebugMode<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
351
351
 
352
352
 
353
353
 
@@ -355,11 +355,7 @@
355
355
 
356
356
 
357
357
  <div class="description">
358
- <p>Takes already grouped <a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a> objects and
359
- uses their &quot;_identifier.groupDestinationId&quot; (if exists)
360
- to move groups to the given destination.</p>
361
- <p>This is useful, if separately described groups like &quot;summary&quot; and &quot;detail&quot; should be put together,
362
- so that every summery contains a group with the regarding details.</p>
358
+ <p>Enables debug mode. Logs additional information.</p>
363
359
  </div>
364
360
 
365
361
 
@@ -370,55 +366,6 @@ so that every summery contains a group with the regarding details.</p>
370
366
 
371
367
 
372
368
 
373
- <h5>Parameters:</h5>
374
-
375
-
376
- <table class="params">
377
- <thead>
378
- <tr>
379
-
380
- <th>Name</th>
381
-
382
-
383
- <th>Type</th>
384
-
385
-
386
-
387
-
388
-
389
- <th class="last">Description</th>
390
- </tr>
391
- </thead>
392
-
393
- <tbody>
394
-
395
-
396
- <tr>
397
-
398
- <td class="name"><code>groupedObject</code></td>
399
-
400
-
401
- <td class="type">
402
-
403
-
404
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
405
-
406
-
407
-
408
- </td>
409
-
410
-
411
-
412
-
413
-
414
- <td class="description last"><p>already grouped entries</p></td>
415
- </tr>
416
-
417
-
418
- </tbody>
419
- </table>
420
-
421
-
422
369
 
423
370
 
424
371
 
@@ -452,7 +399,7 @@ so that every summery contains a group with the regarding details.</p>
452
399
 
453
400
  <dt class="tag-source">Source:</dt>
454
401
  <dd class="tag-source"><ul class="dummy"><li>
455
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line996">line 996</a>
402
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line688">line 688</a>
456
403
  </li></ul></dd>
457
404
 
458
405
 
@@ -488,7 +435,7 @@ so that every summery contains a group with the regarding details.</p>
488
435
  </dt>
489
436
  <dd>
490
437
 
491
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
438
+ <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
492
439
 
493
440
 
494
441
  </dd>
@@ -506,7 +453,7 @@ so that every summery contains a group with the regarding details.</p>
506
453
 
507
454
 
508
455
 
509
- <h4 class="name" id=".asIdBasedObject"><span class="type-signature">(protected, static) </span>asIdBasedObject<span class="signature">(elements, idOfElementFunction)</span><span class="type-signature"></span></h4>
456
+ <h4 class="name" id="processJson"><span class="type-signature"></span>processJson<span class="signature">(data)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
510
457
 
511
458
 
512
459
 
@@ -514,9 +461,7 @@ so that every summery contains a group with the regarding details.</p>
514
461
 
515
462
 
516
463
  <div class="description">
517
- <p>Converts the given elements to an object, that provides these
518
- entries by their id. For example, [{id: A, value: 1}] becomes
519
- result['A'] = 1.</p>
464
+ <p>&quot;Assembly line&quot;, that takes the (pared JSON) data and processes it using all given descriptions in their given order.</p>
520
465
  </div>
521
466
 
522
467
 
@@ -552,36 +497,13 @@ result['A'] = 1.</p>
552
497
 
553
498
  <tr>
554
499
 
555
- <td class="name"><code>elements</code></td>
556
-
557
-
558
- <td class="type">
559
-
560
-
561
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
562
-
563
-
564
-
565
- </td>
566
-
567
-
568
-
569
-
570
-
571
- <td class="description last"><p>of DescribedEntry elements</p></td>
572
- </tr>
573
-
574
-
575
-
576
- <tr>
577
-
578
- <td class="name"><code>idOfElementFunction</code></td>
500
+ <td class="name"><code>data</code></td>
579
501
 
580
502
 
581
503
  <td class="type">
582
504
 
583
505
 
584
- <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
506
+ <span class="param-type">object</span>
585
507
 
586
508
 
587
509
 
@@ -591,7 +513,7 @@ result['A'] = 1.</p>
591
513
 
592
514
 
593
515
 
594
- <td class="description last"><p>returns the id of an DescribedEntry</p></td>
516
+ <td class="description last"><p>parsed JSON data or any other data object</p></td>
595
517
  </tr>
596
518
 
597
519
 
@@ -632,7 +554,7 @@ result['A'] = 1.</p>
632
554
 
633
555
  <dt class="tag-source">Source:</dt>
634
556
  <dd class="tag-source"><ul class="dummy"><li>
635
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line890">line 890</a>
557
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line735">line 735</a>
636
558
  </li></ul></dd>
637
559
 
638
560
 
@@ -660,17 +582,33 @@ result['A'] = 1.</p>
660
582
  <h5>Returns:</h5>
661
583
 
662
584
 
663
- <div class="param-desc">
664
- <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
665
- </div>
666
585
 
667
586
 
587
+ <dl>
588
+ <dt>
589
+ Type
590
+ </dt>
591
+ <dd>
592
+
593
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
594
+
595
+
596
+ </dd>
597
+ </dl>
668
598
 
669
599
 
670
600
 
671
601
 
672
602
 
673
603
 
604
+ <h5>Example</h5>
605
+
606
+ <pre class="prettyprint"><code>var allDescriptions = [];
607
+ allDescriptions.push(summariesDescription());
608
+ allDescriptions.push(detailsDescription());
609
+ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData);</code></pre>
610
+
611
+
674
612
 
675
613
 
676
614
 
@@ -678,7 +616,7 @@ result['A'] = 1.</p>
678
616
 
679
617
 
680
618
 
681
- <h4 class="name" id=".deduplicateFlattenedData"><span class="type-signature">(protected, static) </span>deduplicateFlattenedData<span class="signature">(entries, entriesToMerge, idOfElementFunction)</span><span class="type-signature"></span></h4>
619
+ <h4 class="name" id="setMaxRecursionDepth"><span class="type-signature"></span>setMaxRecursionDepth<span class="signature">(value)</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
682
620
 
683
621
 
684
622
 
@@ -686,18 +624,7 @@ result['A'] = 1.</p>
686
624
 
687
625
 
688
626
  <div class="description">
689
- <p>Takes two arrays of objects, e.g. [{id: B, value: 2},{id: C, value: 3}]
690
- and [{id: A, value: 1},{id: B, value: 4}] and merges them into one:
691
- [{id: C, value: 3},{id: A, value: 1},{id: B, value: 4}]</p>
692
- <p>Entries with the same id (&quot;duplicates&quot;) will be overwritten.
693
- Only the last element with the same id remains. The order is
694
- determined by the order of the array elements, whereas the first
695
- array comes before the second one. This means, that entries with the
696
- same id in the second array overwrite entries in the first array,
697
- and entries occurring later in the array overwrite earlier ones,
698
- if they have the same id.</p>
699
- <p>&quot;entriesToMerge&quot; will be returned directly, if &quot;entries&quot; is null or empty.</p>
700
- <p>The id is extracted from every element using their deduplication pattern (if available).</p>
627
+ <p>Sets the maximum recursion depth. Defaults to 8 if not set.</p>
701
628
  </div>
702
629
 
703
630
 
@@ -733,59 +660,13 @@ if they have the same id.</p>
733
660
 
734
661
  <tr>
735
662
 
736
- <td class="name"><code>entries</code></td>
737
-
738
-
739
- <td class="type">
740
-
741
-
742
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
743
-
744
-
745
-
746
- </td>
747
-
748
-
749
-
750
-
751
-
752
- <td class="description last"></td>
753
- </tr>
754
-
755
-
756
-
757
- <tr>
758
-
759
- <td class="name"><code>entriesToMerge</code></td>
760
-
761
-
762
- <td class="type">
763
-
764
-
765
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
766
-
767
-
768
-
769
- </td>
770
-
771
-
772
-
773
-
774
-
775
- <td class="description last"></td>
776
- </tr>
777
-
778
-
779
-
780
- <tr>
781
-
782
- <td class="name"><code>idOfElementFunction</code></td>
663
+ <td class="name"><code>value</code></td>
783
664
 
784
665
 
785
666
  <td class="type">
786
667
 
787
668
 
788
- <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
669
+ <span class="param-type">number</span>
789
670
 
790
671
 
791
672
 
@@ -795,7 +676,7 @@ if they have the same id.</p>
795
676
 
796
677
 
797
678
 
798
- <td class="description last"><p>returns the id of an DescribedEntry</p></td>
679
+ <td class="description last"><p>non negative number.</p></td>
799
680
  </tr>
800
681
 
801
682
 
@@ -836,20 +717,13 @@ if they have the same id.</p>
836
717
 
837
718
  <dt class="tag-source">Source:</dt>
838
719
  <dd class="tag-source"><ul class="dummy"><li>
839
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line870">line 870</a>
720
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line698">line 698</a>
840
721
  </li></ul></dd>
841
722
 
842
723
 
843
724
 
844
725
 
845
726
 
846
- <dt class="tag-see">See:</dt>
847
- <dd class="tag-see">
848
- <ul>
849
- <li>mergeFlattenedData</li>
850
- </ul>
851
- </dd>
852
-
853
727
 
854
728
 
855
729
  </dl>
@@ -868,6 +742,24 @@ if they have the same id.</p>
868
742
 
869
743
 
870
744
 
745
+ <h5>Returns:</h5>
746
+
747
+
748
+
749
+
750
+ <dl>
751
+ <dt>
752
+ Type
753
+ </dt>
754
+ <dd>
755
+
756
+ <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
757
+
758
+
759
+ </dd>
760
+ </dl>
761
+
762
+
871
763
 
872
764
 
873
765
 
@@ -879,7 +771,7 @@ if they have the same id.</p>
879
771
 
880
772
 
881
773
 
882
- <h4 class="name" id=".extractEntriesByDescription"><span class="type-signature">(protected, static) </span>extractEntriesByDescription<span class="signature">(flattenedData)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
774
+ <h4 class="name" id="setRemoveDuplicationAboveRecursionDepth"><span class="type-signature"></span>setRemoveDuplicationAboveRecursionDepth<span class="signature">(value)</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
883
775
 
884
776
 
885
777
 
@@ -887,7 +779,13 @@ if they have the same id.</p>
887
779
 
888
780
 
889
781
  <div class="description">
890
- <p>Extracts entries out of &quot;flattened&quot; JSON data and provides an array of objects.</p>
782
+ <p>Sets the recursion depth above which duplication will be removed. Duplications below it remain unchanged.
783
+ Defaults to 1.</p>
784
+ <p>Since fields can contain groups of fields that can contain groups of fields..., cyclic
785
+ data structures are possible by nature and will lead to duplications. Some of them
786
+ might be intended e.g. to take one (sub-)field with all (duplicated) groups.
787
+ To restrict duplications and improve performance it is beneficial to define a
788
+ recursion depth, above which further duplication won't be used and should be removed/avoided.</p>
891
789
  </div>
892
790
 
893
791
 
@@ -923,13 +821,13 @@ if they have the same id.</p>
923
821
 
924
822
  <tr>
925
823
 
926
- <td class="name"><code>flattenedData</code></td>
824
+ <td class="name"><code>value</code></td>
927
825
 
928
826
 
929
827
  <td class="type">
930
828
 
931
829
 
932
- <span class="param-type">Array.&lt;Object></span>
830
+ <span class="param-type">number</span>
933
831
 
934
832
 
935
833
 
@@ -939,114 +837,19 @@ if they have the same id.</p>
939
837
 
940
838
 
941
839
 
942
- <td class="description last"><p>flattened json from search query result</p>
943
- <h6>Properties</h6>
944
-
840
+ <td class="description last"><p>non negative number.</p></td>
841
+ </tr>
945
842
 
946
- <table class="params">
947
- <thead>
948
- <tr>
949
-
950
- <th>Name</th>
951
-
843
+
844
+ </tbody>
845
+ </table>
952
846
 
953
- <th>Type</th>
954
847
 
955
-
956
848
 
957
-
958
849
 
959
- <th class="last">Description</th>
960
- </tr>
961
- </thead>
962
850
 
963
- <tbody>
964
-
965
851
 
966
- <tr>
967
-
968
- <td class="name"><code>name</code></td>
969
-
970
-
971
- <td class="type">
972
-
973
-
974
- <span class="param-type">string</span>
975
-
976
-
977
-
978
- </td>
979
-
980
-
981
-
982
-
983
-
984
- <td class="description last"><p>name of the property in hierarchical order separated by points</p></td>
985
- </tr>
986
-
987
-
988
-
989
- <tr>
990
-
991
- <td class="name"><code>value</code></td>
992
-
993
-
994
- <td class="type">
995
-
996
-
997
- <span class="param-type">string</span>
998
-
999
-
1000
-
1001
- </td>
1002
-
1003
-
1004
-
1005
-
1006
-
1007
- <td class="description last"><p>value of the property as string</p></td>
1008
- </tr>
1009
-
1010
-
1011
- </tbody>
1012
- </table>
1013
-
1014
- </td>
1015
- </tr>
1016
-
1017
-
1018
-
1019
- <tr>
1020
-
1021
- <td class="name"><code></code></td>
1022
-
1023
-
1024
- <td class="type">
1025
-
1026
-
1027
- <span class="param-type"><a href="module-datarestructor.html#.PropertyStructureDescription">module:datarestructor.PropertyStructureDescription</a></span>
1028
-
1029
-
1030
-
1031
- </td>
1032
-
1033
-
1034
-
1035
-
1036
-
1037
- <td class="description last"><p>description of structure of the entries that should be extracted</p></td>
1038
- </tr>
1039
-
1040
-
1041
- </tbody>
1042
- </table>
1043
-
1044
-
1045
-
1046
-
1047
-
1048
-
1049
- <dl class="details">
852
+ <dl class="details">
1050
853
 
1051
854
 
1052
855
 
@@ -1075,7 +878,7 @@ if they have the same id.</p>
1075
878
 
1076
879
  <dt class="tag-source">Source:</dt>
1077
880
  <dd class="tag-source"><ul class="dummy"><li>
1078
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line967">line 967</a>
881
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line718">line 718</a>
1079
882
  </li></ul></dd>
1080
883
 
1081
884
 
@@ -1111,7 +914,7 @@ if they have the same id.</p>
1111
914
  </dt>
1112
915
  <dd>
1113
916
 
1114
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
917
+ <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
1115
918
 
1116
919
 
1117
920
  </dd>
@@ -1129,7 +932,7 @@ if they have the same id.</p>
1129
932
 
1130
933
 
1131
934
 
1132
- <h4 class="name" id=".fillInArrayValues"><span class="type-signature">(protected, static) </span>fillInArrayValues<span class="signature">()</span><span class="type-signature"></span></h4>
935
+ <h4 class="name" id=".applyGroupDestinationPattern"><span class="type-signature">(protected, static) </span>applyGroupDestinationPattern<span class="signature">(groupedObject)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
1133
936
 
1134
937
 
1135
938
 
@@ -1137,9 +940,11 @@ if they have the same id.</p>
1137
940
 
1138
941
 
1139
942
  <div class="description">
1140
- <p>Fills in extra &quot;_comma_separated_values&quot; properties into the flattened data
1141
- for properties that end with an array. E.g. response.hits.hits.tags[0]=&quot;active&quot; and response.hits.hits.tags[0]=&quot;ready&quot;
1142
- will lead to the extra element &quot;response.hits.hits.tags_comma_separated_values=&quot;active, ready&quot;.</p>
943
+ <p>Takes already grouped <a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a> objects and
944
+ uses their &quot;_identifier.groupDestinationId&quot; (if exists)
945
+ to move groups to the given destination.</p>
946
+ <p>This is useful, if separately described groups like &quot;summary&quot; and &quot;detail&quot; should be put together,
947
+ so that every summery contains a group with the regarding details.</p>
1143
948
  </div>
1144
949
 
1145
950
 
@@ -1150,6 +955,55 @@ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_val
1150
955
 
1151
956
 
1152
957
 
958
+ <h5>Parameters:</h5>
959
+
960
+
961
+ <table class="params">
962
+ <thead>
963
+ <tr>
964
+
965
+ <th>Name</th>
966
+
967
+
968
+ <th>Type</th>
969
+
970
+
971
+
972
+
973
+
974
+ <th class="last">Description</th>
975
+ </tr>
976
+ </thead>
977
+
978
+ <tbody>
979
+
980
+
981
+ <tr>
982
+
983
+ <td class="name"><code>groupedObject</code></td>
984
+
985
+
986
+ <td class="type">
987
+
988
+
989
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
990
+
991
+
992
+
993
+ </td>
994
+
995
+
996
+
997
+
998
+
999
+ <td class="description last"><p>already grouped entries</p></td>
1000
+ </tr>
1001
+
1002
+
1003
+ </tbody>
1004
+ </table>
1005
+
1006
+
1153
1007
 
1154
1008
 
1155
1009
 
@@ -1183,7 +1037,7 @@ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_val
1183
1037
 
1184
1038
  <dt class="tag-source">Source:</dt>
1185
1039
  <dd class="tag-source"><ul class="dummy"><li>
1186
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1028">line 1028</a>
1040
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line996">line 996</a>
1187
1041
  </li></ul></dd>
1188
1042
 
1189
1043
 
@@ -1211,11 +1065,19 @@ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_val
1211
1065
  <h5>Returns:</h5>
1212
1066
 
1213
1067
 
1214
- <div class="param-desc">
1215
- <p>flattened data with filled in &quot;_comma_separated_values&quot; properties</p>
1216
- </div>
1217
1068
 
1218
1069
 
1070
+ <dl>
1071
+ <dt>
1072
+ Type
1073
+ </dt>
1074
+ <dd>
1075
+
1076
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1077
+
1078
+
1079
+ </dd>
1080
+ </dl>
1219
1081
 
1220
1082
 
1221
1083
 
@@ -1229,7 +1091,7 @@ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_val
1229
1091
 
1230
1092
 
1231
1093
 
1232
- <h4 class="name" id=".forEachGroupEntry"><span class="type-signature">(protected, static) </span>forEachGroupEntry<span class="signature">(rootEntry, onFoundEntry)</span><span class="type-signature"></span></h4>
1094
+ <h4 class="name" id=".asIdBasedObject"><span class="type-signature">(protected, static) </span>asIdBasedObject<span class="signature">(elements, idOfElementFunction)</span><span class="type-signature"></span></h4>
1233
1095
 
1234
1096
 
1235
1097
 
@@ -1237,8 +1099,9 @@ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_val
1237
1099
 
1238
1100
 
1239
1101
  <div class="description">
1240
- <p>Traverses through all groups and their entries and calls the given function on every found entry
1241
- with the group name and the entry itself as parameters.</p>
1102
+ <p>Converts the given elements to an object, that provides these
1103
+ entries by their id. For example, [{id: A, value: 1}] becomes
1104
+ result['A'] = 1.</p>
1242
1105
  </div>
1243
1106
 
1244
1107
 
@@ -1274,13 +1137,13 @@ with the group name and the entry itself as parameters.</p>
1274
1137
 
1275
1138
  <tr>
1276
1139
 
1277
- <td class="name"><code>rootEntry</code></td>
1140
+ <td class="name"><code>elements</code></td>
1278
1141
 
1279
1142
 
1280
1143
  <td class="type">
1281
1144
 
1282
1145
 
1283
- <span class="param-type"><a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a></span>
1146
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1284
1147
 
1285
1148
 
1286
1149
 
@@ -1290,20 +1153,20 @@ with the group name and the entry itself as parameters.</p>
1290
1153
 
1291
1154
 
1292
1155
 
1293
- <td class="description last"></td>
1156
+ <td class="description last"><p>of DescribedEntry elements</p></td>
1294
1157
  </tr>
1295
1158
 
1296
1159
 
1297
1160
 
1298
1161
  <tr>
1299
1162
 
1300
- <td class="name"><code>onFoundEntry</code></td>
1163
+ <td class="name"><code>idOfElementFunction</code></td>
1301
1164
 
1302
1165
 
1303
1166
  <td class="type">
1304
1167
 
1305
1168
 
1306
- <span class="param-type"><a href="module-datarestructor.html#.onEntryFoundFunction">module:datarestructor.onEntryFoundFunction</a></span>
1169
+ <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
1307
1170
 
1308
1171
 
1309
1172
 
@@ -1313,7 +1176,7 @@ with the group name and the entry itself as parameters.</p>
1313
1176
 
1314
1177
 
1315
1178
 
1316
- <td class="description last"></td>
1179
+ <td class="description last"><p>returns the id of an DescribedEntry</p></td>
1317
1180
  </tr>
1318
1181
 
1319
1182
 
@@ -1354,7 +1217,7 @@ with the group name and the entry itself as parameters.</p>
1354
1217
 
1355
1218
  <dt class="tag-source">Source:</dt>
1356
1219
  <dd class="tag-source"><ul class="dummy"><li>
1357
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1199">line 1199</a>
1220
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line890">line 890</a>
1358
1221
  </li></ul></dd>
1359
1222
 
1360
1223
 
@@ -1379,6 +1242,16 @@ with the group name and the entry itself as parameters.</p>
1379
1242
 
1380
1243
 
1381
1244
 
1245
+ <h5>Returns:</h5>
1246
+
1247
+
1248
+ <div class="param-desc">
1249
+ <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
1250
+ </div>
1251
+
1252
+
1253
+
1254
+
1382
1255
 
1383
1256
 
1384
1257
 
@@ -1390,7 +1263,7 @@ with the group name and the entry itself as parameters.</p>
1390
1263
 
1391
1264
 
1392
1265
 
1393
- <h4 class="name" id=".groupById"><span class="type-signature">(protected, static) </span>groupById<span class="signature">(elements, groupNameOfElementFunction, groupIdOfElementFunction)</span><span class="type-signature"></span></h4>
1266
+ <h4 class="name" id=".deduplicateFlattenedData"><span class="type-signature">(protected, static) </span>deduplicateFlattenedData<span class="signature">(entries, entriesToMerge, idOfElementFunction)</span><span class="type-signature"></span></h4>
1394
1267
 
1395
1268
 
1396
1269
 
@@ -1398,10 +1271,18 @@ with the group name and the entry itself as parameters.</p>
1398
1271
 
1399
1272
 
1400
1273
  <div class="description">
1401
- <p>Converts the given elements into an object, that provides these
1402
- entries by their id. For example, [{id: A, value: 1}] becomes
1403
- result['A'] = 1. Furthermore, this function creates a group property (with the name )
1404
- and collects all related elements (specified by their group pattern) in it.</p>
1274
+ <p>Takes two arrays of objects, e.g. [{id: B, value: 2},{id: C, value: 3}]
1275
+ and [{id: A, value: 1},{id: B, value: 4}] and merges them into one:
1276
+ [{id: C, value: 3},{id: A, value: 1},{id: B, value: 4}]</p>
1277
+ <p>Entries with the same id (&quot;duplicates&quot;) will be overwritten.
1278
+ Only the last element with the same id remains. The order is
1279
+ determined by the order of the array elements, whereas the first
1280
+ array comes before the second one. This means, that entries with the
1281
+ same id in the second array overwrite entries in the first array,
1282
+ and entries occurring later in the array overwrite earlier ones,
1283
+ if they have the same id.</p>
1284
+ <p>&quot;entriesToMerge&quot; will be returned directly, if &quot;entries&quot; is null or empty.</p>
1285
+ <p>The id is extracted from every element using their deduplication pattern (if available).</p>
1405
1286
  </div>
1406
1287
 
1407
1288
 
@@ -1437,7 +1318,7 @@ and collects all related elements (specified by their group pattern) in it.</p>
1437
1318
 
1438
1319
  <tr>
1439
1320
 
1440
- <td class="name"><code>elements</code></td>
1321
+ <td class="name"><code>entries</code></td>
1441
1322
 
1442
1323
 
1443
1324
  <td class="type">
@@ -1453,20 +1334,20 @@ and collects all related elements (specified by their group pattern) in it.</p>
1453
1334
 
1454
1335
 
1455
1336
 
1456
- <td class="description last"><p>of DescribedEntry elements</p></td>
1337
+ <td class="description last"></td>
1457
1338
  </tr>
1458
1339
 
1459
1340
 
1460
1341
 
1461
1342
  <tr>
1462
1343
 
1463
- <td class="name"><code>groupNameOfElementFunction</code></td>
1344
+ <td class="name"><code>entriesToMerge</code></td>
1464
1345
 
1465
1346
 
1466
1347
  <td class="type">
1467
1348
 
1468
1349
 
1469
- <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
1350
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1470
1351
 
1471
1352
 
1472
1353
 
@@ -1476,14 +1357,14 @@ and collects all related elements (specified by their group pattern) in it.</p>
1476
1357
 
1477
1358
 
1478
1359
 
1479
- <td class="description last"><p>function, that returns the name of the group property that will be created inside the &quot;main&quot; element.</p></td>
1360
+ <td class="description last"></td>
1480
1361
  </tr>
1481
1362
 
1482
1363
 
1483
1364
 
1484
1365
  <tr>
1485
1366
 
1486
- <td class="name"><code>groupIdOfElementFunction</code></td>
1367
+ <td class="name"><code>idOfElementFunction</code></td>
1487
1368
 
1488
1369
 
1489
1370
  <td class="type">
@@ -1499,7 +1380,7 @@ and collects all related elements (specified by their group pattern) in it.</p>
1499
1380
 
1500
1381
 
1501
1382
 
1502
- <td class="description last"><p>returns the group id of an DescribedEntry</p></td>
1383
+ <td class="description last"><p>returns the id of an DescribedEntry</p></td>
1503
1384
  </tr>
1504
1385
 
1505
1386
 
@@ -1540,13 +1421,20 @@ and collects all related elements (specified by their group pattern) in it.</p>
1540
1421
 
1541
1422
  <dt class="tag-source">Source:</dt>
1542
1423
  <dd class="tag-source"><ul class="dummy"><li>
1543
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line937">line 937</a>
1424
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line870">line 870</a>
1544
1425
  </li></ul></dd>
1545
1426
 
1546
1427
 
1547
1428
 
1548
1429
 
1549
1430
 
1431
+ <dt class="tag-see">See:</dt>
1432
+ <dd class="tag-see">
1433
+ <ul>
1434
+ <li>mergeFlattenedData</li>
1435
+ </ul>
1436
+ </dd>
1437
+
1550
1438
 
1551
1439
 
1552
1440
  </dl>
@@ -1565,16 +1453,6 @@ and collects all related elements (specified by their group pattern) in it.</p>
1565
1453
 
1566
1454
 
1567
1455
 
1568
- <h5>Returns:</h5>
1569
-
1570
-
1571
- <div class="param-desc">
1572
- <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
1573
- </div>
1574
-
1575
-
1576
-
1577
-
1578
1456
 
1579
1457
 
1580
1458
 
@@ -1586,7 +1464,7 @@ and collects all related elements (specified by their group pattern) in it.</p>
1586
1464
 
1587
1465
 
1588
1466
 
1589
- <h4 class="name" id=".groupFlattenedData"><span class="type-signature">(protected, static) </span>groupFlattenedData<span class="signature">(elements)</span><span class="type-signature"></span></h4>
1467
+ <h4 class="name" id=".extractEntriesByDescription"><span class="type-signature">(protected, static) </span>extractEntriesByDescription<span class="signature">(flattenedData)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
1590
1468
 
1591
1469
 
1592
1470
 
@@ -1594,11 +1472,7 @@ and collects all related elements (specified by their group pattern) in it.</p>
1594
1472
 
1595
1473
 
1596
1474
  <div class="description">
1597
- <p>Converts the given elements into an object, that provides these
1598
- entries by their id (determined by the entry's groupPattern).
1599
- For example, [{id: A, value: 1}] becomes result['A'] = 1.</p>
1600
- <p>Furthermore, this function creates a group property (determined by the entry's groupName)
1601
- and collects all related elements (specified by their group pattern) in it.</p>
1475
+ <p>Extracts entries out of &quot;flattened&quot; JSON data and provides an array of objects.</p>
1602
1476
  </div>
1603
1477
 
1604
1478
 
@@ -1634,13 +1508,13 @@ and collects all related elements (specified by their group pattern) in it.</p>
1634
1508
 
1635
1509
  <tr>
1636
1510
 
1637
- <td class="name"><code>elements</code></td>
1511
+ <td class="name"><code>flattenedData</code></td>
1638
1512
 
1639
1513
 
1640
1514
  <td class="type">
1641
1515
 
1642
1516
 
1643
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1517
+ <span class="param-type">Array.&lt;Object></span>
1644
1518
 
1645
1519
 
1646
1520
 
@@ -1650,113 +1524,153 @@ and collects all related elements (specified by their group pattern) in it.</p>
1650
1524
 
1651
1525
 
1652
1526
 
1653
- <td class="description last"><p>of DescribedEntry elements</p></td>
1654
- </tr>
1527
+ <td class="description last"><p>flattened json from search query result</p>
1528
+ <h6>Properties</h6>
1529
+
1655
1530
 
1656
-
1657
- </tbody>
1658
- </table>
1531
+ <table class="params">
1532
+ <thead>
1533
+ <tr>
1534
+
1535
+ <th>Name</th>
1536
+
1659
1537
 
1538
+ <th>Type</th>
1660
1539
 
1540
+
1661
1541
 
1542
+
1662
1543
 
1544
+ <th class="last">Description</th>
1545
+ </tr>
1546
+ </thead>
1663
1547
 
1548
+ <tbody>
1549
+
1664
1550
 
1665
- <dl class="details">
1551
+ <tr>
1552
+
1553
+ <td class="name"><code>name</code></td>
1554
+
1666
1555
 
1667
-
1556
+ <td class="type">
1557
+
1558
+
1559
+ <span class="param-type">string</span>
1668
1560
 
1669
-
1670
1561
 
1671
-
1562
+
1563
+ </td>
1672
1564
 
1673
-
1565
+
1674
1566
 
1675
-
1567
+
1676
1568
 
1677
-
1569
+ <td class="description last"><p>name of the property in hierarchical order separated by points</p></td>
1570
+ </tr>
1678
1571
 
1679
1572
 
1680
1573
 
1681
-
1574
+ <tr>
1575
+
1576
+ <td class="name"><code>value</code></td>
1577
+
1682
1578
 
1683
-
1579
+ <td class="type">
1580
+
1581
+
1582
+ <span class="param-type">string</span>
1684
1583
 
1685
-
1686
1584
 
1687
-
1585
+
1586
+ </td>
1688
1587
 
1689
-
1588
+
1690
1589
 
1691
-
1692
- <dt class="tag-source">Source:</dt>
1693
- <dd class="tag-source"><ul class="dummy"><li>
1694
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line912">line 912</a>
1695
- </li></ul></dd>
1696
-
1590
+
1697
1591
 
1698
-
1592
+ <td class="description last"><p>value of the property as string</p></td>
1593
+ </tr>
1699
1594
 
1700
1595
 
1596
+ </tbody>
1597
+ </table>
1598
+
1599
+ </td>
1600
+ </tr>
1701
1601
 
1702
1602
 
1703
- </dl>
1704
1603
 
1604
+ <tr>
1605
+
1606
+ <td class="name"><code></code></td>
1607
+
1608
+
1609
+ <td class="type">
1610
+
1611
+
1612
+ <span class="param-type"><a href="module-datarestructor.html#.PropertyStructureDescription">module:datarestructor.PropertyStructureDescription</a></span>
1705
1613
 
1706
1614
 
1615
+
1616
+ </td>
1707
1617
 
1618
+
1708
1619
 
1620
+
1709
1621
 
1622
+ <td class="description last"><p>description of structure of the entries that should be extracted</p></td>
1623
+ </tr>
1710
1624
 
1625
+
1626
+ </tbody>
1627
+ </table>
1711
1628
 
1712
1629
 
1713
1630
 
1714
1631
 
1715
1632
 
1716
1633
 
1634
+ <dl class="details">
1717
1635
 
1636
+
1718
1637
 
1719
- <h5>Returns:</h5>
1638
+
1720
1639
 
1721
-
1722
- <div class="param-desc">
1723
- <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
1724
- </div>
1640
+
1725
1641
 
1642
+
1726
1643
 
1644
+
1727
1645
 
1728
1646
 
1729
1647
 
1648
+
1730
1649
 
1650
+
1731
1651
 
1652
+
1732
1653
 
1654
+
1733
1655
 
1734
-
1735
-
1656
+
1736
1657
 
1737
1658
 
1738
1659
 
1739
1660
 
1740
- <h4 class="name" id=".mergeFlattenedData"><span class="type-signature">(protected, static) </span>mergeFlattenedData<span class="signature">(entries, entriesToMerge, idOfElementFunction)</span><span class="type-signature"></span></h4>
1661
+ <dt class="tag-source">Source:</dt>
1662
+ <dd class="tag-source"><ul class="dummy"><li>
1663
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line967">line 967</a>
1664
+ </li></ul></dd>
1741
1665
 
1742
1666
 
1743
1667
 
1744
1668
 
1669
+
1745
1670
 
1671
+
1672
+ </dl>
1746
1673
 
1747
- <div class="description">
1748
- <p>Takes two arrays of objects, e.g. [{id: B, value: 2},{id: C, value: 3}]
1749
- and [{id: A, value: 1},{id: B, value: 4}] and merges them into one:
1750
- [{id: C, value: 3},{id: A, value: 1},{id: B, value: 4}]</p>
1751
- <p>Entries with the same id (&quot;duplicates&quot;) will be overwritten.
1752
- Only the last element with the same id remains. The order is
1753
- determined by the order of the array elements, whereas the first
1754
- array comes before the second one. This means, that entries with the
1755
- same id in the second array overwrite entries in the first array,
1756
- and entries that occur later in the array overwrite earlier ones,
1757
- if they have the same id.</p>
1758
- <p>The id is extracted from every element using the given function.</p>
1759
- </div>
1760
1674
 
1761
1675
 
1762
1676
 
@@ -1766,99 +1680,59 @@ if they have the same id.</p>
1766
1680
 
1767
1681
 
1768
1682
 
1769
- <h5>Parameters:</h5>
1770
-
1771
1683
 
1772
- <table class="params">
1773
- <thead>
1774
- <tr>
1775
-
1776
- <th>Name</th>
1777
-
1778
1684
 
1779
- <th>Type</th>
1780
1685
 
1781
-
1782
1686
 
1783
-
1784
1687
 
1785
- <th class="last">Description</th>
1786
- </tr>
1787
- </thead>
1688
+ <h5>Returns:</h5>
1788
1689
 
1789
- <tbody>
1790
-
1690
+
1791
1691
 
1792
- <tr>
1793
-
1794
- <td class="name"><code>entries</code></td>
1795
-
1796
1692
 
1797
- <td class="type">
1798
-
1799
-
1693
+ <dl>
1694
+ <dt>
1695
+ Type
1696
+ </dt>
1697
+ <dd>
1698
+
1800
1699
  <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1801
1700
 
1802
1701
 
1803
-
1804
- </td>
1702
+ </dd>
1703
+ </dl>
1805
1704
 
1806
-
1705
+
1807
1706
 
1808
-
1809
1707
 
1810
- <td class="description last"></td>
1811
- </tr>
1812
1708
 
1813
-
1814
1709
 
1815
- <tr>
1816
-
1817
- <td class="name"><code>entriesToMerge</code></td>
1818
-
1819
1710
 
1820
- <td class="type">
1711
+
1821
1712
 
1822
-
1823
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
1824
-
1825
1713
 
1826
-
1827
- </td>
1714
+
1828
1715
 
1829
-
1716
+
1717
+ <h4 class="name" id=".fillInArrayValues"><span class="type-signature">(protected, static) </span>fillInArrayValues<span class="signature">()</span><span class="type-signature"></span></h4>
1718
+
1830
1719
 
1831
-
1720
+
1832
1721
 
1833
- <td class="description last"></td>
1834
- </tr>
1835
1722
 
1836
-
1837
1723
 
1838
- <tr>
1839
-
1840
- <td class="name"><code>idOfElementFunction</code></td>
1841
-
1724
+ <div class="description">
1725
+ <p>Fills in extra &quot;_comma_separated_values&quot; properties into the flattened data
1726
+ for properties that end with an array. E.g. response.hits.hits.tags[0]=&quot;active&quot; and response.hits.hits.tags[0]=&quot;ready&quot;
1727
+ will lead to the extra element &quot;response.hits.hits.tags_comma_separated_values=&quot;active, ready&quot;.</p>
1728
+ </div>
1842
1729
 
1843
- <td class="type">
1844
-
1845
-
1846
- <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
1847
1730
 
1848
1731
 
1849
-
1850
- </td>
1851
1732
 
1852
-
1853
1733
 
1854
-
1855
1734
 
1856
- <td class="description last"><p>returns the id of an DescribedEntry</p></td>
1857
- </tr>
1858
1735
 
1859
-
1860
- </tbody>
1861
- </table>
1862
1736
 
1863
1737
 
1864
1738
 
@@ -1894,7 +1768,7 @@ if they have the same id.</p>
1894
1768
 
1895
1769
  <dt class="tag-source">Source:</dt>
1896
1770
  <dd class="tag-source"><ul class="dummy"><li>
1897
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line828">line 828</a>
1771
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1028">line 1028</a>
1898
1772
  </li></ul></dd>
1899
1773
 
1900
1774
 
@@ -1919,6 +1793,16 @@ if they have the same id.</p>
1919
1793
 
1920
1794
 
1921
1795
 
1796
+ <h5>Returns:</h5>
1797
+
1798
+
1799
+ <div class="param-desc">
1800
+ <p>flattened data with filled in &quot;_comma_separated_values&quot; properties</p>
1801
+ </div>
1802
+
1803
+
1804
+
1805
+
1922
1806
 
1923
1807
 
1924
1808
 
@@ -1930,7 +1814,7 @@ if they have the same id.</p>
1930
1814
 
1931
1815
 
1932
1816
 
1933
- <h4 class="name" id=".processJsonUsingDescriptions"><span class="type-signature">(protected, static) </span>processJsonUsingDescriptions<span class="signature">(jsonData, descriptions, config)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
1817
+ <h4 class="name" id=".forEachGroupEntry"><span class="type-signature">(protected, static) </span>forEachGroupEntry<span class="signature">(rootEntry, onFoundEntry)</span><span class="type-signature"></span></h4>
1934
1818
 
1935
1819
 
1936
1820
 
@@ -1938,7 +1822,8 @@ if they have the same id.</p>
1938
1822
 
1939
1823
 
1940
1824
  <div class="description">
1941
- <p>&quot;Assembly line&quot;, that takes the jsonData and processes it using all given descriptions in their given order.</p>
1825
+ <p>Traverses through all groups and their entries and calls the given function on every found entry
1826
+ with the group name and the entry itself as parameters.</p>
1942
1827
  </div>
1943
1828
 
1944
1829
 
@@ -1974,36 +1859,13 @@ if they have the same id.</p>
1974
1859
 
1975
1860
  <tr>
1976
1861
 
1977
- <td class="name"><code>jsonData</code></td>
1978
-
1979
-
1980
- <td class="type">
1981
-
1982
-
1983
- <span class="param-type">object</span>
1984
-
1985
-
1986
-
1987
- </td>
1988
-
1989
-
1990
-
1991
-
1992
-
1993
- <td class="description last"><p>parsed JSON data or any other data object</p></td>
1994
- </tr>
1995
-
1996
-
1997
-
1998
- <tr>
1999
-
2000
- <td class="name"><code>descriptions</code></td>
1862
+ <td class="name"><code>rootEntry</code></td>
2001
1863
 
2002
1864
 
2003
1865
  <td class="type">
2004
1866
 
2005
1867
 
2006
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.PropertyStructureDescription">module:datarestructor.PropertyStructureDescription</a>></span>
1868
+ <span class="param-type"><a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a></span>
2007
1869
 
2008
1870
 
2009
1871
 
@@ -2013,20 +1875,20 @@ if they have the same id.</p>
2013
1875
 
2014
1876
 
2015
1877
 
2016
- <td class="description last"><p>already grouped entries</p></td>
1878
+ <td class="description last"></td>
2017
1879
  </tr>
2018
1880
 
2019
1881
 
2020
1882
 
2021
1883
  <tr>
2022
1884
 
2023
- <td class="name"><code>config</code></td>
1885
+ <td class="name"><code>onFoundEntry</code></td>
2024
1886
 
2025
1887
 
2026
1888
  <td class="type">
2027
1889
 
2028
1890
 
2029
- <span class="param-type"><a href="module-datarestructor.html#.TransformConfig">module:datarestructor.TransformConfig</a></span>
1891
+ <span class="param-type"><a href="module-datarestructor.html#.onEntryFoundFunction">module:datarestructor.onEntryFoundFunction</a></span>
2030
1892
 
2031
1893
 
2032
1894
 
@@ -2036,7 +1898,7 @@ if they have the same id.</p>
2036
1898
 
2037
1899
 
2038
1900
 
2039
- <td class="description last"><p>configuration for the data transformation</p></td>
1901
+ <td class="description last"></td>
2040
1902
  </tr>
2041
1903
 
2042
1904
 
@@ -2077,7 +1939,7 @@ if they have the same id.</p>
2077
1939
 
2078
1940
  <dt class="tag-source">Source:</dt>
2079
1941
  <dd class="tag-source"><ul class="dummy"><li>
2080
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line749">line 749</a>
1942
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1199">line 1199</a>
2081
1943
  </li></ul></dd>
2082
1944
 
2083
1945
 
@@ -2102,24 +1964,6 @@ if they have the same id.</p>
2102
1964
 
2103
1965
 
2104
1966
 
2105
- <h5>Returns:</h5>
2106
-
2107
-
2108
-
2109
-
2110
- <dl>
2111
- <dt>
2112
- Type
2113
- </dt>
2114
- <dd>
2115
-
2116
- <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
2117
-
2118
-
2119
- </dd>
2120
- </dl>
2121
-
2122
-
2123
1967
 
2124
1968
 
2125
1969
 
@@ -2131,7 +1975,7 @@ if they have the same id.</p>
2131
1975
 
2132
1976
 
2133
1977
 
2134
- <h4 class="name" id=".toDescribedField"><span class="type-signature">(protected, static) </span>toDescribedField<span class="signature">(entry, recursionContext)</span><span class="type-signature"> &rarr; {<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>}</span></h4>
1978
+ <h4 class="name" id=".groupById"><span class="type-signature">(protected, static) </span>groupById<span class="signature">(elements, groupNameOfElementFunction, groupIdOfElementFunction)</span><span class="type-signature"></span></h4>
2135
1979
 
2136
1980
 
2137
1981
 
@@ -2139,11 +1983,10 @@ if they have the same id.</p>
2139
1983
 
2140
1984
 
2141
1985
  <div class="description">
2142
- <p>Converts a internal described entry to a newly created public described field.
2143
- Since the structure of a described field is hierarchical, this function is called recursively.
2144
- Because the internal described entries may very likely contain cyclic references, the depth of recursion
2145
- needs to be limited. Therefore, the current recursion depth is taken as second parameter
2146
- and the maximum recursion depth is taken as third parameter.</p>
1986
+ <p>Converts the given elements into an object, that provides these
1987
+ entries by their id. For example, [{id: A, value: 1}] becomes
1988
+ result['A'] = 1. Furthermore, this function creates a group property (with the name )
1989
+ and collects all related elements (specified by their group pattern) in it.</p>
2147
1990
  </div>
2148
1991
 
2149
1992
 
@@ -2179,13 +2022,13 @@ and the maximum recursion depth is taken as third parameter.</p>
2179
2022
 
2180
2023
  <tr>
2181
2024
 
2182
- <td class="name"><code>entry</code></td>
2025
+ <td class="name"><code>elements</code></td>
2183
2026
 
2184
2027
 
2185
2028
  <td class="type">
2186
2029
 
2187
2030
 
2188
- <span class="param-type"><a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a></span>
2031
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
2189
2032
 
2190
2033
 
2191
2034
 
@@ -2195,20 +2038,20 @@ and the maximum recursion depth is taken as third parameter.</p>
2195
2038
 
2196
2039
 
2197
2040
 
2198
- <td class="description last"><p>the internal entry that will be converted</p></td>
2041
+ <td class="description last"><p>of DescribedEntry elements</p></td>
2199
2042
  </tr>
2200
2043
 
2201
2044
 
2202
2045
 
2203
2046
  <tr>
2204
2047
 
2205
- <td class="name"><code>recursionContext</code></td>
2048
+ <td class="name"><code>groupNameOfElementFunction</code></td>
2206
2049
 
2207
2050
 
2208
2051
  <td class="type">
2209
2052
 
2210
2053
 
2211
- <span class="param-type"><a href="module-datarestructor.html#.DescribedFieldRecursionContext">module:datarestructor.DescribedFieldRecursionContext</a></span>
2054
+ <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
2212
2055
 
2213
2056
 
2214
2057
 
@@ -2218,7 +2061,30 @@ and the maximum recursion depth is taken as third parameter.</p>
2218
2061
 
2219
2062
 
2220
2063
 
2221
- <td class="description last"><p>context contains everything that needs to be accessible throughout the recursion.</p></td>
2064
+ <td class="description last"><p>function, that returns the name of the group property that will be created inside the &quot;main&quot; element.</p></td>
2065
+ </tr>
2066
+
2067
+
2068
+
2069
+ <tr>
2070
+
2071
+ <td class="name"><code>groupIdOfElementFunction</code></td>
2072
+
2073
+
2074
+ <td class="type">
2075
+
2076
+
2077
+ <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
2078
+
2079
+
2080
+
2081
+ </td>
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+ <td class="description last"><p>returns the group id of an DescribedEntry</p></td>
2222
2088
  </tr>
2223
2089
 
2224
2090
 
@@ -2259,7 +2125,7 @@ and the maximum recursion depth is taken as third parameter.</p>
2259
2125
 
2260
2126
  <dt class="tag-source">Source:</dt>
2261
2127
  <dd class="tag-source"><ul class="dummy"><li>
2262
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1114">line 1114</a>
2128
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line937">line 937</a>
2263
2129
  </li></ul></dd>
2264
2130
 
2265
2131
 
@@ -2287,19 +2153,11 @@ and the maximum recursion depth is taken as third parameter.</p>
2287
2153
  <h5>Returns:</h5>
2288
2154
 
2289
2155
 
2156
+ <div class="param-desc">
2157
+ <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
2158
+ </div>
2290
2159
 
2291
2160
 
2292
- <dl>
2293
- <dt>
2294
- Type
2295
- </dt>
2296
- <dd>
2297
-
2298
- <span class="param-type"><a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a></span>
2299
-
2300
-
2301
- </dd>
2302
- </dl>
2303
2161
 
2304
2162
 
2305
2163
 
@@ -2313,7 +2171,7 @@ and the maximum recursion depth is taken as third parameter.</p>
2313
2171
 
2314
2172
 
2315
2173
 
2316
- <h4 class="name" id=".toDescribedFields"><span class="type-signature">(protected, static) </span>toDescribedFields<span class="signature">(describedEntries, config)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>>}</span></h4>
2174
+ <h4 class="name" id=".groupFlattenedData"><span class="type-signature">(protected, static) </span>groupFlattenedData<span class="signature">(elements)</span><span class="type-signature"></span></h4>
2317
2175
 
2318
2176
 
2319
2177
 
@@ -2321,9 +2179,11 @@ and the maximum recursion depth is taken as third parameter.</p>
2321
2179
 
2322
2180
 
2323
2181
  <div class="description">
2324
- <p>Converts described entries (internal data structure) to described fields (external data structure).
2325
- Since the structure of a described field is hierarchical, every field needs to be converted
2326
- in a recursive manner. The maximum recursion depth is taken as the second parameter.</p>
2182
+ <p>Converts the given elements into an object, that provides these
2183
+ entries by their id (determined by the entry's groupPattern).
2184
+ For example, [{id: A, value: 1}] becomes result['A'] = 1.</p>
2185
+ <p>Furthermore, this function creates a group property (determined by the entry's groupName)
2186
+ and collects all related elements (specified by their group pattern) in it.</p>
2327
2187
  </div>
2328
2188
 
2329
2189
 
@@ -2359,7 +2219,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2359
2219
 
2360
2220
  <tr>
2361
2221
 
2362
- <td class="name"><code>describedEntries</code></td>
2222
+ <td class="name"><code>elements</code></td>
2363
2223
 
2364
2224
 
2365
2225
  <td class="type">
@@ -2375,42 +2235,31 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2375
2235
 
2376
2236
 
2377
2237
 
2378
- <td class="description last"></td>
2238
+ <td class="description last"><p>of DescribedEntry elements</p></td>
2379
2239
  </tr>
2380
2240
 
2381
2241
 
2242
+ </tbody>
2243
+ </table>
2382
2244
 
2383
- <tr>
2384
-
2385
- <td class="name"><code>config</code></td>
2386
-
2387
-
2388
- <td class="type">
2389
-
2390
-
2391
- <span class="param-type"><a href="module-datarestructor.html#.TransformConfig">module:datarestructor.TransformConfig</a></span>
2392
2245
 
2393
2246
 
2394
-
2395
- </td>
2396
2247
 
2397
-
2398
2248
 
2399
-
2400
2249
 
2401
- <td class="description last"><p>configuration for the data transformation</p></td>
2402
- </tr>
2250
+ <dl class="details">
2403
2251
 
2404
2252
 
2405
- </tbody>
2406
- </table>
2407
-
2408
2253
 
2254
+
2409
2255
 
2256
+
2410
2257
 
2258
+
2411
2259
 
2260
+
2412
2261
 
2413
- <dl class="details">
2262
+
2414
2263
 
2415
2264
 
2416
2265
 
@@ -2424,6 +2273,11 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2424
2273
 
2425
2274
 
2426
2275
 
2276
+
2277
+ <dt class="tag-source">Source:</dt>
2278
+ <dd class="tag-source"><ul class="dummy"><li>
2279
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line912">line 912</a>
2280
+ </li></ul></dd>
2427
2281
 
2428
2282
 
2429
2283
 
@@ -2431,24 +2285,65 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2431
2285
 
2432
2286
 
2433
2287
 
2288
+ </dl>
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+ <h5>Returns:</h5>
2305
+
2306
+
2307
+ <div class="param-desc">
2308
+ <p>{module:datarestructor.DescribedEntry[] entries indexed by id</p>
2309
+ </div>
2310
+
2311
+
2434
2312
 
2435
2313
 
2436
2314
 
2315
+
2316
+
2317
+
2318
+
2319
+
2320
+
2321
+
2437
2322
 
2438
2323
 
2439
2324
 
2440
- <dt class="tag-source">Source:</dt>
2441
- <dd class="tag-source"><ul class="dummy"><li>
2442
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1080">line 1080</a>
2443
- </li></ul></dd>
2325
+ <h4 class="name" id=".mergeFlattenedData"><span class="type-signature">(protected, static) </span>mergeFlattenedData<span class="signature">(entries, entriesToMerge, idOfElementFunction)</span><span class="type-signature"></span></h4>
2444
2326
 
2445
2327
 
2446
2328
 
2447
2329
 
2448
-
2449
2330
 
2450
-
2451
- </dl>
2331
+
2332
+ <div class="description">
2333
+ <p>Takes two arrays of objects, e.g. [{id: B, value: 2},{id: C, value: 3}]
2334
+ and [{id: A, value: 1},{id: B, value: 4}] and merges them into one:
2335
+ [{id: C, value: 3},{id: A, value: 1},{id: B, value: 4}]</p>
2336
+ <p>Entries with the same id (&quot;duplicates&quot;) will be overwritten.
2337
+ Only the last element with the same id remains. The order is
2338
+ determined by the order of the array elements, whereas the first
2339
+ array comes before the second one. This means, that entries with the
2340
+ same id in the second array overwrite entries in the first array,
2341
+ and entries that occur later in the array overwrite earlier ones,
2342
+ if they have the same id.</p>
2343
+ <p>The id is extracted from every element using the given function.</p>
2344
+ </div>
2345
+
2346
+
2452
2347
 
2453
2348
 
2454
2349
 
@@ -2456,60 +2351,99 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2456
2351
 
2457
2352
 
2458
2353
 
2354
+ <h5>Parameters:</h5>
2355
+
2459
2356
 
2357
+ <table class="params">
2358
+ <thead>
2359
+ <tr>
2360
+
2361
+ <th>Name</th>
2362
+
2460
2363
 
2364
+ <th>Type</th>
2461
2365
 
2366
+
2462
2367
 
2368
+
2463
2369
 
2370
+ <th class="last">Description</th>
2371
+ </tr>
2372
+ </thead>
2464
2373
 
2374
+ <tbody>
2375
+
2465
2376
 
2377
+ <tr>
2378
+
2379
+ <td class="name"><code>entries</code></td>
2380
+
2466
2381
 
2467
- <h5>Returns:</h5>
2382
+ <td class="type">
2383
+
2384
+
2385
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
2468
2386
 
2469
-
2470
2387
 
2388
+
2389
+ </td>
2471
2390
 
2472
- <dl>
2473
- <dt>
2474
- Type
2475
- </dt>
2476
- <dd>
2477
-
2478
- <span class="param-type">Array.&lt;<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>></span>
2391
+
2479
2392
 
2393
+
2480
2394
 
2481
- </dd>
2482
- </dl>
2395
+ <td class="description last"></td>
2396
+ </tr>
2483
2397
 
2484
2398
 
2485
2399
 
2400
+ <tr>
2401
+
2402
+ <td class="name"><code>entriesToMerge</code></td>
2403
+
2486
2404
 
2405
+ <td class="type">
2406
+
2407
+
2408
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
2487
2409
 
2488
2410
 
2411
+
2412
+ </td>
2489
2413
 
2490
-
2491
2414
 
2492
2415
 
2493
-
2416
+
2494
2417
 
2495
-
2496
- <h4 class="name" id="enableDebugMode"><span class="type-signature"></span>enableDebugMode<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
2497
-
2418
+ <td class="description last"></td>
2419
+ </tr>
2498
2420
 
2499
2421
 
2500
2422
 
2423
+ <tr>
2424
+
2425
+ <td class="name"><code>idOfElementFunction</code></td>
2426
+
2501
2427
 
2502
-
2503
- <div class="description">
2504
- <p>Enables debug mode. Logs additional information.</p>
2505
- </div>
2506
-
2428
+ <td class="type">
2429
+
2430
+
2431
+ <span class="param-type"><a href="module-datarestructor.html#.stringFieldOfDescribedEntryFunction">module:datarestructor.stringFieldOfDescribedEntryFunction</a></span>
2507
2432
 
2508
2433
 
2434
+
2435
+ </td>
2509
2436
 
2437
+
2510
2438
 
2439
+
2511
2440
 
2441
+ <td class="description last"><p>returns the id of an DescribedEntry</p></td>
2442
+ </tr>
2512
2443
 
2444
+
2445
+ </tbody>
2446
+ </table>
2513
2447
 
2514
2448
 
2515
2449
 
@@ -2545,7 +2479,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2545
2479
 
2546
2480
  <dt class="tag-source">Source:</dt>
2547
2481
  <dd class="tag-source"><ul class="dummy"><li>
2548
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line688">line 688</a>
2482
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line828">line 828</a>
2549
2483
  </li></ul></dd>
2550
2484
 
2551
2485
 
@@ -2570,24 +2504,6 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2570
2504
 
2571
2505
 
2572
2506
 
2573
- <h5>Returns:</h5>
2574
-
2575
-
2576
-
2577
-
2578
- <dl>
2579
- <dt>
2580
- Type
2581
- </dt>
2582
- <dd>
2583
-
2584
- <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
2585
-
2586
-
2587
- </dd>
2588
- </dl>
2589
-
2590
-
2591
2507
 
2592
2508
 
2593
2509
 
@@ -2599,7 +2515,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2599
2515
 
2600
2516
 
2601
2517
 
2602
- <h4 class="name" id="processJson"><span class="type-signature"></span>processJson<span class="signature">(data)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
2518
+ <h4 class="name" id=".processJsonUsingDescriptions"><span class="type-signature">(protected, static) </span>processJsonUsingDescriptions<span class="signature">(jsonData, descriptions, config)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>>}</span></h4>
2603
2519
 
2604
2520
 
2605
2521
 
@@ -2607,7 +2523,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2607
2523
 
2608
2524
 
2609
2525
  <div class="description">
2610
- <p>&quot;Assembly line&quot;, that takes the (pared JSON) data and processes it using all given descriptions in their given order.</p>
2526
+ <p>&quot;Assembly line&quot;, that takes the jsonData and processes it using all given descriptions in their given order.</p>
2611
2527
  </div>
2612
2528
 
2613
2529
 
@@ -2643,7 +2559,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2643
2559
 
2644
2560
  <tr>
2645
2561
 
2646
- <td class="name"><code>data</code></td>
2562
+ <td class="name"><code>jsonData</code></td>
2647
2563
 
2648
2564
 
2649
2565
  <td class="type">
@@ -2663,6 +2579,52 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2663
2579
  </tr>
2664
2580
 
2665
2581
 
2582
+
2583
+ <tr>
2584
+
2585
+ <td class="name"><code>descriptions</code></td>
2586
+
2587
+
2588
+ <td class="type">
2589
+
2590
+
2591
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.PropertyStructureDescription">module:datarestructor.PropertyStructureDescription</a>></span>
2592
+
2593
+
2594
+
2595
+ </td>
2596
+
2597
+
2598
+
2599
+
2600
+
2601
+ <td class="description last"><p>already grouped entries</p></td>
2602
+ </tr>
2603
+
2604
+
2605
+
2606
+ <tr>
2607
+
2608
+ <td class="name"><code>config</code></td>
2609
+
2610
+
2611
+ <td class="type">
2612
+
2613
+
2614
+ <span class="param-type"><a href="module-datarestructor.html#.TransformConfig">module:datarestructor.TransformConfig</a></span>
2615
+
2616
+
2617
+
2618
+ </td>
2619
+
2620
+
2621
+
2622
+
2623
+
2624
+ <td class="description last"><p>configuration for the data transformation</p></td>
2625
+ </tr>
2626
+
2627
+
2666
2628
  </tbody>
2667
2629
  </table>
2668
2630
 
@@ -2700,7 +2662,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2700
2662
 
2701
2663
  <dt class="tag-source">Source:</dt>
2702
2664
  <dd class="tag-source"><ul class="dummy"><li>
2703
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line735">line 735</a>
2665
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line749">line 749</a>
2704
2666
  </li></ul></dd>
2705
2667
 
2706
2668
 
@@ -2747,14 +2709,6 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
2747
2709
 
2748
2710
 
2749
2711
 
2750
- <h5>Example</h5>
2751
-
2752
- <pre class="prettyprint"><code>var allDescriptions = [];
2753
- allDescriptions.push(summariesDescription());
2754
- allDescriptions.push(detailsDescription());
2755
- var result = new datarestructor.Transform(allDescriptions).processJson(jsonData);</code></pre>
2756
-
2757
-
2758
2712
 
2759
2713
 
2760
2714
 
@@ -2762,7 +2716,7 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2762
2716
 
2763
2717
 
2764
2718
 
2765
- <h4 class="name" id="setMaxRecursionDepth"><span class="type-signature"></span>setMaxRecursionDepth<span class="signature">(value)</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
2719
+ <h4 class="name" id=".toDescribedField"><span class="type-signature">(protected, static) </span>toDescribedField<span class="signature">(entry, recursionContext)</span><span class="type-signature"> &rarr; {<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>}</span></h4>
2766
2720
 
2767
2721
 
2768
2722
 
@@ -2770,7 +2724,11 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2770
2724
 
2771
2725
 
2772
2726
  <div class="description">
2773
- <p>Sets the maximum recursion depth. Defaults to 8 if not set.</p>
2727
+ <p>Converts a internal described entry to a newly created public described field.
2728
+ Since the structure of a described field is hierarchical, this function is called recursively.
2729
+ Because the internal described entries may very likely contain cyclic references, the depth of recursion
2730
+ needs to be limited. Therefore, the current recursion depth is taken as second parameter
2731
+ and the maximum recursion depth is taken as third parameter.</p>
2774
2732
  </div>
2775
2733
 
2776
2734
 
@@ -2806,13 +2764,13 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2806
2764
 
2807
2765
  <tr>
2808
2766
 
2809
- <td class="name"><code>value</code></td>
2767
+ <td class="name"><code>entry</code></td>
2810
2768
 
2811
2769
 
2812
2770
  <td class="type">
2813
2771
 
2814
2772
 
2815
- <span class="param-type">number</span>
2773
+ <span class="param-type"><a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a></span>
2816
2774
 
2817
2775
 
2818
2776
 
@@ -2822,7 +2780,30 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2822
2780
 
2823
2781
 
2824
2782
 
2825
- <td class="description last"><p>non negative number.</p></td>
2783
+ <td class="description last"><p>the internal entry that will be converted</p></td>
2784
+ </tr>
2785
+
2786
+
2787
+
2788
+ <tr>
2789
+
2790
+ <td class="name"><code>recursionContext</code></td>
2791
+
2792
+
2793
+ <td class="type">
2794
+
2795
+
2796
+ <span class="param-type"><a href="module-datarestructor.html#.DescribedFieldRecursionContext">module:datarestructor.DescribedFieldRecursionContext</a></span>
2797
+
2798
+
2799
+
2800
+ </td>
2801
+
2802
+
2803
+
2804
+
2805
+
2806
+ <td class="description last"><p>context contains everything that needs to be accessible throughout the recursion.</p></td>
2826
2807
  </tr>
2827
2808
 
2828
2809
 
@@ -2863,7 +2844,7 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2863
2844
 
2864
2845
  <dt class="tag-source">Source:</dt>
2865
2846
  <dd class="tag-source"><ul class="dummy"><li>
2866
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line698">line 698</a>
2847
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1114">line 1114</a>
2867
2848
  </li></ul></dd>
2868
2849
 
2869
2850
 
@@ -2899,7 +2880,7 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2899
2880
  </dt>
2900
2881
  <dd>
2901
2882
 
2902
- <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
2883
+ <span class="param-type"><a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a></span>
2903
2884
 
2904
2885
 
2905
2886
  </dd>
@@ -2917,7 +2898,7 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2917
2898
 
2918
2899
 
2919
2900
 
2920
- <h4 class="name" id="setRemoveDuplicationAboveRecursionDepth"><span class="type-signature"></span>setRemoveDuplicationAboveRecursionDepth<span class="signature">(value)</span><span class="type-signature"> &rarr; {<a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a>}</span></h4>
2901
+ <h4 class="name" id=".toDescribedFields"><span class="type-signature">(protected, static) </span>toDescribedFields<span class="signature">(describedEntries, config)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>>}</span></h4>
2921
2902
 
2922
2903
 
2923
2904
 
@@ -2925,13 +2906,9 @@ var result = new datarestructor.Transform(allDescriptions).processJson(jsonData)
2925
2906
 
2926
2907
 
2927
2908
  <div class="description">
2928
- <p>Sets the recursion depth above which duplication will be removed. Duplications below it remain unchanged.
2929
- Defaults to 1.</p>
2930
- <p>Since fields can contain groups of fields that can contain groups of fields..., cyclic
2931
- data structures are possible by nature and will lead to duplications. Some of them
2932
- might be intended e.g. to take one (sub-)field with all (duplicated) groups.
2933
- To restrict duplications and improve performance it is beneficial to define a
2934
- recursion depth, above which further duplication won't be used and should be removed/avoided.</p>
2909
+ <p>Converts described entries (internal data structure) to described fields (external data structure).
2910
+ Since the structure of a described field is hierarchical, every field needs to be converted
2911
+ in a recursive manner. The maximum recursion depth is taken as the second parameter.</p>
2935
2912
  </div>
2936
2913
 
2937
2914
 
@@ -2967,13 +2944,13 @@ recursion depth, above which further duplication won't be used and should be rem
2967
2944
 
2968
2945
  <tr>
2969
2946
 
2970
- <td class="name"><code>value</code></td>
2947
+ <td class="name"><code>describedEntries</code></td>
2971
2948
 
2972
2949
 
2973
2950
  <td class="type">
2974
2951
 
2975
2952
 
2976
- <span class="param-type">number</span>
2953
+ <span class="param-type">Array.&lt;<a href="module-datarestructor.html#.DescribedEntry">module:datarestructor.DescribedEntry</a>></span>
2977
2954
 
2978
2955
 
2979
2956
 
@@ -2983,7 +2960,30 @@ recursion depth, above which further duplication won't be used and should be rem
2983
2960
 
2984
2961
 
2985
2962
 
2986
- <td class="description last"><p>non negative number.</p></td>
2963
+ <td class="description last"></td>
2964
+ </tr>
2965
+
2966
+
2967
+
2968
+ <tr>
2969
+
2970
+ <td class="name"><code>config</code></td>
2971
+
2972
+
2973
+ <td class="type">
2974
+
2975
+
2976
+ <span class="param-type"><a href="module-datarestructor.html#.TransformConfig">module:datarestructor.TransformConfig</a></span>
2977
+
2978
+
2979
+
2980
+ </td>
2981
+
2982
+
2983
+
2984
+
2985
+
2986
+ <td class="description last"><p>configuration for the data transformation</p></td>
2987
2987
  </tr>
2988
2988
 
2989
2989
 
@@ -3024,7 +3024,7 @@ recursion depth, above which further duplication won't be used and should be rem
3024
3024
 
3025
3025
  <dt class="tag-source">Source:</dt>
3026
3026
  <dd class="tag-source"><ul class="dummy"><li>
3027
- <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line718">line 718</a>
3027
+ <a href="datarestructor.js.html">datarestructor.js</a>, <a href="datarestructor.js.html#line1080">line 1080</a>
3028
3028
  </li></ul></dd>
3029
3029
 
3030
3030
 
@@ -3060,7 +3060,7 @@ recursion depth, above which further duplication won't be used and should be rem
3060
3060
  </dt>
3061
3061
  <dd>
3062
3062
 
3063
- <span class="param-type"><a href="module-datarestructor.Transform.html">module:datarestructor.Transform</a></span>
3063
+ <span class="param-type">Array.&lt;<a href="module-described_field.html#.DescribedDataField">module:described_field.DescribedDataField</a>></span>
3064
3064
 
3065
3065
 
3066
3066
  </dd>
@@ -3094,7 +3094,7 @@ recursion depth, above which further duplication won't be used and should be rem
3094
3094
  <br class="clear">
3095
3095
 
3096
3096
  <footer>
3097
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Mon Oct 31 2022 17:00:02 GMT+0000 (Coordinated Universal Time)
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)
3098
3098
  </footer>
3099
3099
 
3100
3100
  <script> prettyPrint(); </script>