MCPcopy
hub / github.com/webpack/webpack / addAll

Method addAll

lib/util/LazySet.js:131–152  ·  view source on GitHub ↗

* Queues another iterable or lazy set for later merging so large bulk adds * can stay cheap until the set is read. * @param {Iterable<T> | LazySet<T>} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set * @returns {LazySet<T>} itself

(iterable)

Source from the content-addressed store, hash-verified

129 * @returns {LazySet<T>} itself
130 */
131 addAll(iterable) {
132 if (this._deopt) {
133 const _set = this._set;
134 for (const item of iterable) {
135 _set.add(item);
136 }
137 } else {
138 if (iterable instanceof LazySet) {
139 if (iterable._isEmpty()) return this;
140 this._toDeepMerge.push(iterable);
141 this._needMerge = true;
142 if (this._toDeepMerge.length > 100000) {
143 this._flatten();
144 }
145 } else {
146 this._toMerge.add(iterable);
147 this._needMerge = true;
148 }
149 if (this._toMerge.size > 100000) this._merge();
150 }
151 return this;
152 }
153
154 /**
155 * Removes all items and clears every deferred merge queue.

Callers 15

addFileTimestampsMethod · 0.45
addContextTimestampsMethod · 0.45
_doBuildMethod · 0.45
addCacheDependenciesMethod · 0.45
applyMethod · 0.45
_factorizeModuleMethod · 0.45
summarizeDependenciesMethod · 0.45
applyMethod · 0.45
_openPackMethod · 0.45
addAllToSetFunction · 0.45

Calls 5

_flattenMethod · 0.95
_mergeMethod · 0.95
_isEmptyMethod · 0.80
addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected