119 private static readonly MORSE_CODE: Record<string, string> = {
120 'A':
'.-',
'B':
'-...',
'C':
'-.-.',
'D':
'-..',
121 'E':
'.',
'F':
'..-.',
'G':
'--.',
'H':
'....',
122 'I':
'..',
'J':
'.---',
'K':
'-.-',
'L':
'.-..',
123 'M':
'--',
'N':
'-.',
'O':
'---',
'P':
'.--.',
124 'Q':
'--.-',
'R':
'.-.',
'S':
'...',
'T':
'-',
125 'U':
'..-',
'V':
'...-',
'W':
'.--',
'X':
'-..-',
126 'Y':
'-.--',
'Z':
'--..',
127 '0':
'-----',
'1':
'.----',
'2':
'..---',
'3':
'...--',
128 '4':
'....-',
'5':
'.....',
'6':
'-....',
'7':
'--...',
129 '8':
'---..',
'9':
'----.',
130 '.':
'.-.-.-',
',':
'--..--',
'?':
'..--..',
131 "'":
'.----.',
'!':
'-.-.--',
'/':
'-..-.',
132 '(':
'-.--.',
')':
'-.--.-',
'&':
'.-...',
133 ':':
'---...',
';':
'-.-.-.',
'=':
'-...-',
134 '+':
'.-.-.',
'-':
'-....-',
'_':
'..--.-',
135 '"':
'.-..-.',
'$':
'...-..-',
'@':
'.--.-.',
149 private static readonly REVERSE_MORSE_CODE: Record<string, string> = (() => {
150 const rev: Record<string, string> = {};
151 for (
const [
char, code] of Object.entries(
MorseTranslator.MORSE_CODE)) {
182 public static toMorse(input:
string):
string {
184 const final:
string = input
189 this.log.info(
getMessage(
"morseConverted", input,
final));
223 public static fromMorse(morseInput:
string):
string {
225 const decoded = morseInput
232 this.log.info(
getMessage(
"morseDecoded", morseInput, decoded));