Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Easy JavaScript morse encoder and decoder.
JavaScript
Branch: master
Failed to load latest commit information.
src Fixed silent misleading usage. Fixed error throwing.
README.md Added error handling example

README.md

morse.js

Easy JavaScript morse encoder and decoder.

Usage:

var str = "Hello World",
    encoded = morse.encode(str),
    decoded = morse.decode(encoded);

console.log(encoded); // ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."
console.log(decoded); // "HELLO WORLD"

Error handing:

var str = "Special String & +",
    encoded = morse.encode(str),
    decoded = morse.decode(encoded);

console.log(encoded); "... .--. . -.-. .. .- .-.. / ... - .-. .. -. --. / /"
console.log(decoded); "SPECIAL STRING  "

// Using morse.silent(false);
morse.silent(false);

morse.encode(str); // Uncaught Error: morse.encode: Can't handle &
Something went wrong with that request. Please try again.