From 3d876159178d39736cc8e5f1711b9c0828b43882 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 23:20:51 -0700 Subject: sort stats --- ext/bg/js/translator.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ext') 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; } } -- cgit v1.2.3