custom_base alternatives and similar packages
Based on the "Text and Numbers" category.
Alternatively, view custom_base alternatives based on common mentions on social networks and blogs.
-
money
Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. -
nanoid
Elixir port of NanoID, a secure and URL-friendly unique ID generator. https://hex.pm/packages/nanoid -
secure_random
Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom -
chinese_translation
An elixir module to translate simplified Chinese to traditional Chinese, and vice versa, based on wikipedia data -
inet_cidr
CIDR library for Elixir that is compatible with Erlang's :inet and supports both IPv4 and IPv6 -
Ex_Cldr_Units
Unit formatting (volume, area, length, ...) functions for the Common Locale Data Repository (CLDR) -
minigen
Pure random data generation library, appropriate for realistic simulations in the Erlang ecosystem
Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers

Do you think we are missing an alternative of custom_base or a related project?
README
CustomBase
CustomBase allow you to make custom base conversion in Elixir.
Installation
Add { :custom_base, "~> 0.2" }
to deps
function in your mix.exs
file.
After you are done, run mix deps.get
in your shell to fetch and compile CustomBase.
Example
Lets make Base12
module with conversion described below.
Value | Encoding |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
7 | 7 |
8 | 8 |
9 | 9 |
10 | A |
11 | B |
Add macro to your module:
defmodule Base12 do
use CustomBase, '0123456789AB'
end
Now your module have 2 functions encode/1
and decode/1
:
iex> Base12.encode(9)
"9"
iex> Base12.encode(10)
"A"
iex> Base12.encode(11)
"B"
iex> Base12.encode(12)
"10"
iex> Base12.decode("16")
18
iex> Base12.decode("AB")
131
Specs & Docs
All specs included by this library, if you want to provide your documentation,
add it after use
call, like this:
defmodule Base12 do
use CustomBase, '0123456789AB'
@moduledoc """
Your module docs.
"""
@doc """
Documentation for encode/1.
"""
def encode(integer)
@doc """
Documentation for decode/1.
"""
def decode(binary)
@doc """
Documentation for decode!/1.
"""
def decode!(binary)
end
License
Released under the MIT License.
*Note that all licence references and agreements mentioned in the custom_base README section above
are relevant to that project's source code only.