dt-toolbox 7.1.1 → 7.1.3
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.
- package/Changelog.md +15 -0
- package/README.md +15 -5
- package/package.json +1 -1
- package/src/draft/index.js +4 -0
- package/src/flatData/from.js +4 -1
- package/src/flatObject/extractList.js +3 -4
- package/src/flatObject/index.js +2 -2
package/Changelog.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
## Release History
|
|
2
2
|
|
|
3
|
+
### 7.1.3 (2023-09-14)
|
|
4
|
+
- [x] Fix: extractList: Negative value is treated as property does not exist and returns null instead of real value;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 7.1.2 (2023-09-12)
|
|
9
|
+
- [x] Fix: Dt-Storage method 'from' is not filtering the list if requested 'breadcrumbs' does not exist;
|
|
10
|
+
- [ ] Bug: extractList: Negative value is treated as property does not exist and returns null instead of real value;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
### 7.1.1 (2023-09-05 )
|
|
4
15
|
- [x] Fix: Multiple queries in same programming scope;
|
|
16
|
+
- [ ] Bug: Dt-Storage method 'from' is not filtering the list if requested 'breadcrumbs' does not exist;
|
|
17
|
+
- [ ] Bug: extractList: Negative value is treated as property does not exist and returns null instead of real value;
|
|
5
18
|
|
|
6
19
|
|
|
7
20
|
|
|
@@ -12,6 +25,7 @@
|
|
|
12
25
|
- [x] Fix: Convertor to files shows 'root' in the beginning of the path;
|
|
13
26
|
- [x] Fix: Convertor to breadcrumbs shows 'root' in the beginning of the path;
|
|
14
27
|
- [ ] Bug: Multiple queries in same programming scope;
|
|
28
|
+
- [ ] Bug: Dt-Storage method 'from' is not filtering the list if requested 'breadcrumbs' does not exist;
|
|
15
29
|
|
|
16
30
|
|
|
17
31
|
|
|
@@ -28,6 +42,7 @@
|
|
|
28
42
|
- [ ] Bug: Convertor to files shows 'root' in the beginning of the path;
|
|
29
43
|
- [ ] Bug: Convertor to breadcrumbs shows 'root' in the beginning of the path;
|
|
30
44
|
- [ ] Bug: Multiple queries in same programming scope;
|
|
45
|
+
- [ ] Bug: Dt-Storage method 'from' is not filtering the list if requested 'breadcrumbs' does not exist;
|
|
31
46
|
|
|
32
47
|
|
|
33
48
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ After version 7.1.x `dt-object` api has a new method `extractList` that helps to
|
|
|
13
13
|
|
|
14
14
|
## Description
|
|
15
15
|
|
|
16
|
-
DT-Toolbox is created to simplify the work with deep nested javascript objects.
|
|
16
|
+
DT-Toolbox is a tool, created to simplify the work with deep nested javascript objects.
|
|
17
|
+
The library creates an immutable data-storage(dt-object). Storage data representation is based on data-model called `DT-model`.
|
|
17
18
|
|
|
18
19
|
## What is DT-model?
|
|
19
20
|
It's an internal 'dt-object' data description. Data is an array of lines where each line has 4 components:
|
|
@@ -26,12 +27,21 @@ It's an internal 'dt-object' data description. Data is an array of lines where e
|
|
|
26
27
|
// Where ->
|
|
27
28
|
// name: string. Name of the dt-line;
|
|
28
29
|
// flatData: object or array of primitive types;
|
|
29
|
-
// breadcrumbs: string. Bredcrumbs description of the current dt-line;
|
|
30
|
-
// edges: string[]. List of breadcrumbs of the related dt-lines;
|
|
30
|
+
// breadcrumbs: string. Bredcrumbs description(identifier) of the current dt-line;
|
|
31
|
+
// edges: string[]. List of breadcrumbs of the related dt-lines(children);
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
This data-description is easy to read, saved, or transfered.
|
|
34
35
|
|
|
36
|
+
DT-model can become a storage for multiple data blocks - `data-segments`. Each data-segment can be extracted but also can be queried and modeled together with other data-segments in a way to create a new dt-object.
|
|
37
|
+
|
|
38
|
+
Concept `state` - A specific shape of DT-model where all primitive states are stored in 'root' object and the other states as separated data-segments. Root data-segment is a flat object (single row without edges).
|
|
39
|
+
|
|
40
|
+
There is a library [@peter.naydenov/dt-queries](https://github.com/PeterNaydenov/dt-queries) that contains query functions that can be useful with data manipulation:
|
|
41
|
+
- splitSegments: Splits a solid data into multiple data-segments;
|
|
42
|
+
- joinSegments : Consolidate multiple data-segments in a single solid data;
|
|
43
|
+
- updateState : Updates the state with new data. Takes only declared data-segments and root data properties;
|
|
44
|
+
|
|
35
45
|
|
|
36
46
|
## Installation
|
|
37
47
|
Install for node.js projects by writing in your terminal:
|
|
@@ -52,7 +62,7 @@ import dtbox from 'dt-toolbox'
|
|
|
52
62
|
Use Dt-toolbox methods(init and load) to create a `dt-object`.
|
|
53
63
|
|
|
54
64
|
DT-object:
|
|
55
|
-
- Provides multiple insertion of data
|
|
65
|
+
- Provides multiple insertion of data-segments. Data from each insertion stays differentiated;
|
|
56
66
|
- Has prebuilded filters for fast search of data;
|
|
57
67
|
- Can create and register a customized filters for fast search of data;
|
|
58
68
|
- Can apply `query functions` to find, extract and reshape the data;
|
|
@@ -1174,9 +1184,9 @@ console.log ( result )
|
|
|
1174
1184
|
|
|
1175
1185
|
|
|
1176
1186
|
## External Links
|
|
1187
|
+
- [DT-Queries. Some useful query functions for DT-Toolbox](https://github.com/PeterNaydenov/dt-queries)
|
|
1177
1188
|
- [History of changes](https://github.com/PeterNaydenov/dt-toolbox/blob/master/Changelog.md)
|
|
1178
1189
|
- [Migration guide](https://github.com/PeterNaydenov/dt-toolbox/blob/master/Migration.guide.md)
|
|
1179
|
-
- [DT-Queries. Some useful query functions for DT-Toolbox](https://github.com/PeterNaydenov/dt-queries)
|
|
1180
1190
|
- [Documentation v.4.x.x](https://github.com/PeterNaydenov/dt-toolbox/blob/master/README_v.4.x.x.md)
|
|
1181
1191
|
- [Documentation v.2.x.x](https://github.com/PeterNaydenov/dt-toolbox/blob/master/README_v.2.x.x.md)
|
|
1182
1192
|
|
package/package.json
CHANGED
package/src/draft/index.js
CHANGED
package/src/flatData/from.js
CHANGED
|
@@ -6,8 +6,7 @@ function extractList ( dependencies, flatIO, indexFn ) {
|
|
|
6
6
|
return function exportList ( list, options={} ) {
|
|
7
7
|
const
|
|
8
8
|
root = indexFn ( 'root' )
|
|
9
|
-
, { main:{load} } = dependencies ()
|
|
10
|
-
, possibleAs = ['standard', 'std', 'midFlat', 'tuple', 'tuples', 'breadcrumb', 'breadcrumbs', 'files', 'file' ]
|
|
9
|
+
, { main:{load}, INIT_DATA_TYPES } = dependencies ()
|
|
11
10
|
;
|
|
12
11
|
let
|
|
13
12
|
error = false
|
|
@@ -19,7 +18,7 @@ return function exportList ( list, options={} ) {
|
|
|
19
18
|
error = true
|
|
20
19
|
errorMsg = `Options should be an object and property "as" is required`
|
|
21
20
|
}
|
|
22
|
-
if ( !error && !
|
|
21
|
+
if ( !error && !INIT_DATA_TYPES.includes(options.as) ) {
|
|
23
22
|
error = true
|
|
24
23
|
errorMsg = `Invalid option "as" value: ${options.as}. Choose one of: std, standard, ''`
|
|
25
24
|
}
|
|
@@ -29,7 +28,7 @@ return function exportList ( list, options={} ) {
|
|
|
29
28
|
return list
|
|
30
29
|
.map ( name => {
|
|
31
30
|
let lines = flatIO.export ( name );
|
|
32
|
-
if ( lines.length === 0 ) return root[1]
|
|
31
|
+
if ( lines.length === 0 ) return root[1].hasOwnProperty(name) ? root[1][name] : null
|
|
33
32
|
else return lines
|
|
34
33
|
})
|
|
35
34
|
.map ( item => {
|
package/src/flatObject/index.js
CHANGED
|
@@ -38,9 +38,9 @@ function flatObject ( dependencies, d ) {
|
|
|
38
38
|
}
|
|
39
39
|
;
|
|
40
40
|
|
|
41
|
-
function index (n) {
|
|
41
|
+
function index ( n ) {
|
|
42
42
|
if ( n == null ) return null
|
|
43
|
-
let r = flatIO.getLine(n)
|
|
43
|
+
let r = flatIO.getLine ( n )
|
|
44
44
|
if ( r ) {
|
|
45
45
|
let [ name, d, breadcrumbs, links ] = r;
|
|
46
46
|
let copy;
|