walkr / durex

Parse short time durations to their numerical value in milliseconds. e.g. "1s" -> 1000

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Durex

Documentation

A small Elixir library for parsing durations, such as "1s", to its numerical millisecond value, e.g. 1_000.

Installation

def deps do
  [
    {:durex, "~> 0.1.0"}
  ]
end

Usage

# 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

About

Parse short time durations to their numerical value in milliseconds. e.g. "1s" -> 1000

License:MIT License


Languages

Language:Elixir 100.0%