Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Micro npm Packages
  3. node-slug

node-slug

MITCoffeeScript

A Node.js library that converts strings to URL-safe slugs, handling Unicode characters and symbols.

GitHubGitHub
1.1k stars90 forks0 contributors

What is node-slug?

slug is a Node.js library that converts strings into URL-safe slugs by handling Unicode characters, symbols, and special characters. It solves the problem of generating clean, readable, and web-safe identifiers from arbitrary text, such as creating SEO-friendly URLs from article titles or sanitizing filenames.

Target Audience

Developers working on web applications, content management systems, or any project requiring URL generation, SEO optimization, or text normalization for storage or display.

Value Proposition

Developers choose slug for its robust Unicode handling, compliance with URL standards, and flexibility through customizable options, all without external dependencies, making it a lightweight and reliable solution.

Overview

slugifies even utf-8 chars!

Use Cases

Best For

  • Generating SEO-friendly URLs from blog post titles
  • Sanitizing user-generated content for filenames or database keys
  • Normalizing strings with Unicode symbols in multilingual applications
  • Creating readable slugs for e-commerce product pages
  • Handling special characters in API endpoints or routing systems
  • Converting emojis or symbols to text in URL paths

Not Ideal For

  • Applications requiring minimal client-side JavaScript bundles without build tools like browserify
  • Projects needing locale-aware or language-specific slug rules beyond basic Unicode symbol translation
  • Systems where real-time, high-throughput slug generation is a priority and performance overhead is a concern

Pros & Cons

Pros

Robust Unicode Support

Converts Unicode symbols and characters to English equivalents, ensuring web-safe strings, as demonstrated with examples like '♥' to 'love' and '☢' to 'radioactive' in the README.

RFC 3986 Compliance

Adheres to URL encoding standards, making generated slugs reliable for web use and compatible with various systems, as stated in the README.

Flexible Configuration

Offers customizable options for separators, case sensitivity, and character mappings, allowing tailored slug generation, such as changing separators or lowercasing via options.

Dependency-Free Core

Has no external dependencies for basic functionality, keeping the library lightweight and easy to integrate, though it includes an optional Unicode table.

Cons

Large Browser Bundle

Including the full Unicode table can result in a ~2MB file in browser environments, requiring workarounds like browserify with --ignore flags, as noted in the README.

Manual Charmap Management

For unsupported symbols or custom translations, developers must manually update the charmap, which can be tedious and error-prone for complex or evolving projects.

Outdated Test Framework

Tests are written in CoffeeScript, which may not align with modern JavaScript development practices and could hinder contributions or maintenance efforts.

Frequently Asked Questions

Quick Stats

Stars1,072
Forks90
Contributors0
Open Issues25
Last commit7 years ago
CreatedSince 2011

Tags

#text-processing#browser-compatible#unicode-handling#seo-friendly#no-dependencies#node-js

Built With

J
JavaScript
N
Node.js

Included in

Micro npm Packages4.6k
Auto-fetched 7 hours ago

Related Projects

strip-ansistrip-ansi

Strip ANSI escape codes from a string

Stars500
Forks45
Last commit3 months ago
striptagsstriptags

An implementation of PHP's strip_tags in Typescript.

Stars492
Forks51
Last commit3 years ago
decamelizedecamelize

Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow

Stars244
Forks28
Last commit3 months ago
pad-leftpad-left

Left pad a string with zeros or a specified string. Fastest implementation.

Stars44
Forks7
Last commit4 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub