Add boolean nodes

This commit is contained in:
Misode
2020-05-25 19:04:25 +02:00
parent 25bfaf666a
commit 3620074c86
3 changed files with 34 additions and 6 deletions

View File

@@ -24,14 +24,18 @@ export class DataModel {
this.listeners.forEach(listener => listener.invalidated(this))
}
set(path: Path, value: any) {
get(path: Path) {
let node = this.data;
for (let index of path.pop()) {
if (node[index] === undefined) {
node[index] = {}
}
for (let index of path) {
if (node === undefined) node = {}
node = node[index]
}
return node
}
set(path: Path, value: any) {
let node = this.get(path.pop())
if (node === undefined) node = {}
console.log('Set', path.toString(), JSON.stringify(value))