MCPcopy
hub / github.com/webpack/webpack / compareModulesByPreOrderIndexOrIdentifier

Function compareModulesByPreOrderIndexOrIdentifier

lib/util/comparators.js:311–318  ·  view source on GitHub ↗
(moduleGraph, a, b)

Source from the content-addressed store, hash-verified

309 * @returns {-1 | 0 | 1} compare result
310 */
311const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => {
312 const cmp = compareNumbers(
313 /** @type {number} */ (moduleGraph.getPreOrderIndex(a)),
314 /** @type {number} */ (moduleGraph.getPreOrderIndex(b))
315 );
316 if (cmp !== 0) return cmp;
317 return compareIds(a.identifier(), b.identifier());
318};
319
320/**
321 * Compares modules by id or identifier.

Callers 5

applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 4

compareIdsFunction · 0.85
getPreOrderIndexMethod · 0.80
compareNumbersFunction · 0.70
identifierMethod · 0.45

Tested by

no test coverage detected