(x, v)
| 99 | } |
| 100 | |
| 101 | setNodeValue (x, v) { |
| 102 | const n = this.nodes[x]; |
| 103 | |
| 104 | v = defined(v) ? v : null; |
| 105 | |
| 106 | if (n) { |
| 107 | n.value = v; |
| 108 | } else { |
| 109 | this.nodes[x] = node(v); |
| 110 | } |
| 111 | |
| 112 | return true; |
| 113 | } |
| 114 | |
| 115 | toJSON (space = 0) { |
| 116 | return JSON.stringify(this.nodes, null, space); |