morse-module
v1.1.2
Published
[![npm](https://img.shields.io/npm/v/morse-module)](https://www.npmjs.com/package/morse-module) [![npm](https://img.shields.io/npm/dm/morse-module)](https://www.npmjs.com/package/morse-module)
Downloads
6
Maintainers
Readme
Morse Module
This module will help you interpret Morse code into Latin text.
Installation
npm
$ npm i morse-module
Usage
const codeText = require('morse-module');
console.log(codeText.textToMorse('HELLO WORLD NODEJS'));
console.log(codeText.morseToText('-. --- -.. . .--- ...'));
Console
.... . .-.. .-.. --- / .-- --- .-. .-.. -.. / -. --- -.. . .--- ...
NODEJS
User guide
| Method | Description | Parameter | Return Value |
|---------------|-------------------------------------------------------------------------------------------------------|-----------|------------------|
| textToMorse()
| convert morse code to latin text | String
| String
|
| morseToText()
| convert latin text code to morse code, if the format of the code is invalid it will return Undefined
. | String
| String
undefined
|
Morse code format
- Morse code to be interpreted into Latin must have a space
- To represent a space it must be expressed as: space bar space
/
. - Morse code must not contain a leading or trailing space.
- For Morse code, it is considered invalid if there are characters other than:
.
/
.
List code suport
Latin
| A | .- | B | -... | C | -.-. | D | -.. | E | . | F | ..-. | |-------|------|-------|------|-------|------|-------|------|-------|------|-------|------| | G | --. | H | .... | I | .. | J | .--- | K | -.- | L | .-.. | | M | -- | N | -. | O | --- | P | .--. | Q | --.- | R | .-. | | S | ... | T | - | U | ..- | V | ...- | W | .-- | X | -..- | | Y | -.-- | Z | --.. | | | | | | | | |
Numbers
| 0 | ----- | 1 | .---- | 2 | ..--- | 3 | ...-- | 4 | ....- | 5 | ..... | |-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------| | 6 | -.... | 7 | --... | 8 | ---.. | 9 | ----. | | | | |
Puntuation
| . | .-.-.- | , | --..-- | ? | ..--.. | ' | .----. | ! | -.-.-- | / | -..-. | |-------|--------|-------|--------|-------|--------|-------|--------|-------|---------|-------|--------| | ( | -.--. | ) | -.--.- | & | .-... | : | ---... | ; | -.-.-. | = | -...- | | + | .-.-. | - | -....- | _ | ..--.- | " | .-..-. | $ | ...-..- | @ | .--.-. | | ¿ | ..-.- | ¡ | --...- | | | | | | | | |