I wanted to try implementing base32_clockwork in Gleam.
Inspired by shiguredo/base32_clockwork and this gist.
gleam add gbase32_clockwork
import gbase32_clockwork
import gbase32_clockwork/options.{Lowercase}
pub fn main() {
let codebook = gbase32_clockwork.new([])
codebook.encode("foobar")
|> should.equal(Ok("CSQPYRK1E8"))
// to emit as lowercase
let codebook_lc = gbase32_clockwork.new([Lowercase])
codebook.encode("foobar")
|> should.equal(Ok("csqpyrk1e8"))
}
Further documentation can be found at https://hexdocs.pm/gbase32_clockwork.
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell