https://github.com/shahradelahi/ts-slugify
⚡ Blazing fast, strictly typed slugification with Unicode transliteration.
https://github.com/shahradelahi/ts-slugify
high-performance seo slug slugify transliteration typescript unicode url-safe
Last synced: 3 months ago
JSON representation
⚡ Blazing fast, strictly typed slugification with Unicode transliteration.
- Host: GitHub
- URL: https://github.com/shahradelahi/ts-slugify
- Owner: shahradelahi
- License: mit
- Created: 2026-02-25T16:25:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-18T01:14:58.000Z (4 months ago)
- Last Synced: 2026-03-25T18:11:06.625Z (3 months ago)
- Topics: high-performance, seo, slug, slugify, transliteration, typescript, unicode, url-safe
- Language: TypeScript
- Homepage: https://npmjs.com/@se-oss/slugify
- Size: 79.1 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
@se-oss/slugify
_@se-oss/slugify_ is a high-performance, strictly typed slugification library with support for Unicode transliteration, smart casing, and custom character preservation.
---
- [Installation](#-installation)
- [Usage](#-usage)
- [Documentation](#-documentation)
- [Performance](#-performance)
- [Contributing](#-contributing)
- [License](#license)
## 📦 Installation
```bash
npm install @se-oss/slugify
```
Install using your favorite package manager
**pnpm**
```bash
pnpm install @se-oss/slugify
```
**yarn**
```bash
yarn add @se-oss/slugify
```
## 📖 Usage
### Basic
```typescript
import slugify from '@se-oss/slugify';
slugify('I ♥ Cats');
//=> 'i-love-cats'
slugify(' Déjà Vu! ');
//=> 'deja-vu'
slugify('я люблю единорогов');
//=> 'ya-lyublyu-edinorogov'
```
### Advanced Features
- **Smart Decamelization**: Automatically handles camelCase and PascalCase.
- **Character Preservation**: Keep specific symbols like `#` or `@` as-is.
- **Collision Handling**: Generate unique slugs using a counter.
- **Transliteration**: Powered by `@se-oss/transliterate` for robust script support.
```typescript
import { slugifyWithCounter } from '@se-oss/slugify';
slugify('fooBar 123 $#%', { decamelize: true });
//=> 'foo-bar-123'
const slug = slugifyWithCounter();
slug('foo bar'); //=> 'foo-bar'
slug('foo bar'); //=> 'foo-bar-2'
```
## 📚 Documentation
For more information, please see the [API docs](https://www.jsdocs.io/package/@se-oss/slugify).
## 🚀 Performance
| Library | hz | min | max | mean | p99 | rme |
| :-------------------- | :------------- | :----- | :----- | :----- | :----- | :----- |
| **@se-oss/slugify** | **336,028.90** | 0.0027 | 2.4412 | 0.0030 | 0.0048 | ±0.98% |
| simov/slugify | 323,177.82 | 0.0028 | 0.2437 | 0.0031 | 0.0038 | ±0.21% |
| @sindresorhus/slugify | 1,936.71 | 0.4814 | 3.0069 | 0.5163 | 0.8098 | ±1.22% |
> **Result:** @se-oss/slugify is **173x faster** than @sindresorhus/slugify.
_Benchmark script: [`bench/index.bench.ts`](bench/index.bench.ts)_
## 🤝 Contributing
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on [GitHub](https://github.com/shahradelahi/ts-slugify).
Thanks again for your support, it is much appreciated! 🙏
## License
[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi) and [contributors](https://github.com/shahradelahi/ts-slugify/graphs/contributors).