Current section
Files
Jump to
Current section
Files
README.md
# Morsey
A package for encoding and decoding Morse code in Gleam.
[](https://hex.pm/packages/morsey)
[](https://hexdocs.pm/morsey/)
## Usage
### Encode
```gleam
import gleam/io
import morsey
let text = "Hello world!"
case morsey.encode(text) {
Ok(symbols) ->
io.println("The Morse code for " <> text <> " is " <> to_string(symbols))
Error(morsey.InvalidCharacter(char)) ->
io.println_error("Invalid character: " <> char)
}
```
### Decode
```gleam
import gleam/io
import morsey
".... . .-.. .-.. --- / .-- --- .-. .-.. -.. -.-.--"
|> morsey.from_string
|> morsey.decode
|> io.println
```
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```