MCPcopy
hub / github.com/webpack/webpack / compareTo

Method compareTo

lib/ChunkGroup.js:538–545  ·  view source on GitHub ↗

* Sorting predicate which allows current ChunkGroup to be compared against another. * Sorting values are based off of number of chunks in ChunkGroup. * @param {ChunkGraph} chunkGraph the chunk graph * @param {ChunkGroup} otherGroup the chunkGroup to compare this against * @returns {-1 | 0 |

(chunkGraph, otherGroup)

Source from the content-addressed store, hash-verified

536 * @returns {-1 | 0 | 1} sort position for comparison
537 */
538 compareTo(chunkGraph, otherGroup) {
539 if (this.chunks.length > otherGroup.chunks.length) return -1;
540 if (this.chunks.length < otherGroup.chunks.length) return 1;
541 return compareIterables(compareChunks(chunkGraph))(
542 this.chunks,
543 otherGroup.chunks
544 );
545 }
546
547 /**
548 * Aggregates per-block `*Order` options for the blocks that bridge this

Callers 1

getChildrenByOrdersMethod · 0.45

Calls 2

compareIterablesFunction · 0.85
compareChunksFunction · 0.85

Tested by

no test coverage detected