npm.io
1.0.0 • Published 3 years ago

rfqt-morse-code

Licence
ISC
Version
1.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0

https://www.npmjs.com/package/rfqt-morse-code

Installation

Using npm:

$ npm install rfqt-morse-code

Example of use

Once the package is installed, you can import the library as follows:

const { encodeMorseCode, decodeMorseCode } = require('rfqt-morse-code');

To use the function encodeMorseCode you must send a text string that you want to encode to morse code. In the same way, for the decodeMorseCode function, a string containing the morse code to be decoded must be sent.

const textToMorseCode = encodeMorseCode("Hello World");
const morseCodeToText = decodeMorseCode("--. --- --- -.. -... -.-- .");

console.log("Hello world in morse code:", textToMorseCode);
console.log("--. --- --- -.. -... -.-- .", "is:", morseCodeToText);
Hello world in morse code: .... . .-.. .-.. --- / .-- --- .-. .-.. -..
--. --- --- -.. -... -.-- . is: GOODBYE