1.0.1 • Published 1 year ago

bootcamp-dh-2022-decoder-morse v1.0.1

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

Build status

Table of Contents

Repository

this is the 👉 link of the repository

Features

  • Transforms from latin to morse code
  • Transforms from a morse code to latin
  • Supports latin language
  • Supports numbers
  • Supports punctuation marks
  • It is based on the page morcedecoder.com

Installing

Package manager

Using npm:

$ npm install bootcamp-dh-2022-decoder-morse

Once the package is installed, you can import the library using require approach:

const decoderMorse = require("bootcamp-dh-2022-decoder-morse");

For cases where something went wrong when trying to import a module into a custom or legacy environment, you can try importing the module package directly:

const decoderMorse = require("./node_modules/bootcamp-dh-2022-decoder-morse/index.js");

Example

const morseCustom = require("bootcamp-dh-2022-decoder-morse");

try {
	const morse1 = morseCustom.convertToMorse('"Hola');
	const morse2 = morseCustom.convertToMorse("mundo");
	console.log(morse1.str);
	console.log(morse2.str);

	const morseStr1 = { str: ".... --- .-.. .-" };
	const morseStr2 = { str: "-. --- -.. ." };
	const str1 = morseCustom.convertMorseToStr(morseStr1);
	const str2 = morseCustom.convertMorseToStr(morseStr2);
	console.log(str1.str);
	console.log(str2.str);
} catch (error) {
	console.log(error);
}

Response Schema

The response for a request contains the following information.

{
  str: "string decoder"
}
ór

return thorw exception

Note only supports characters defined in the image (any other character returns an exception)

Resources

License

MIT

Autor

  Name: Ruben Lupate Contreras
  Email: ruben.lupate.c@gmail.com