Skip to content

Commit

Permalink
Ensure default exports sort above named exports.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Apr 23, 2018
1 parent 681eca1 commit d05e966
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/generate-by-module-markdown-table
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ function cmp(a, b) {

function sortByPackageAndExport([,,mappingA], [,,mappingB]) {
if (mappingA.module === mappingB.module) {
return cmp(mappingA.export || "", mappingB.export || "");
// ensure default exports sort higher within a package
let aExport = mappingA.export === 'default' ? '' : mappingA.export;
let bExport = mappingB.export === 'default' ? '' : mappingB.export;
return cmp(aExport || "", bExport || "");
}

return cmp(mappingA.module, mappingB.module);
Expand Down

0 comments on commit d05e966

Please sign in to comment.