@leafer/data
Advanced tools
+2
-2
| { | ||
| "name": "@leafer/data", | ||
| "version": "1.0.0-rc.5", | ||
| "version": "1.0.0-rc.6", | ||
| "description": "@leafer/data", | ||
@@ -25,4 +25,4 @@ "author": "Chao (Leafer) Wan", | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.0-rc.5" | ||
| "@leafer/interface": "1.0.0-rc.6" | ||
| } | ||
| } |
+14
-9
@@ -1,2 +0,2 @@ | ||
| import { ILeafData, ILeaf, IObject, __Value } from '@leafer/interface' | ||
| import { ILeafData, ILeafDataOptions, ILeaf, IObject, __Value } from '@leafer/interface' | ||
@@ -44,12 +44,17 @@ | ||
| public __getInputData(): IObject { | ||
| public __getInputData(options?: ILeafDataOptions): IObject { | ||
| const data: IObject = { tag: this.__leaf.tag }, { __input } = this | ||
| let realKey: string, value: __Value | ||
| for (let key in this) { | ||
| realKey = key.substring(1) | ||
| if ((this as any)[realKey] !== undefined) { | ||
| value = __input ? __input[realKey] : undefined | ||
| data[realKey] = value === undefined ? this[key] : value | ||
| if (options) { | ||
| for (let key in this) { | ||
| if (key[0] !== '_') data[key] = this[key] | ||
| } | ||
| } else { | ||
| let realKey: string, value: __Value | ||
| for (let key in this) { | ||
| realKey = key.substring(1) | ||
| if ((this as any)[realKey] !== undefined) { | ||
| value = __input ? __input[realKey] : undefined | ||
| data[realKey] = value === undefined ? this[key] : value | ||
| } | ||
| } | ||
| } | ||
@@ -56,0 +61,0 @@ return data |
+2
-2
@@ -1,2 +0,2 @@ | ||
| import { IObject, ILeafData, ILeaf } from '@leafer/interface'; | ||
| import { IObject, ILeafData, ILeaf, ILeafDataOptions } from '@leafer/interface'; | ||
@@ -22,3 +22,3 @@ declare const DataHelper: { | ||
| __removeInput(name: string): void; | ||
| __getInputData(): IObject; | ||
| __getInputData(options?: ILeafDataOptions): IObject; | ||
| __setMiddle(name: string, value: any): void; | ||
@@ -25,0 +25,0 @@ __getMiddle(name: string): any; |
6120
4.74%127
4.96%