From 3599bea86ef4454a8037b6ad3aa0e6de45faa43c Mon Sep 17 00:00:00 2001 From: kalligator <387447+kalligator@users.noreply.github.com> Date: Sun, 12 Sep 2021 18:20:39 +0300 Subject: [PATCH] Allow custom replace for >1 char non-latin keys This fixes the issue where custom mapping fails for non-latin keys with a length of more than 1 character. --- lib/speakingurl.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/speakingurl.js b/lib/speakingurl.js index 4a62bc0..621091e 100644 --- a/lib/speakingurl.js +++ b/lib/speakingurl.js @@ -1509,11 +1509,7 @@ Object.keys(customReplacements).forEach(function (v) { var r; - if (v.length > 1) { - r = new RegExp('\\b' + escapeChars(v) + '\\b', 'gi'); - } else { - r = new RegExp(escapeChars(v), 'gi'); - } + r = new RegExp(escapeChars(v), 'gi'); input = input.replace(r, customReplacements[v]); }); @@ -1686,4 +1682,4 @@ } } catch (e) {} } -})(this); \ No newline at end of file +})(this);