From 139ccd4d469e4cf2cdeeb59d1e25390417db0694 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 12 Apr 2017 17:54:08 +0000 Subject: [PATCH] Make my translator Case-Insensitive --- functions/translator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/translator.js b/functions/translator.js index 36ceefe8..6faca472 100644 --- a/functions/translator.js +++ b/functions/translator.js @@ -2,7 +2,7 @@ module.exports.wordTrans = (text, words) => { text = text.split(' '); let translation = []; for (let i = 0; i < text.length; i++) { - const word = text[i]; + const word = text[i].toLowerCase(); const wordPuncStrip = word.replace(/[.,?!-]/g, ''); if (words[wordPuncStrip]) { const reg = new RegExp(wordPuncStrip, 'gi'); @@ -19,7 +19,7 @@ module.exports.letterTrans = (text, letters) => { text = text.split(''); let translation = []; for (let i = 0; i < text.length; i++) { - const letter = text[i]; + const letter = text[i].toLowerCase(); if (letters[letter]) { const reg = new RegExp(letter, 'gi'); translation.push(letter.replace(reg, letters[letter]));