morse-module

1.1.2 • Public • Published

Morse Module

npm npm

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 between character, number or symbol.
  • 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:. (space) /.

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

. .-.-.- , --..-- ? ..--.. ' .----. ! -.-.-- / -..-.
( -.--. ) -.--.- & .-... : ---... ; -.-.-. = -...-
+ .-.-. - -....- _ ..--.- " .-..-. $ ...-..- @ .--.-.
¿ ..-.- ¡ --...-

Package Sidebar

Install

npm i morse-module

Weekly Downloads

1

Version

1.1.2

License

ISC

Unpacked Size

5.74 kB

Total Files

3

Last publish

Collaborators

  • henry_emdth