Function
Static Public Summary | ||
public |
decodeMorseCode(morseCode: string, options: Object): string |
since 0.0.1 Returns the original message of morse code passed to the function. |
public |
encodeMorseCode(msg: string, options: Object): string |
since 0.0.1 Returns the morse code of message passed to the function. |
Static Public
public decodeMorseCode(morseCode: string, options: Object): string since 0.0.1 Returns the original message of morse code passed to the function. source
import {decodeMorseCode} from 'morse-code/src/main.js'
Params:
Name | Type | Attribute | Description |
morseCode | string |
|
morse code |
options | Object |
|
optional config |
options.long | string |
|
the long signal in morse code |
options.short | string |
|
the short signal in morse code |
options.delimiter | string |
|
the delimiter in morse code |
Example:
decodeMorseCode("../..../.-/...-/./.-/.--././-./.-.-.-")
decodeMorseCode("--....--.-----/--.....--.----/---..---../.----./.../../-.-./--.....--.---./--....--.-----")
const options = {
long: "2",
short: "1",
delimiter: "0",
};
decodeMorseCode("222112221101222210111", options);
public encodeMorseCode(msg: string, options: Object): string since 0.0.1 Returns the morse code of message passed to the function. source
import {encodeMorseCode} from 'morse-code/src/main.js'
Params:
Name | Type | Attribute | Description |
msg | string |
|
original message |
options | Object |
|
optional config |
options.long | string |
|
the long signal in morse code |
options.short | string |
|
the short signal in morse code |
options.delimiter | string |
|
the delimiter in morse code |
Example:
encodeMorseCode("I have an apple.")
encodeMorseCode("もぎゅっと“love”で接近中!")
const options = {
long: "2",
short: "1",
delimiter: "0",
};
encodeMorseCode("爱してるばんざーい!", options);