MCPcopy
hub / github.com/webpack/webpack / _compress

Method _compress

lib/util/StackedMap.js:140–153  ·  view source on GitHub ↗

* Collapses the stacked layers into a single concrete map.

()

Source from the content-addressed store, hash-verified

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.

Callers 4

asArrayMethod · 0.95
asSetMethod · 0.95
asPairArrayMethod · 0.95
sizeMethod · 0.95

Calls 2

deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected