MCPcopy
hub / github.com/webpack/webpack / compareModulesByPostOrderIndexOrIdentifier

Function compareModulesByPostOrderIndexOrIdentifier

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

Source from the content-addressed store, hash-verified

293 * @returns {-1 | 0 | 1} compare result
294 */
295const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => {
296 const cmp = compareNumbers(
297 /** @type {number} */ (moduleGraph.getPostOrderIndex(a)),
298 /** @type {number} */ (moduleGraph.getPostOrderIndex(b))
299 );
300 if (cmp !== 0) return cmp;
301 return compareIds(a.identifier(), b.identifier());
302};
303
304/**
305 * Compares modules by pre order index or identifier.

Callers 1

applyMethod · 0.85

Calls 4

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

Tested by

no test coverage detected