@leafer/data 1.0.0-rc.16 → 1.0.0-rc.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/data",
3
- "version": "1.0.0-rc.16",
3
+ "version": "1.0.0-rc.18",
4
4
  "description": "@leafer/data",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-rc.16"
25
+ "@leafer/interface": "1.0.0-rc.18"
26
26
  }
27
27
  }
package/src/LeafData.ts CHANGED
@@ -65,21 +65,36 @@ export class LeafData implements ILeafData {
65
65
  if (this.__input && this.__input[name] !== undefined) this.__input[name] = undefined
66
66
  }
67
67
 
68
- public __getInputData(): IObject {
69
- const data: IObject = { tag: this.__leaf.tag }, { __input } = this
70
- let value: IValue, inputValue: IValue
71
- for (let key in this) {
72
- if (key[0] !== '_') {
73
- value = (this as IObject)['_' + key]
74
- if (value !== undefined) {
68
+ public __getInputData(names?: string[] | IObject): IObject {
69
+ const data: IObject = {}
75
70
 
76
- if (key === 'path' && !this.__pathInputed) continue // no path mode
71
+ if (names) {
77
72
 
78
- inputValue = __input ? __input[key] : undefined
79
- data[key] = (inputValue === undefined) ? value : inputValue
73
+ if (names instanceof Array) {
74
+ for (let name of names) data[name] = this.__getInput(name)
75
+ } else {
76
+ for (let name in names) data[name] = this.__getInput(name)
77
+ }
78
+
79
+ } else {
80
+
81
+ let value: IValue, inputValue: IValue, { __input } = this
82
+ data.tag = this.__leaf.tag
83
+ for (let key in this) {
84
+ if (key[0] !== '_') {
85
+ value = (this as IObject)['_' + key]
86
+ if (value !== undefined) {
87
+
88
+ if (key === 'path' && !this.__pathInputed) continue // no path mode
89
+
90
+ inputValue = __input ? __input[key] : undefined
91
+ data[key] = (inputValue === undefined) ? value : inputValue
92
+ }
80
93
  }
81
94
  }
95
+
82
96
  }
97
+
83
98
  return data
84
99
  }
85
100
 
package/types/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare class LeafData implements ILeafData {
23
23
  __setInput(name: string, value: any): void;
24
24
  __getInput(name: string): any;
25
25
  __removeInput(name: string): void;
26
- __getInputData(): IObject;
26
+ __getInputData(names?: string[] | IObject): IObject;
27
27
  __setMiddle(name: string, value: any): void;
28
28
  __getMiddle(name: string): any;
29
29
  __checkSingle(): void;