aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-21 23:20:51 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-21 23:20:51 -0700
commit3d876159178d39736cc8e5f1711b9c0828b43882 (patch)
treed63ecb20393595609f68ce521ed65bf848f0194a /ext/bg
parentfe859a96cdcd6964898bfd492be034c95fd90285 (diff)
sort stats
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/translator.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index cc0336e7..ede89fc6 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -190,6 +190,18 @@ class Translator {
group.push(dictTagSanitize(stat));
}
+ for (const category in stats) {
+ stats[category].sort((a, b) => {
+ if (a.notes < b.notes) {
+ return -1;
+ } else if (a.notes > b.notes) {
+ return 1;
+ } else {
+ return 0;
+ }
+ });
+ }
+
return stats;
}
}