dt-toolbox 7.1.3 → 7.2.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  ## Release History
2
2
 
3
+
4
+ ### 7.2.0 (2023-09-18)
5
+ - [x] Convertors recognize HTML DOM nodes. Makes a copy by reference;
6
+ - [x] Convertors recognize functions. Makes a copy by reference;
7
+ - [x] Model 'files' is not possible for functions and DOM nodes, so the value in the result will be string. For functions will be `function:functionName` and for DOM nodes will be `htmlElement:elementName`;
8
+
9
+
10
+
3
11
  ### 7.1.3 (2023-09-14)
4
12
  - [x] Fix: extractList: Negative value is treated as property does not exist and returns null instead of real value;
5
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dt-toolbox",
3
3
  "description": "Data manipulation tool",
4
- "version": "7.1.3",
4
+ "version": "7.2.0",
5
5
  "license": "MIT",
6
6
  "author": "Peter Naydenov",
7
7
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/PeterNaydenov/dt-toolbox#readme",
30
30
  "dependencies": {
31
- "@peter.naydenov/walk": "4.0.0"
31
+ "@peter.naydenov/walk": "4.1.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "c8": "^8.0.1",
@@ -65,7 +65,11 @@ function to ( type, dependencies, inData ) { // convert from flat to 'data-typ
65
65
  return tuples.toType ( inData )
66
66
  case 'files':
67
67
  tups = tuples.toType ( inData );
68
- return tups.map ( ([k,v]) => (( k === 'root' ) ? v : `${k}/${v}`) )
68
+ return tups.map ( ([k,v]) => {
69
+ if ( typeof v === 'function' ) return `${k}/function:${v.name}`
70
+ if ( v?.nodeType ) return `${k}/HtmlElement:${v.tagName? v.tagName.toLowerCase() : 'notSpecified'}`
71
+ return (( k === 'root' ) ? v : `${k}/${v}`)
72
+ })
69
73
  case 'breadcrumb' :
70
74
  case 'breadcrumbs':
71
75
  let current;
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  function extractList ( dependencies, flatIO, indexFn ) {
6
- return function exportList ( list, options={} ) {
6
+ return function extractList ( list, options ) {
7
7
  const
8
8
  root = indexFn ( 'root' )
9
9
  , { main:{load}, INIT_DATA_TYPES } = dependencies ()
@@ -12,7 +12,7 @@ return function exportList ( list, options={} ) {
12
12
  error = false
13
13
  , errorMsg = ''
14
14
  ;
15
-
15
+
16
16
  if ( options ) {
17
17
  if ( !options.as ) {
18
18
  error = true
@@ -22,7 +22,7 @@ return function exportList ( list, options={} ) {
22
22
  error = true
23
23
  errorMsg = `Invalid option "as" value: ${options.as}. Choose one of: std, standard, ''`
24
24
  }
25
- if ( error ) throw new Error ( `Invalid option "as" value: ${options.as}` )
25
+ if ( error ) throw new Error ( errorMsg )
26
26
  }
27
27
 
28
28
  return list