Morse Node
A very tiny, dependency-free Morse code encoder and decoder. Currently supports the ITU standard.
Install
npm install morse-node
Getting Started
Setup API
var morse = ;
Encoding
- All alphanumeric characters are accepted, available symbols includes everything inside the brackets [ . , ? ' ! / ( ) & : ; = + - _ " $ @ ].
var msg = morse;
Decoding
- Letters are seperated by a single space.
- Words are seperated by a forward slash " / ".
var msg = morse;
isValid
- Check validity of a string by using the isValid function.
- Encoding and decoding functions do not make this check and will attempt to translate your string regardless of undefined characters.
Example
example.js
var morse = ; var encoded = morse;console; var decoded = morse;console; console;console;console;console;
Output
.--. .- -.-. -.- / -- -.-- / -... --- -..- / .-- .. - .... / ..-. .. ...- . / -.. --- --.. . -. / .-.. .. --.- ..- --- .-. / .--- ..- --. ... -.-.--
pack my box with five dozen liquor jugs!
true
false
true
false