MCPcopy
hub / github.com/webpack/webpack / compareModulesByIdOrIdentifier

Function compareModulesByIdOrIdentifier

lib/util/comparators.js:327–334  ·  view source on GitHub ↗
(chunkGraph, a, b)

Source from the content-addressed store, hash-verified

325 * @returns {-1 | 0 | 1} compare result
326 */
327const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => {
328 const cmp = compareIds(
329 /** @type {ModuleId} */ (chunkGraph.getModuleId(a)),
330 /** @type {ModuleId} */ (chunkGraph.getModuleId(b))
331 );
332 if (cmp !== 0) return cmp;
333 return compareIds(a.identifier(), b.identifier());
334};
335
336/**
337 * Compare modules by their full name. This differs from comparing by identifier in that the values have been normalized to be relative to the compiler context.

Callers

nothing calls this directly

Calls 3

compareIdsFunction · 0.85
getModuleIdMethod · 0.80
identifierMethod · 0.45

Tested by

no test coverage detected