From 53dda834f9c04aa19b2f3e2bf316ddf428793d69 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Thu, 23 Apr 2020 20:33:48 +0530 Subject: [PATCH] Add /g to replace multiple spaces. --- commands/expand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/expand.js b/commands/expand.js index 2165a38..74e307a 100644 --- a/commands/expand.js +++ b/commands/expand.js @@ -22,7 +22,7 @@ function expand(words, text) { const word = wordsWithLetter[Math.floor(Math.random() * wordsWithLetter.length)]; return word; - }).reduce((acc, cur) => acc + " " + cur).replace(/\s{2,}/, " "); + }).reduce((acc, cur) => acc + " " + cur).replace(/\s{2,}/g, " "); }