@toolsnap/slug-generator
v1.0.0
Published
Convert text to URL-safe slugs with transliteration support and custom separators
Downloads
20
Maintainers
Readme
@toolsnap/slug-generator
Convert any text to a clean, URL-safe slug with transliteration support and custom separators.
Installation
npm install @toolsnap/slug-generatorUsage
const { slugify } = require('@toolsnap/slug-generator');
slugify('Hello World!'); // 'hello-world'
slugify('Café & Restaurant'); // 'cafe-restaurant'
slugify('Über smart', { separator: '_' }); // 'uber_smart'
slugify('My Post Title', { strict: true }); // 'my-post-title'Options
| Option | Default | Description |
|--------|---------|-------------|
| separator | - | Character used to separate words |
| lowercase | true | Convert result to lowercase |
| strict | false | Remove all non-alphanumeric characters |
Try it online
👉 https://risetop.top/slug-generator.html
License
MIT © Rocky Luo
