diff --git a/README.md b/README.md index 9d5df93..9475a0e 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,13 @@ If you want to specify multiple ranks. https://github-profile-trophy.vercel.app/?username=ryo-ma&rank=S,AAA ``` +You can also exclude ranks. + +``` +https://github-profile-trophy.vercel.app/?username=ryo-ma&rank=-C,-B +``` + + ## Specify the maximum row & column size You can specify the maximum row and column size. diff --git a/src/trophy_list.ts b/src/trophy_list.ts index d317f6c..b9eaa35 100644 --- a/src/trophy_list.ts +++ b/src/trophy_list.ts @@ -58,6 +58,12 @@ export class TrophyList { }); } filterByRanks(ranks: Array) { + if (ranks.filter((rank) => rank.includes("-")).length !== 0) { + this.trophies = this.trophies.filter((trophy) => + !ranks.map(rank => rank.substring(1)).includes(trophy.rank) + ) + return + } this.trophies = this.trophies.filter((trophy) => ranks.includes(trophy.rank) );