https://github.com/emilindstrom/slugs
elixir package for generating slugs and extracting id:s
https://github.com/emilindstrom/slugs
elixir elixir-library slug slug-generator slugs
Last synced: about 1 year ago
JSON representation
elixir package for generating slugs and extracting id:s
- Host: GitHub
- URL: https://github.com/emilindstrom/slugs
- Owner: emilindstrom
- Created: 2019-03-19T08:14:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-23T19:12:16.000Z (about 7 years ago)
- Last Synced: 2025-02-02T13:33:49.387Z (over 1 year ago)
- Topics: elixir, elixir-library, slug, slug-generator, slugs
- Language: Elixir
- Size: 12.7 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slugs [](https://hex.pm/packages/slugs) [](https://hex.pm/packages/slugs) [](https://travis-ci.com/emilindstrom/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](https://hex.pm/docs/publish), the package can be installed
by adding `slugs` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:slugs, "~> 0.1.1"}
]
end
```
## Usage
```elixir
iex> Slug.generate(1337, "Lord Of The Rings")
"lord-of-the-rings-1337"
iex> Slug.extract_id("lord-of-the-rings-1337")
1337
```