slugs

creates a slug from a combination of id and string, also the other way around to grab the id from a slug.


License
Apache-2.0

Documentation

Slugs

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