MCPcopy
hub / github.com/webpack/webpack / mergeMaybeArrays

Function mergeMaybeArrays

lib/asset/AssetGenerator.js:73–81  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

71 * @returns {T[] & U[]} array
72 */
73const mergeMaybeArrays = (a, b) => {
74 /** @type {Set<T | U | null | undefined | string | Set<T> | Set<U>>} */
75 const set = new Set();
76 if (Array.isArray(a)) for (const item of a) set.add(item);
77 else set.add(a);
78 if (Array.isArray(b)) for (const item of b) set.add(item);
79 else set.add(b);
80 return /** @type {T[] & U[]} */ ([.../** @type {Set<T | U>} */ (set)]);
81};
82
83/**
84 * Merges the provided values into a single result.

Callers 2

mergeAssetInfoFunction · 0.85
mergeRelatedInfoFunction · 0.85

Calls 2

isArrayMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected