Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 883 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 883 Bytes

Slugs hex.pm version hex.pm downloads Build Status

generate creates a slug from a combination of two values, preferably a combination of an id and a descriptive string.

extract_id grabs the id from the slug.

https://hex.pm/packages/slugs

Installation

If available in Hex, the package can be installed by adding slugs to your list of dependencies in mix.exs:

def deps do
  [
    {:slugs, "~> 0.1.1"}
  ]
end

Usage

iex> Slug.generate(1337, "Lord Of The Rings")
"lord-of-the-rings-1337"

iex> Slug.extract_id("lord-of-the-rings-1337")
1337