Short v0.0.1 Short.URL View Source

A Short URL.

This module defines a Short URL and the main functions for working with URLs.

Link to this section Summary

Functions

Returns a new wrapped URL

Check if the URL is valid

Link to this section Types

Link to this type t() View Source
t() :: %Short.URL{__uri: URI.t}

Link to this section Functions

Returns a new wrapped URL.

Examples

iex> new("https://aliou.me")
%Short.URL{__uri: %URI{authority: "aliou.me", fragment: nil,
  host: "aliou.me", path: nil, port: 443, query: nil,
  scheme: "https", userinfo: nil}}

Check if the URL is valid.

Examples

iex> "https://aliou.me" |> new() |> valid?
true

iex> "http://aliou.me" |> new() |> valid?
true

iex> "" |> new() |> valid?
false

iex> "ayyyyyyy" |> new() |> valid?
false