From 991bb887aee26abd3605d6d3c8f3bbfebd0e4a69 Mon Sep 17 00:00:00 2001 From: misterRaven Date: Thu, 9 Feb 2017 17:20:06 +0700 Subject: [PATCH 1/2] Punctuation symbols for Morse code --- src/js/operations/MorseCode.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/js/operations/MorseCode.js b/src/js/operations/MorseCode.js index fbab4aed..38b94a30 100644 --- a/src/js/operations/MorseCode.js +++ b/src/js/operations/MorseCode.js @@ -65,6 +65,24 @@ var MorseCode = { "8": "", "9": "", "0": "", + ".": "", + ",": "", + ":": "", + ";": "", + "!": "", + "?": "", + "'": "", + "\"": "", + "/": "", + "-": "", + "+": "", + "(": "", + ")": "", + "@": "", + "=": "", + "&": "", + "_": "", + "$": "" }, From 1cc7835a8d7d3b79ccc2f83e35ab0154599c338b Mon Sep 17 00:00:00 2001 From: misterRaven Date: Thu, 9 Feb 2017 17:29:12 +0700 Subject: [PATCH 2/2] FromMorse operation extended to treat dashes & hyphens as long signals --- src/js/operations/MorseCode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/operations/MorseCode.js b/src/js/operations/MorseCode.js index 38b94a30..7a71aba2 100644 --- a/src/js/operations/MorseCode.js +++ b/src/js/operations/MorseCode.js @@ -163,8 +163,8 @@ var MorseCode = { var letterDelim = Utils.charRep[args[0]]; var wordDelim = Utils.charRep[args[1]]; - input = input.replace(/-|_|dash/ig, ""); - input = input.replace(/\.|dot/ig, ""); + input = input.replace(/-|‐|−|_|–|—|dash/ig, ""); //hyphen-minus|hyphen|minus-sign|undersore|en-dash|em-dash + input = input.replace(/\.|·|dot/ig, ""); var words = input.split(wordDelim); words = Array.prototype.map.call(words, function(word) {