@toolsnap/slugify
v1.0.0
Published
Generate URL-friendly slugs with multi-language support. Handles Chinese, Japanese, Korean, Cyrillic, and more.
Downloads
74
Maintainers
Readme
@toolsnap/slugify
Generate URL-friendly slugs with multi-language support. Handles Chinese, Japanese, Cyrillic, German, French, Turkish, Greek, and more.
Install
npm install @toolsnap/slugifyUsage
const slugify = require('@toolsnap/slugify');
slugify('Hello World!');
// 'hello-world'
slugify('Привет мир');
// 'privet-mir'
slugify('Zürichüberland');
// 'zurichuberland'
slugify('你好世界');
// 'nihaoshijie'
slugify('My Custom Slug', { separator: '_' });
// 'my_custom_slug'
slugify('A very long title that needs truncation', { maxLength: 20 });
// 'a-very-long-title'Options
| Option | Default | Description |
|--------|---------|-------------|
| separator | - | Word separator character |
| lowercase | true | Convert to lowercase |
| maxLength | 0 | Max slug length (0 = no limit) |
| replacement | '' | Replacement for unknown characters |
License
MIT
🔗 Brought to you by risetop.top — Free online tools for everyday tasks.
