Add conditional rendering

This commit is contained in:
Misode
2020-05-26 17:25:42 +02:00
parent a6661a8563
commit 8371e43276
9 changed files with 64 additions and 25 deletions
+2 -2
View File
@@ -19,12 +19,12 @@ export class ObjectNode extends AbstractNode<IObject> {
})
}
transform(value: IObject) {
transform(path: Path, value: IObject) {
if (value === undefined) return undefined
value = value || {}
let res: any = {}
Object.keys(this.fields).forEach(f =>
res[f] = this.fields[f].transform(value[f])
res[f] = this.fields[f].transform(path.push(f), value[f])
)
return res;
}