A small Elixir library for parsing durations, such as "1s"
, to its numerical millisecond value, e.g. 1_000
.
def deps do
[
{:durex, "~> 0.1.0"}
]
end
# Success
{:ok, 1_000} = Durex.ms("1s")
{:ok, 500} = Durex.ms("0.5s")
500 = Durex.ms!("0.5s")
# Error
:error = Durex.ms("bla")
MIT License