(x, v)
| 119 | } |
| 120 | |
| 121 | setNodeValue (x, v) { |
| 122 | const n = this.nodes[x]; |
| 123 | |
| 124 | v = defined(v) ? v : null; |
| 125 | |
| 126 | if (n) { |
| 127 | n.value = v; |
| 128 | } else { |
| 129 | this.nodes[x] = node(v); |
| 130 | } |
| 131 | |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | toJSON (space = 0) { |
| 136 | return JSON.stringify(this.nodes, null, space); |