MCPcopy
hub / github.com/webpack/webpack / mergeRuntimeOwned

Function mergeRuntimeOwned

lib/util/runtime.js:286–316  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

284 * @returns {RuntimeSpec} merged
285 */
286const mergeRuntimeOwned = (a, b) => {
287 if (b === undefined) {
288 return a;
289 } else if (a === b) {
290 return a;
291 } else if (a === undefined) {
292 if (typeof b === "string") {
293 return b;
294 }
295 /** @type {RuntimeSpecSortableSet} */
296 return new SortableSet(b);
297 } else if (typeof a === "string") {
298 if (typeof b === "string") {
299 /** @type {RuntimeSpecSortableSet} */
300 const set = new SortableSet();
301 set.add(a);
302 set.add(b);
303 return set;
304 }
305 /** @type {RuntimeSpecSortableSet} */
306 const set = new SortableSet(b);
307 set.add(a);
308 return set;
309 }
310 if (typeof b === "string") {
311 a.add(b);
312 return a;
313 }
314 for (const item of b) a.add(item);
315 return a;
316};
317
318/**
319 * Returns merged.

Callers 6

applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
getMergedModuleRuntimeFunction · 0.85
getEntryRuntimeFunction · 0.85
filterRuntimeFunction · 0.85

Calls 2

addMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected