* Collapses the stacked layers into a single concrete map.
()
| 138 | * Collapses the stacked layers into a single concrete map. |
| 139 | */ |
| 140 | _compress() { |
| 141 | if (this.stack.length === 1) return; |
| 142 | this.map = new Map(); |
| 143 | for (const data of this.stack) { |
| 144 | for (const pair of data) { |
| 145 | if (pair[1] === TOMBSTONE) { |
| 146 | this.map.delete(pair[0]); |
| 147 | } else { |
| 148 | this.map.set(pair[0], pair[1]); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | this.stack = [this.map]; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Returns the visible keys as an array after collapsing the stack. |