Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephenlacy/elixir-urn
Uniform Resource Name (URN) parsing and validation in Elixir
https://github.com/stephenlacy/elixir-urn
elixir parsing urn
Last synced: 3 months ago
JSON representation
Uniform Resource Name (URN) parsing and validation in Elixir
- Host: GitHub
- URL: https://github.com/stephenlacy/elixir-urn
- Owner: stephenlacy
- License: mit
- Created: 2017-03-24T01:42:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-17T17:50:04.000Z (almost 3 years ago)
- Last Synced: 2024-09-16T19:23:43.098Z (3 months ago)
- Topics: elixir, parsing, urn
- Language: Elixir
- Size: 18.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# URN
[![Build Status](https://travis-ci.org/stevelacy/elixir-urn.png?branch=master)](https://travis-ci.org/stevelacy/elixir-urn)
> [hex.pm documentation](https://hexdocs.pm/urn/readme.html)
**Uniform Resource Name (URN) parsing and validation in Elixir**
## Installation
Add `urn` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:urn, "~> 1.0.0"}]
end
```## Example
```elixir
defmodule Project do
alias URN
def action() do
# Parse input string "urn:collection:id" to Map
{:ok, urn} = URN.parse("urn:collection:id")IO.inspect urn
# %URN{fragment: nil, nid: "collection", nss: "id", query: nil, resolution: nil}# Turn back into a string
URN.to_string(urn)
# urn:collection:id
endend
```
License [MIT](LICENSE)