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.
- package/Changelog.md +15 -10
- package/LICENSE +1 -1
- package/Migration.guide.md +63 -1
- package/README.md +996 -346
- package/README_v.2.x.x.md +0 -1
- package/README_v.4.x.x.md +532 -0
- package/README_v.6.x.x.md +1158 -0
- package/package.json +21 -24
- package/src/convertors/index.js +43 -34
- package/src/convertors/midflat.js +76 -132
- package/src/convertors/standard.js +61 -86
- package/src/convertors/tuples.js +171 -0
- package/src/flatData/connect.js +50 -0
- package/src/flatData/export.js +46 -0
- package/src/flatData/filters/list.js +11 -0
- package/src/flatData/filters/listObject.js +13 -0
- package/src/flatData/filters/object.js +12 -0
- package/src/flatData/filters/root.js +12 -0
- package/src/flatData/find.js +20 -0
- package/src/flatData/from.js +33 -0
- package/src/flatData/get.js +29 -0
- package/src/flatData/index.js +101 -0
- package/src/flatData/insert.js +24 -0
- package/src/flatData/like.js +24 -0
- package/src/flatData/look.js +56 -0
- package/src/flatData/push.js +19 -0
- package/src/flatData/save.js +17 -0
- package/src/flatData/set.js +26 -0
- package/src/flatData/setupFilter.js +21 -0
- package/src/flatData/use.js +16 -0
- package/src/flatObject/copy.js +19 -0
- package/src/flatObject/export.js +13 -0
- package/src/flatObject/index.js +55 -0
- package/src/flatObject/insert.js +38 -0
- package/src/flatObject/model.js +32 -0
- package/src/flatObject/query.js +24 -0
- package/src/flatObject/setupFilter.js +12 -0
- package/src/main.js +21 -689
- package/src/mainLib.js +114 -0
- package/src/compareMethod/change.js +0 -21
- package/src/compareMethod/different.js +0 -18
- package/src/compareMethod/identical.js +0 -21
- package/src/compareMethod/index.js +0 -13
- package/src/compareMethod/missing.js +0 -18
- package/src/compareMethod/same.js +0 -18
- package/src/convertors/breadcrumbs.js +0 -148
- package/src/help/extractSelection.js +0 -12
- package/src/help/filterObject.js +0 -25
- package/src/help/hasNumbers.js +0 -14
- package/src/help/index.js +0 -35
- package/src/help/isItPrimitive.js +0 -10
- package/src/help/objectsByLevel.js +0 -16
- package/src/help/reduceTuples.js +0 -29
- package/src/help/sanitizeFlatKeys.js +0 -30
- package/src/help/toBreadcrumbsKeys.js +0 -28
- package/src/help/tuplesToBreadcrumbs.js +0 -25
- package/src/help/updateSelection.js +0 -12
- package/src/help/zipObject.js +0 -24
- package/src/lib/assemble.js +0 -45
- package/src/lib/attach.js +0 -20
- package/src/lib/block.js +0 -33
- package/src/lib/combine.js +0 -38
- package/src/lib/deep.js +0 -23
- package/src/lib/find.js +0 -36
- package/src/lib/folder.js +0 -42
- package/src/lib/index.js +0 -56
- package/src/lib/modify.js +0 -22
- package/src/lib/parent.js +0 -51
- package/src/lib/purify.js +0 -37
- package/src/lib/transform.js +0 -55
- package/src/modifiers/add.js +0 -18
- package/src/modifiers/append.js +0 -18
- package/src/modifiers/combineShallow.js +0 -119
- package/src/modifiers/flatten.js +0 -38
- package/src/modifiers/index.js +0 -34
- package/src/modifiers/insert.js +0 -21
- package/src/modifiers/keyPrefix.js +0 -27
- package/src/modifiers/mix.js +0 -25
- package/src/modifiers/overwrite.js +0 -18
- package/src/modifiers/prepend.js +0 -19
- package/src/modifiers/reverse.js +0 -23
- package/src/modifiers/update.js +0 -18
- 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
|
-
###
|
|
9
|
-
- [x]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- [x]
|
|
14
|
-
- [
|
|
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.
|
package/Migration.guide.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|