Skip to content

Commit

Permalink
make chunk compare stable
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Oct 19, 2018
1 parent 3217d02 commit a7db689
Show file tree
Hide file tree
Showing 2 changed files with 692 additions and 688 deletions.
4 changes: 4 additions & 0 deletions lib/Chunk.js
Expand Up @@ -313,6 +313,10 @@ class Chunk {
* @returns {-1|0|1} this is a comparitor function like sort and returns -1, 0, or 1 based on sort order
*/
compareTo(otherChunk) {
if (this.name && !otherChunk.name) return -1;
if (!this.name && otherChunk.name) return 1;
if (this.name < otherChunk.name) return -1;
if (this.name > otherChunk.name) return 1;
if (this._modules.size > otherChunk._modules.size) return -1;
if (this._modules.size < otherChunk._modules.size) return 1;
this._modules.sort();
Expand Down

0 comments on commit a7db689

Please sign in to comment.