dc-morse
v1.1.1
Published
morse, decoder and coder.
Downloads
8
Readme
DC-morse
Description
DC-morse its a powerful library witch you can code/decode morse string, its written in js and use CommonJs as module distribution, get all the information on its : npm main page.
Install
you can install as local module, with the command:
npm i dc-morse
Use
Api
There are two API allow to use, and help to decoder or coder to/from morse code.
coder(consumer, callback);
decoder(consumer, callback);
- [consumer] A good consumer must be a string another type will be reject
- [callback] A callback must be a function and admit just one parameter(Result of the decoder/coder).
Examples
Input: Basic coder word
const dcmorse = require("dc-morse");
dcmorse.coder("hi", (result) => {
console.log(`coder: ${result}`);
});
Output
coder: .... ..
Input: Basic decoder word
const dcmorse = require("dc-morse");
dcmorse.decoder(".... ..", (result) => {
console.log(`decoder: ${result}`);
});
Output
decoder: HI
Input: Complex coder word
const dcmorse = require("dc-morse");
dcmorse.coder("This is aN example of CoMplex consumer", (result) => {
console.log(`coder: ${result}`);
});
Output
coder: - .... .. ... / .. ... / .- -. / . -..- .- -- .--. .-.. . / --- ..-. / -.-. --- -- .--. .-.. . -..- / -.-. --- -. ... ..- -- . .-.
Every decoder output will be UpperCase more information morsedecoder
Limitation
- All consumer must be of type string another kind of data or objects will be reject and produce an error.
- consumer allow compose of many words ej. "hi, this is a complex consumer".
- Empty string or non string consumer will be reject.