MCPcopy
hub / github.com/webpack/webpack / get

Method get

lib/util/StackedMap.js:116–135  ·  view source on GitHub ↗

* Returns the visible value for a key, caching parent hits and misses in the * current layer. * @param {K} item the key of the element to return * @returns {Cell<V>} the value of the element

(item)

Source from the content-addressed store, hash-verified

114 * @returns {Cell<V>} the value of the element
115 */
116 get(item) {
117 const topValue = this.map.get(item);
118 if (topValue !== undefined) {
119 return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER
120 ? undefined
121 : topValue;
122 }
123 if (this.stack.length > 1) {
124 for (let i = this.stack.length - 2; i >= 0; i--) {
125 const value = this.stack[i].get(item);
126 if (value !== undefined) {
127 this.map.set(item, value);
128 return value === TOMBSTONE || value === UNDEFINED_MARKER
129 ? undefined
130 : value;
131 }
132 }
133 this.map.set(item, TOMBSTONE);
134 }
135 }
136
137 /**
138 * Collapses the stacked layers into a single concrete map.

Callers 15

getEvaluatedExprFunction · 0.45
createHooksRegistryFunction · 0.45
createDeprecationFunction · 0.45
isSourceEqualFunction · 0.45
cachedCleverMergeFunction · 0.45
cachedSetPropertyFunction · 0.45
cachedParseObjectFunction · 0.45
getInfoFunction · 0.45
_cleverMergeFunction · 0.45
getFromByValuesFunction · 0.45
topologicalSort.jsFile · 0.45
getUsedNamesInScopeInfoFunction · 0.45

Calls 1

setMethod · 0.45

Tested by

no test coverage detected