Skip to content

FrostyX/morsey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morsey

A package for encoding and decoding Morse code in Gleam.

Package Version Hex Docs

Usage

Encode

import gleam/io
import morsey

let text = "Hello world!"
case morsey.encode(text) {
  Ok(symbols) ->
    io.println("Morse code for " <> text <> " is " <> morsey.to_string(symbols))
  Error(morsey.InvalidCharacter(char)) ->
    io.println_error("Invalid character: " <> char)
}

Decode

import gleam/io
import morsey

".... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--"
|> morsey.from_string
|> morsey.decode
|> io.println

Development

gleam run   # Run the project
gleam test  # Run the tests

About

Encoding and decoding Morse code in Gleam

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages