Add extra sorting parameters for libraries

This commit is contained in:
Koen Vlaswinkel
2023-06-20 14:24:56 +02:00
parent ddd97f08a3
commit 2800ccb74c

View File

@@ -56,6 +56,19 @@ export const ModeledMethodsList = ({
0,
);
// If the number of usages is equal, sort by number of methods descending
if (numberOfUsagesA === numberOfUsagesB) {
const numberOfMethodsA = groupedByLibrary[a].length;
const numberOfMethodsB = groupedByLibrary[b].length;
// If the number of methods is equal, sort by library name ascending
if (numberOfMethodsA === numberOfMethodsB) {
return a.localeCompare(b);
}
return numberOfMethodsB - numberOfMethodsA;
}
// Then sort by number of usages descending
return numberOfUsagesB - numberOfUsagesA;
});