1.0.0 • Published 1 year ago

rfqt-morse-code v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Link to NPM repository

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