Created
January 17, 2018 21:12
-
-
Save cs-victor-nascimento/76e7086a430c06112a6f54dce90a2d51 to your computer and use it in GitHub Desktop.
An Elixir benchmarking story - base64url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule :base64url do | |
def encode(term) when is_binary(term), | |
do: Base.url_encode64(term, ignore: :whitespace, padding: false) | |
def encode(term) when is_list(term), do: :erlang.iolist_to_binary(term) |> encode() | |
def decode(term) when is_binary(term), | |
do: Base.url_decode64!(term, ignore: :whitespace, padding: false) | |
def decode(term) when is_list(term), do: :erlang.iolist_to_binary(term) |> decode() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment