slugification

Transform string into slug. Replaces spaces and special characters.

Usage no npm install needed!

<script type="module">
  import slugification from 'https://cdn.skypack.dev/slugification';
</script>

README

slugification

Build Status

Transform string into slug. Replaces spaces and special characters.

Installation

npm install slugification

Usage

var slugify = require('slugification');

slugify('What is this?')
// => 'What-is-this'

API

slugification(str, spaceReplacement, specialCharReplacement)

  • str: String to be transformed.
  • spaceReplacement: String or character to replace spaces with. Defaults to '-'.
  • specialCharReplacement: String or character to replace special characters with. Defaults to ''.

Tests

npm install -g mocha

Then

npm test

License

MIT