diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-21 23:20:51 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-21 23:20:51 -0700 |
commit | 3d876159178d39736cc8e5f1711b9c0828b43882 (patch) | |
tree | d63ecb20393595609f68ce521ed65bf848f0194a /ext/bg/js | |
parent | fe859a96cdcd6964898bfd492be034c95fd90285 (diff) |
sort stats
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/translator.js | 12 |
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; } } |