Skip to content

Commit

Permalink
Merge pull request anuraghazra#131 from anuraghazra/fix-sort-langcard
Browse files Browse the repository at this point in the history
fix: fixed sorting of languages by percentage
  • Loading branch information
anuraghazra authored Jul 21, 2020
2 parents 4b01b41 + 8a8ff5b commit 6c16020
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/renderTopLanguages.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ const renderTopLanguages = (topLangs, options = {}) => {
}, 0);

// hide langs
langs = langs.filter((lang) => {
if (!hide_langs_below) return true;
return (lang.size / totalSize) * 100 > hide_langs_below;
});
langs = langs
.sort((a, b) => b.size - a.size)
.filter((lang) => {
if (!hide_langs_below) return true;
return (lang.size / totalSize) * 100 > hide_langs_below;
});

// returns theme based colors with proper overrides and defaults
const { titleColor, textColor, bgColor } = getCardColors({
Expand Down

0 comments on commit 6c16020

Please sign in to comment.