mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 15:17:09 +00:00
Add boolean nodes
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user