From 4cfa18c7579a34d6d8831a8d45ba23156481ec08 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 29 Sep 2017 20:12:19 +0000 Subject: [PATCH] Clean this up a bit --- commands/text-edit/zalgo.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/commands/text-edit/zalgo.js b/commands/text-edit/zalgo.js index 5d46147f..c499b42c 100644 --- a/commands/text-edit/zalgo.js +++ b/commands/text-edit/zalgo.js @@ -27,14 +27,8 @@ module.exports = class ZalgoCommand extends Command { let result = ''; for (let i = 0; i < text.length; i++) { result += text[i]; - const counts = { - up: Math.floor(Math.random() * 8) + 1, - middle: Math.floor(Math.random() * 3), - down: Math.floor(Math.random() * 8) + 1 - }; - for (const type of Object.keys(counts)) { - let count = counts[type]; - const chars = zalgo[type]; + for (const chars of Object.values(zalgo)) { + let count = Math.floor(Math.random() * 5); while (count--) result += chars[Math.floor(Math.random() * chars.length)]; } }