Format Upvotes like real reddit in subreddit commands

This commit is contained in:
Dragon Fire
2020-06-08 16:07:03 -04:00
parent c6365bb4a5
commit 7ff1de7539
8 changed files with 23 additions and 23 deletions
+4
View File
@@ -72,6 +72,10 @@ module.exports = class Util {
});
}
static formatNumberK(number) {
return number > 999 ? `${(number / 1000).toLocaleString(undefined, { maximumFractionDigits: 1 })}K` : number;
}
static base64(text, mode = 'encode') {
if (mode === 'encode') return Buffer.from(text).toString('base64');
if (mode === 'decode') return Buffer.from(text, 'base64').toString('utf8') || null;