MorseMessage
Direct Subclass:
Indirect Subclass:
Class for conveniently translating to and from Morse code. Deals with error handling. Works out if the input is Morse code or not.
Example:
import MorseMessage from 'morse-pro-message';
var morseMessage = new MorseMessage();
var input;
var output;
try {
output = morseMessage.translate("abc");
catch (ex) {
// input will have errors surrounded by paired '#' signs
// output will be best attempt at translation, with untranslatables replaced with '#'
morseMessage.clearError(); // remove all the '#'
}
if (morseMessage.inputWasMorse) {
// do something
}
Constructor Summary
Public Constructor | ||
public |
constructor(prosigns: boolean) |
Member Summary
Public Members | ||
public |
hasError: * |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
useProsigns: * |
Method Summary
Public Methods | ||
public |
Clear all the errors from the morse and message. |
|
public |
|
Public Constructors
Public Members
public hasError: * source
public inputWasMorse: * source
public useProsigns: * source
Public Methods
public clearError() source
Clear all the errors from the morse and message. Useful if you want to play the sound even though it didn't translate.