MCPcopy
hub / github.com/webpack/webpack / combine

Function combine

lib/util/semver.js:248–261  ·  view source on GitHub ↗
(items, fn)

Source from the content-addressed store, hash-verified

246 * @returns {SemVerRange} result
247 */
248 const combine = (items, fn) => {
249 if (items.length === 1) return items[0];
250 const arr = [];
251 for (const item of items.slice().reverse()) {
252 if (0 in item) {
253 arr.push(item);
254 } else {
255 arr.push(...item.slice(1));
256 }
257 }
258
259 // eslint-disable-next-line no-sparse-arrays
260 return [, ...arr, ...items.slice(1).map(() => fn)];
261 };
262
263 /**
264 * Returns the sem ver range.

Callers 5

parseRangeFunction · 0.70
parseLogicalOrFunction · 0.70
combineSizesFunction · 0.50
getExportsMethod · 0.50
_addExportFragmentsMethod · 0.50

Calls 2

sliceMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected