Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 617 Bytes

README.md

File metadata and controls

26 lines (17 loc) · 617 Bytes

Sluggify

Takes a string, and turns it into a slug (letters, numbers and dashes only).

This utility doesn't just remove non-matching characters, but tries to find english letter replacements for many accented letters.

Currently only works for node.js, not browsers.

Usage

First, install with

npm i @skeddles/sluggify

Then just require it as a node module. It will return a syncronous function which takes in your input string, and returns the newly made slug.

const sluggify = require('@skeddles/sluggify');
let slug = sluggify('Pokémon Red');
console.log(slug);

Outputs:

pokemon-red