warmwaffles / elixir-urn

Uniform Resource Name (URN) parsing and validation in Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URN

Build Status

hex.pm documentation

Uniform Resource Name (URN) parsing and validation in Elixir

Installation

Add urn to your list of dependencies in mix.exs:

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

Example

defmodule Project do
  import Urn
  # Parse input string "urn:collection:id" to Map
  def parse_urn(input) do
    IO.inspect parse(input)
    #  %Schema{
    #    namespace: namespace,
    #    collection: collection,
    #    identifier: identifier,
    #  }
  end

  # Validate input string and verify that it is a URN
  def validate_urn(input) do
    IO.inspect validate(input)
    # Boolean true/false
  end
end

License MIT

About

Uniform Resource Name (URN) parsing and validation in Elixir

License:MIT License


Languages

Language:Elixir 100.0%