dt-toolbox 5.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/Changelog.md +15 -10
  2. package/LICENSE +1 -1
  3. package/Migration.guide.md +63 -1
  4. package/README.md +996 -346
  5. package/README_v.2.x.x.md +0 -1
  6. package/README_v.4.x.x.md +532 -0
  7. package/README_v.6.x.x.md +1158 -0
  8. package/package.json +21 -24
  9. package/src/convertors/index.js +43 -34
  10. package/src/convertors/midflat.js +76 -132
  11. package/src/convertors/standard.js +61 -86
  12. package/src/convertors/tuples.js +171 -0
  13. package/src/flatData/connect.js +50 -0
  14. package/src/flatData/export.js +46 -0
  15. package/src/flatData/filters/list.js +11 -0
  16. package/src/flatData/filters/listObject.js +13 -0
  17. package/src/flatData/filters/object.js +12 -0
  18. package/src/flatData/filters/root.js +12 -0
  19. package/src/flatData/find.js +20 -0
  20. package/src/flatData/from.js +33 -0
  21. package/src/flatData/get.js +29 -0
  22. package/src/flatData/index.js +101 -0
  23. package/src/flatData/insert.js +24 -0
  24. package/src/flatData/like.js +24 -0
  25. package/src/flatData/look.js +56 -0
  26. package/src/flatData/push.js +19 -0
  27. package/src/flatData/save.js +17 -0
  28. package/src/flatData/set.js +26 -0
  29. package/src/flatData/setupFilter.js +21 -0
  30. package/src/flatData/use.js +16 -0
  31. package/src/flatObject/copy.js +19 -0
  32. package/src/flatObject/export.js +13 -0
  33. package/src/flatObject/index.js +55 -0
  34. package/src/flatObject/insert.js +38 -0
  35. package/src/flatObject/model.js +32 -0
  36. package/src/flatObject/query.js +24 -0
  37. package/src/flatObject/setupFilter.js +12 -0
  38. package/src/main.js +21 -689
  39. package/src/mainLib.js +114 -0
  40. package/src/compareMethod/change.js +0 -21
  41. package/src/compareMethod/different.js +0 -18
  42. package/src/compareMethod/identical.js +0 -21
  43. package/src/compareMethod/index.js +0 -13
  44. package/src/compareMethod/missing.js +0 -18
  45. package/src/compareMethod/same.js +0 -18
  46. package/src/convertors/breadcrumbs.js +0 -148
  47. package/src/help/extractSelection.js +0 -12
  48. package/src/help/filterObject.js +0 -25
  49. package/src/help/hasNumbers.js +0 -14
  50. package/src/help/index.js +0 -35
  51. package/src/help/isItPrimitive.js +0 -10
  52. package/src/help/objectsByLevel.js +0 -16
  53. package/src/help/reduceTuples.js +0 -29
  54. package/src/help/sanitizeFlatKeys.js +0 -30
  55. package/src/help/toBreadcrumbsKeys.js +0 -28
  56. package/src/help/tuplesToBreadcrumbs.js +0 -25
  57. package/src/help/updateSelection.js +0 -12
  58. package/src/help/zipObject.js +0 -24
  59. package/src/lib/assemble.js +0 -45
  60. package/src/lib/attach.js +0 -20
  61. package/src/lib/block.js +0 -33
  62. package/src/lib/combine.js +0 -38
  63. package/src/lib/deep.js +0 -23
  64. package/src/lib/find.js +0 -36
  65. package/src/lib/folder.js +0 -42
  66. package/src/lib/index.js +0 -56
  67. package/src/lib/modify.js +0 -22
  68. package/src/lib/parent.js +0 -51
  69. package/src/lib/purify.js +0 -37
  70. package/src/lib/transform.js +0 -55
  71. package/src/modifiers/add.js +0 -18
  72. package/src/modifiers/append.js +0 -18
  73. package/src/modifiers/combineShallow.js +0 -119
  74. package/src/modifiers/flatten.js +0 -38
  75. package/src/modifiers/index.js +0 -34
  76. package/src/modifiers/insert.js +0 -21
  77. package/src/modifiers/keyPrefix.js +0 -27
  78. package/src/modifiers/mix.js +0 -25
  79. package/src/modifiers/overwrite.js +0 -18
  80. package/src/modifiers/prepend.js +0 -19
  81. package/src/modifiers/reverse.js +0 -23
  82. package/src/modifiers/update.js +0 -18
  83. package/src/simple.js +0 -49
package/Changelog.md CHANGED
@@ -1,17 +1,23 @@
1
1
  ## Release History
2
2
 
3
+ ### 7.0.0 (2023-07-15)
4
+ - [x] Method `look` has new arguments: functions `next` and `finish`;
5
+ - [x] To stop iteration on current dt-line `return next()`;
6
+ - [x] To stop iteration on all dt-lines `return finish()`;
7
+ - [x] Method `insert` was renamed to `insertSegment`;
8
+ - [x] Method `listSegments` was added to show list of all segments in dt-object;
9
+ - [x] Method `insertSegment` expect the incoming data as dt-object, but if is not - will assume it as a standard javascript object and will convert it to dt-object automatically;
10
+ - [] Method `insertSegment` can recognize a dt model object.
3
11
 
4
- ### 5.0.0 ( 2022-11-24)
5
- - [x] Converting library to ES module;
6
12
 
7
13
 
8
- ### 4.0.9 ( 2022-11-14)
9
- - [x] Fix: Corner case with structure building;
10
-
11
-
12
- ### 4.0.8 (2022-11-13)
13
- - [x] Upgrade to version v.3.0.0 of '@peter.naydenov/walk';
14
- - [ ] Bug: Corner case with structure building;
14
+ ### 6.0.0 (2023-05-12)
15
+ - [x] Version 5 is full rethinking of the idea and rewrite from scratch;
16
+ - [x] Simplified API interface;
17
+ - [x] New internal data-model;
18
+ - [x] Multiple data inserts;
19
+ - [x] Predefined and custom filters for faster data scan;
20
+ - [x] Model and query functions to shape the results;
15
21
 
16
22
 
17
23
 
@@ -287,4 +293,3 @@
287
293
 
288
294
 
289
295
 
290
-
package/LICENSE CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,7 +1,69 @@
1
1
  # Migration Guides
2
2
 
3
+ ## From v.6.x.x - v.7.x.x
4
+ Look function can return `next` and `finish` functions. This functions are used to control the flow of the "**look**" function. If you `return next()`, the look function will continue to execute callback with next dt-line object. If you `return finish()`, the look function will end.
3
5
 
4
- ## From v.2.x.x. - v.3.x.x
6
+
7
+ ```js
8
+ // was:
9
+ dt.query ( (store) => {
10
+ store.look ( ({name, flatData, breadcrumbs}) => {
11
+ if ( flatData.includes('something') ) {
12
+ // do something
13
+ // return string 'next' to stop iteration on this dt-line
14
+ return 'next'
15
+ }
16
+ })
17
+ })
18
+
19
+ // become:
20
+ dt.query ( (store) => {
21
+ store.look ( ({name, flatData, breadcrumbs, next, finish}) => {
22
+ if ( flatData.includes('something') ) {
23
+ // do something
24
+ // return `next()` to stop iteration on current dt-line
25
+ return next ()
26
+ // return `finish()` to stop iteration on all dt-lines (it's a new option)
27
+ }
28
+ })
29
+ })
30
+
31
+ ```
32
+
33
+ Method `insert` was renamed to `insertSegment` to be clear that data is not mixed. Segments are separated peaces of data.
34
+
35
+ ```js
36
+ // before
37
+ const dt = dtbox.init ( a );
38
+ dt.insert ( 'specificDataName' b ) // b is a dt-object
39
+
40
+ // after
41
+ const dt = dtbox.init ( a );
42
+ dt.insertSegment ( 'specificDataName' b ) // b is a dt-object
43
+ // it's possible to insert a standard js object but it's not recomended
44
+ // dt.insertSegment ( 'specialDataName', a ) // a is a standard js object
45
+ // also possible to insert a dt model object directly
46
+ // dt.insertSegment ( 'specialDataName', c ) // Where c = b.export(). A dt model object.
47
+ ```
48
+
49
+ Method `listSegments` was added to show list of all segments in dt-object.
50
+
51
+
52
+
53
+ ## From v.4.x.x - v.6.x.x
54
+
55
+ The library "dt-toolbox" exist for a full 7 years and now version 6 is coming as full rewrite of the original idea. Difference are more then similarity and better aproach is to read a version 6 documentation first. Then you will find that:
56
+
57
+ - Data creation is very simular;
58
+ - Dt-Object becomes a storage and you can add more data to it;
59
+ - Dt-Object data will stay always immutable;
60
+ - For extracting data you can use 'query' and 'model' functions;
61
+ - For speed up a data evaluation dt-object has a dynamic filters;
62
+ - Import and export data-models from the previous version are available;
63
+
64
+
65
+
66
+ ## From v.2.x.x. - v.3.x.x (v.4.x.x )
5
67
 
6
68
  Upgrade to version 3 of the library will require some code changes.
7
69